This commit is contained in:
fit2-zhao 2021-03-18 17:38:09 +08:00
commit 03c171e66d
1 changed files with 5 additions and 7 deletions

View File

@ -137,7 +137,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
private String getBodyType(Operation operation) {
if (CollectionUtils.isEmpty(operation.getConsumes())) {
return Body.RAW;
return Body.JSON;
}
String contentType = operation.getConsumes().get(0);
return getBodyType(contentType);
@ -238,12 +238,10 @@ public class Swagger2Parser extends SwaggerAbstractParser {
return propertyList.toString();
} else if (schema instanceof ModelImpl) {
ModelImpl model = (ModelImpl) schema;
if (StringUtils.equals("object", model.getType())) {
model.getProperties();
if (model != null) {
JSONObject bodyParameters = getBodyParameters(model.getProperties(), new HashSet<>());
return bodyParameters.toJSONString();
}
Map<String, Property> properties = model.getProperties();
if (model != null && properties != null) {
JSONObject bodyParameters = getBodyParameters(properties, new HashSet<>());
return bodyParameters.toJSONString();
}
}
return "";