use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyRequestBodyRef.
private void verifyRequestBodyRef(JsonMapObject json, String refName) {
JsonMapObject requestBody = json.getJsonMapProperty("requestBody");
assertEquals(1, requestBody.size());
assertEquals("#components/requestBodies/" + refName, requestBody.getProperty("$ref"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyStringParameter.
private void verifyStringParameter(JsonMapObject param, String name, String inType) {
assertEquals(name, param.getProperty("name"));
assertEquals(inType, 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("password".equals(name) ? 2 : 1, schema.size());
assertEquals("string", schema.getProperty("type"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyUserUsernamePathGet.
private void verifyUserUsernamePathGet(JsonMapObject user) {
JsonMapObject userGet = user.getJsonMapProperty("get");
assertEquals(6, userGet.size());
testCommonVerbPropsExceptSec(userGet, "getUserByName");
List<Map<String, Object>> parameters = userGet.getListMapProperty("parameters");
assertEquals(1, parameters.size());
JsonMapObject userParam = new JsonMapObject(parameters.get(0));
verifyUserNameParameter(userParam, "username", "path");
assertNull(userGet.getProperty("requestBody"));
JsonMapObject responses = userGet.getJsonMapProperty("responses");
assertEquals(3, responses.size());
assertNotNull(responses.getProperty("400"));
assertNotNull(responses.getProperty("404"));
JsonMapObject okResp = responses.getJsonMapProperty("200");
assertEquals(2, okResp.size());
assertNotNull(okResp.getProperty("description"));
JsonMapObject content = okResp.getJsonMapProperty("content");
assertEquals(2, content.size());
verifySimpleContent(content, "application/json", "User");
verifySimpleContent(content, "application/xml", "User");
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifySimpleContent.
private void verifySimpleContent(JsonMapObject contentMap, String mediaType, String modelName) {
JsonMapObject content = contentMap.getJsonMapProperty(mediaType);
assertEquals(1, content.size());
JsonMapObject schema = content.getJsonMapProperty("schema");
assertEquals(1, schema.size());
assertEquals("#components/schemas/" + modelName, schema.getStringProperty("$ref"));
}
use of org.apache.cxf.jaxrs.json.basic.JsonMapObject in project cxf by apache.
the class SwaggerToOpenApiConversionUtilsTest method verifyPetIdUploadImagePathPost.
private void verifyPetIdUploadImagePathPost(JsonMapObject pet) {
JsonMapObject petPost = pet.getJsonMapProperty("post");
assertEquals(8, petPost.size());
testCommonVerbProps(petPost, "uploadFile");
List<Map<String, Object>> parameters = petPost.getListMapProperty("parameters");
assertEquals(1, parameters.size());
JsonMapObject pathIdParam = new JsonMapObject(parameters.get(0));
verifyPetIdParameter(pathIdParam);
verifyPetFormContent(petPost, "multipart/form-data", "additionalMetadata", "file");
JsonMapObject responses = petPost.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());
verifySimpleContent(content, "application/json", "ApiResponse");
}
Aggregations