use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyComponentsProperty.
private void verifyComponentsProperty(JsonMapObject sw3, OpenApiConfiguration cfg) {
JsonMapObject comps = sw3.getJsonMapProperty("components");
assertEquals(3, comps.size());
JsonMapObject requestBodies = comps.getJsonMapProperty("requestBodies");
if (cfg.isCreateRequestBodies()) {
assertEquals(4, requestBodies.size());
// UserArray
JsonMapObject userArrayContent = verifyRequestBodyContent(requestBodies, "UserArray");
assertEquals(1, userArrayContent.size());
verifyArrayContent(userArrayContent, "application/json", "User");
// Pet
JsonMapObject petContent = verifyRequestBodyContent(requestBodies, "Pet");
assertEquals(2, petContent.size());
verifySimpleContent(petContent, "application/json", "Pet");
verifySimpleContent(petContent, "application/xml", "Pet");
// User
JsonMapObject userContent = verifyRequestBodyContent(requestBodies, "User");
assertEquals(1, userContent.size());
verifySimpleContent(userContent, "application/json", "User");
// Order
JsonMapObject orderContent = verifyRequestBodyContent(requestBodies, "Order");
assertEquals(1, orderContent.size());
verifySimpleContent(orderContent, "application/json", "Order");
} else {
assertEquals(0, requestBodies.size());
}
assertNotNull(comps.getJsonMapProperty("schemas"));
assertNotNull(comps.getJsonMapProperty("securitySchemes"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyRequestBodyContent.
private JsonMapObject verifyRequestBodyContent(JsonMapObject json, String propName) {
JsonMapObject requestBody = json.getJsonMapProperty(propName);
assertEquals(3, requestBody.size());
assertNotNull(requestBody.getProperty("description"));
assertTrue(requestBody.getBooleanProperty("required"));
return requestBody.getJsonMapProperty("content");
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyPetPathPut.
private void verifyPetPathPut(JsonMapObject pet, OpenApiConfiguration cfg) {
JsonMapObject petPut = pet.getJsonMapProperty("put");
assertEquals(7, petPut.size());
testCommonVerbProps(petPut, "updatePet");
assertNull(petPut.getProperty("parameters"));
if (cfg.isCreateRequestBodies()) {
verifyRequestBodyRef(petPut, "Pet");
} else {
JsonMapObject content = verifyRequestBodyContent(petPut);
assertEquals(2, content.size());
verifySimpleContent(content, "application/json", "Pet");
verifySimpleContent(content, "application/xml", "Pet");
}
JsonMapObject responses = petPut.getJsonMapProperty("responses");
assertEquals(3, responses.size());
assertNotNull(responses.getProperty("400"));
assertNotNull(responses.getProperty("404"));
assertNotNull(responses.getProperty("405"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyOrderIdParameter.
private void verifyOrderIdParameter(JsonMapObject param, boolean minOnly) {
assertEquals("orderId", param.getProperty("name"));
assertEquals("path", param.getProperty("in"));
assertNull(param.getProperty("type"));
assertNull(param.getProperty("format"));
assertNotNull(param.getProperty("description"));
assertTrue(param.getBooleanProperty("required"));
JsonMapObject schema = param.getJsonMapProperty("schema");
assertEquals(minOnly ? 3 : 4, schema.size());
assertEquals("integer", schema.getProperty("type"));
assertNotNull(schema.getProperty("minimum"));
if (!minOnly) {
assertNotNull(schema.getProperty("maximum"));
}
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyPetIdParameter.
private void verifyPetIdParameter(JsonMapObject param) {
assertEquals("petId", param.getProperty("name"));
assertEquals("path", param.getProperty("in"));
assertNull(param.getProperty("type"));
assertNull(param.getProperty("format"));
assertNotNull(param.getProperty("description"));
assertTrue(param.getBooleanProperty("required"));
JsonMapObject schema = param.getJsonMapProperty("schema");
assertEquals(2, schema.size());
assertEquals("integer", schema.getProperty("type"));
assertEquals("int64", schema.getProperty("format"));
}
Aggregations