use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method testDefaultResponse.
private void testDefaultResponse(JsonMapObject json) {
JsonMapObject responses = json.getJsonMapProperty("responses");
assertEquals(1, responses.size());
assertNotNull(responses.getProperty("default"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyPetPathPost.
private void verifyPetPathPost(JsonMapObject pet, OpenApiConfiguration cfg) {
JsonMapObject petPost = pet.getJsonMapProperty("post");
assertEquals(7, petPost.size());
testCommonVerbProps(petPost, "addPet");
assertNull(petPost.getProperty("parameters"));
if (cfg.isCreateRequestBodies()) {
verifyRequestBodyRef(petPost, "Pet");
} else {
JsonMapObject content = verifyRequestBodyContent(petPost);
assertEquals(2, content.size());
verifySimpleContent(content, "application/json", "Pet");
verifySimpleContent(content, "application/xml", "Pet");
}
JsonMapObject responses = petPost.getJsonMapProperty("responses");
assertEquals(1, responses.size());
assertNotNull(responses.getProperty("405"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method testConvertFromSwaggerToOpenApiWithRequestBodies.
@Test
public void testConvertFromSwaggerToOpenApiWithRequestBodies() {
OpenApiConfiguration cfg = new OpenApiConfiguration();
cfg.setCreateRequestBodies(true);
String s = SwaggerToOpenApiConversionUtils.getOpenApiFromSwaggerLoc("/swagger2petShop.json", cfg);
JsonMapObjectReaderWriter readerWriter = new JsonMapObjectReaderWriter();
JsonMapObject sw3 = readerWriter.fromJsonToJsonObject(s);
assertEquals("3.0.0", sw3.getStringProperty("openapi"));
verifyServersProperty(sw3);
verifyInfoProperty(sw3);
verifyTagsProperty(sw3);
verifyPathsProperty(sw3, cfg);
verifyComponentsProperty(sw3, cfg);
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyArrayContent.
private void verifyArrayContent(JsonMapObject contentMap, String mediaType, String modelName) {
JsonMapObject content = contentMap.getJsonMapProperty(mediaType);
assertEquals(1, content.size());
JsonMapObject schema = content.getJsonMapProperty("schema");
assertEquals(2, schema.size());
assertEquals("array", schema.getStringProperty("type"));
JsonMapObject items = schema.getJsonMapProperty("items");
assertEquals(1, items.size());
assertEquals("#components/schemas/" + modelName, items.getStringProperty("$ref"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyStoreInventoryPathGet.
private void verifyStoreInventoryPathGet(JsonMapObject store) {
JsonMapObject storeGet = store.getJsonMapProperty("get");
assertEquals(6, storeGet.size());
testCommonVerbProps(storeGet, "getInventory");
assertNull(storeGet.getProperty("parameters"));
assertNull(storeGet.getJsonMapProperty("requestBody"));
JsonMapObject responses = storeGet.getJsonMapProperty("responses");
assertEquals(1, responses.size());
JsonMapObject okResp = responses.getJsonMapProperty("200");
assertEquals(2, okResp.size());
assertNotNull(okResp.getProperty("description"));
JsonMapObject content = okResp.getJsonMapProperty("content");
assertEquals(1, content.size());
verifyMapContent(content, "application/json", "integer", "int32");
}
Aggregations