Search in sources :

Example 46 with Schema

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

the class FilterUtil method filterSchemaList.

/**
 * Filters the given models.
 * @param filter
 * @param models
 */
private static void filterSchemaList(OASFilter filter, List<Schema> models) {
    if (models == null) {
        return;
    }
    ListIterator<Schema> iterator = models.listIterator();
    while (iterator.hasNext()) {
        Schema model = iterator.next();
        filterSchema(filter, model);
        if (filter.filterSchema(model) == null) {
            iterator.remove();
        }
    }
}
Also used : Schema(org.eclipse.microprofile.openapi.models.media.Schema)

Example 47 with Schema

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

the class ExpectationTests method genericFieldTest.

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

Example 48 with Schema

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

the class ExpectationTests method testGenericsWithBounds.

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

Example 49 with Schema

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

the class ExpectationTests method testUnresolvable.

/**
 * Unresolvable type parameter.
 */
@Test
@Ignore
public void testUnresolvable() throws IOException, JSONException {
    DotName bar = createSimple(Bar.class.getName());
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, ClassType.create(bar, Type.Kind.CLASS));
    Schema result = scanner.process();
    printToConsole(bar.local(), result);
    assertJsonEquals(bar.local(), "unresolvable.expected.json", result);
}
Also used : Bar(org.wildfly.swarm.microprofile.openapi.runtime.entity.Bar) Schema(org.eclipse.microprofile.openapi.models.media.Schema) DotName(org.jboss.jandex.DotName) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 50 with Schema

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

the class SpecialCaseTests method testCollection_SimpleTerminalType.

@Test
public void testCollection_SimpleTerminalType() throws IOException, JSONException {
    String name = SpecialCaseTestContainer.class.getName();
    Type pType = getFieldFromKlazz(name, "listOfString").type();
    OpenApiDataObjectScanner scanner = new OpenApiDataObjectScanner(index, pType);
    Schema result = scanner.process();
    printToConsole(name, result);
    assertJsonEquals(name, "special.simple.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