Search in sources :

Example 6 with APIResponses

use of org.eclipse.microprofile.openapi.models.responses.APIResponses in project Payara by payara.

the class ResponseTest method defaultDeleteStringSchemaTest.

@Test
public void defaultDeleteStringSchemaTest() {
    APIResponses responses = getDocument().getPaths().getPathItem("/test/response/schema").getDELETE().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 7 with APIResponses

use of org.eclipse.microprofile.openapi.models.responses.APIResponses 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 8 with APIResponses

use of org.eclipse.microprofile.openapi.models.responses.APIResponses 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 9 with APIResponses

use of org.eclipse.microprofile.openapi.models.responses.APIResponses 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 10 with APIResponses

use of org.eclipse.microprofile.openapi.models.responses.APIResponses 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

APIResponses (org.eclipse.microprofile.openapi.models.responses.APIResponses)14 APIResponseImpl (fish.payara.microprofile.openapi.impl.model.responses.APIResponseImpl)9 Test (org.junit.Test)8 OpenApiApplicationTest (fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest)7 Schema (org.eclipse.microprofile.openapi.models.media.Schema)5 APIResponse (org.eclipse.microprofile.openapi.models.responses.APIResponse)5 MediaType (org.eclipse.microprofile.openapi.models.media.MediaType)4 List (java.util.List)3 Operation (org.eclipse.microprofile.openapi.models.Operation)3 PathItem (org.eclipse.microprofile.openapi.models.PathItem)3 Callback (org.eclipse.microprofile.openapi.models.callbacks.Callback)3 Parameter (org.eclipse.microprofile.openapi.models.parameters.Parameter)3 RequestBody (org.eclipse.microprofile.openapi.models.parameters.RequestBody)3 SecurityRequirement (org.eclipse.microprofile.openapi.models.security.SecurityRequirement)3 Server (org.eclipse.microprofile.openapi.models.servers.Server)3 Tag (org.eclipse.microprofile.openapi.models.tags.Tag)3 CallbackImpl (fish.payara.microprofile.openapi.impl.model.callbacks.CallbackImpl)2 ContentImpl (fish.payara.microprofile.openapi.impl.model.media.ContentImpl)2 MediaTypeImpl (fish.payara.microprofile.openapi.impl.model.media.MediaTypeImpl)2 SchemaImpl (fish.payara.microprofile.openapi.impl.model.media.SchemaImpl)2