Search in sources :

Example 11 with Schema

use of org.eclipse.microprofile.openapi.models.media.Schema in project wildfly-swarm by wildfly-swarm.

the class ExpectationTests method testBareEnum.

@Test
public void testBareEnum() throws IOException, JSONException {
    DotName baz = createSimple(EnumContainer.class.getName());
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, ClassType.create(baz, Type.Kind.CLASS));
    Schema result = scanner.process();
    printToConsole(baz.local(), result);
    assertJsonEquals(baz.local(), "enum.expected.json", result);
}
Also used : EnumContainer(org.wildfly.swarm.microprofile.openapi.runtime.entity.EnumContainer) Schema(org.eclipse.microprofile.openapi.models.media.Schema) DotName(org.jboss.jandex.DotName) Test(org.junit.Test)

Example 12 with Schema

use of org.eclipse.microprofile.openapi.models.media.Schema in project wildfly-swarm by wildfly-swarm.

the class OpenApiDataObjectScannerTestBase method schemaToString.

public static String schemaToString(String entityName, Schema schema) throws IOException {
    Map<String, Schema> map = new HashMap<>();
    map.put(entityName, schema);
    OpenAPIImpl oai = new OpenAPIImpl();
    ComponentsImpl comp = new ComponentsImpl();
    comp.setSchemas(map);
    oai.setComponents(comp);
    return OpenApiSerializer.serialize(oai, OpenApiSerializer.Format.JSON);
}
Also used : HashMap(java.util.HashMap) OpenAPIImpl(org.wildfly.swarm.microprofile.openapi.api.models.OpenAPIImpl) Schema(org.eclipse.microprofile.openapi.models.media.Schema) ComponentsImpl(org.wildfly.swarm.microprofile.openapi.api.models.ComponentsImpl)

Example 13 with Schema

use of org.eclipse.microprofile.openapi.models.media.Schema in project wildfly-swarm by wildfly-swarm.

the class SpecialCaseTests method testCollection_Wildcard.

@Test
public void testCollection_Wildcard() throws IOException, JSONException {
    String name = SpecialCaseTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "listOfAnything").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "special.wildcard.expected.json", result);
}
Also used : Type(org.jboss.jandex.Type) Schema(org.eclipse.microprofile.openapi.models.media.Schema) Test(org.junit.Test)

Example 14 with Schema

use of org.eclipse.microprofile.openapi.models.media.Schema in project wildfly-swarm by wildfly-swarm.

the class SpecialCaseTests method testCollection_DataObjectList.

@Test
public void testCollection_DataObjectList() throws IOException, JSONException {
    String name = SpecialCaseTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "ccList").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "special.dataObjectList.expected.json", result);
}
Also used : Type(org.jboss.jandex.Type) Schema(org.eclipse.microprofile.openapi.models.media.Schema) Test(org.junit.Test)

Example 15 with Schema

use of org.eclipse.microprofile.openapi.models.media.Schema in project wildfly-swarm by wildfly-swarm.

the class SpecialCaseTests method testCollection_WildcardWithSuperBound.

@Test
public void testCollection_WildcardWithSuperBound() throws IOException, JSONException {
    String name = SpecialCaseTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "listSuperFlight").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "special.wildcardWithSuperBound.expected.json", result);
}
Also used : Type(org.jboss.jandex.Type) Schema(org.eclipse.microprofile.openapi.models.media.Schema) Test(org.junit.Test)

Aggregations

Schema (org.eclipse.microprofile.openapi.models.media.Schema)51 Type (org.jboss.jandex.Type)15 Test (org.junit.Test)15 SchemaImpl (fish.payara.microprofile.openapi.impl.model.media.SchemaImpl)10 ClassType (org.jboss.jandex.ClassType)10 MediaType (org.eclipse.microprofile.openapi.models.media.MediaType)7 ArrayList (java.util.ArrayList)5 Parameter (org.eclipse.microprofile.openapi.models.parameters.Parameter)5 AnnotationModel (org.glassfish.hk2.classmodel.reflect.AnnotationModel)5 SchemaImpl (org.wildfly.swarm.microprofile.openapi.api.models.media.SchemaImpl)5 RequestBodyImpl (fish.payara.microprofile.openapi.impl.model.parameters.RequestBodyImpl)4 LinkedHashMap (java.util.LinkedHashMap)4 List (java.util.List)4 DMNType (org.kie.dmn.api.core.DMNType)4 Components (org.eclipse.microprofile.openapi.models.Components)3 Operation (org.eclipse.microprofile.openapi.models.Operation)3 Callback (org.eclipse.microprofile.openapi.models.callbacks.Callback)3 SchemaType (org.eclipse.microprofile.openapi.models.media.Schema.SchemaType)3 APIResponse (org.eclipse.microprofile.openapi.models.responses.APIResponse)3 APIResponses (org.eclipse.microprofile.openapi.models.responses.APIResponses)3