Search in sources :

Example 11 with APIResponseImpl

use of fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl in project Payara by payara.

the class ResponseTest method apiResponseSchemaTest.

@Test
public void apiResponseSchemaTest() {
    APIResponses responses = getDocument().getPaths().getPathItem("/test/response/schema").getGET().getResponses();
    checkResponseCode(responses, 202, "custom description");
    final APIResponseImpl response = (APIResponseImpl) responses.getAPIResponse("202");
    checkMediaTypesExist(response, APPLICATION_JSON, APPLICATION_XML);
    checkSchemaDescriptions(response, "Custom Response");
}
Also used : APIResponses(org.eclipse.microprofile.openapi.models.responses.APIResponses) APIResponseImpl(fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl) Test(org.junit.Test) OpenApiApplicationTest(fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest)

Example 12 with APIResponseImpl

use of fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl in project Payara by payara.

the class ResponseTest method inheritedMediaTypeTest.

@Test
public void inheritedMediaTypeTest() {
    APIResponses responses = getDocument().getPaths().getPathItem("/test/response").getGET().getResponses();
    // Test the 200 response
    checkResponseCode(responses, 200, "success");
    final APIResponseImpl response = (APIResponseImpl) responses.getAPIResponse("200");
    checkMediaTypesExist(response, APPLICATION_JSON, APPLICATION_XML);
    checkSchemaDescriptions(response, "hello!");
}
Also used : APIResponses(org.eclipse.microprofile.openapi.models.responses.APIResponses) APIResponseImpl(fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl) Test(org.junit.Test) OpenApiApplicationTest(fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest)

Example 13 with APIResponseImpl

use of fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl in project Payara by payara.

the class ResponseTest method defaultAsyncVoidSchemaTest.

@Test
public void defaultAsyncVoidSchemaTest() {
    APIResponses responses = getDocument().getPaths().getPathItem("/test/response/schema").getHEAD().getResponses();
    checkResponseCode(responses, 200);
    final APIResponseImpl response = (APIResponseImpl) responses.getAPIResponse("200");
    checkMediaTypesExist(response, APPLICATION_JSON, APPLICATION_XML);
    checkSchemaDescriptions(response, "Custom Response");
}
Also used : APIResponses(org.eclipse.microprofile.openapi.models.responses.APIResponses) APIResponseImpl(fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl) Test(org.junit.Test) OpenApiApplicationTest(fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest)

Example 14 with APIResponseImpl

use of fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl in project Payara by payara.

the class ResponseTest method defaultPutVoidSchemaTest.

@Test
public void defaultPutVoidSchemaTest() {
    APIResponses responses = getDocument().getPaths().getPathItem("/test/response/schema").getPUT().getResponses();
    checkResponseCode(responses, 204);
    final APIResponseImpl response = (APIResponseImpl) responses.getAPIResponse("204");
    checkMediaTypesExist(response, APPLICATION_JSON, APPLICATION_XML);
    checkSchemaDescriptions(response, "Custom Response");
}
Also used : APIResponses(org.eclipse.microprofile.openapi.models.responses.APIResponses) APIResponseImpl(fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl) Test(org.junit.Test) OpenApiApplicationTest(fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest)

Aggregations

APIResponseImpl (fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl)14 APIResponses (org.eclipse.microprofile.openapi.models.responses.APIResponses)9 Test (org.junit.Test)7 OpenApiApplicationTest (fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest)6 CallbackImpl (fish.payara.microprofile.openapi.impl.model.callbacks.CallbackImpl)5 ParameterImpl (fish.payara.microprofile.openapi.impl.model.parameters.ParameterImpl)5 APIResponse (org.eclipse.microprofile.openapi.models.responses.APIResponse)5 SchemaImpl (fish.payara.microprofile.openapi.impl.model.media.SchemaImpl)4 RequestBodyImpl (fish.payara.microprofile.openapi.impl.model.parameters.RequestBodyImpl)4 SecuritySchemeImpl (fish.payara.microprofile.openapi.impl.model.security.SecuritySchemeImpl)4 ExampleImpl (fish.payara.microprofile.openapi.impl.model.examples.ExampleImpl)3 LinkImpl (fish.payara.microprofile.openapi.impl.model.links.LinkImpl)3 MediaTypeImpl (fish.payara.microprofile.openapi.impl.model.media.MediaTypeImpl)3 APIResponsesImpl (fish.payara.microprofile.openapi.impl.model.responses.APIResponsesImpl)3 SecurityRequirementImpl (fish.payara.microprofile.openapi.impl.model.security.SecurityRequirementImpl)3 ServerImpl (fish.payara.microprofile.openapi.impl.model.servers.ServerImpl)3 Components (org.eclipse.microprofile.openapi.models.Components)3 Callback (org.eclipse.microprofile.openapi.models.callbacks.Callback)3 MediaType (org.eclipse.microprofile.openapi.models.media.MediaType)3 Schema (org.eclipse.microprofile.openapi.models.media.Schema)3