refactor: swagger导入body参数的顺序不变
This commit is contained in:
parent
eab143abfb
commit
35109cee86
|
@ -262,7 +262,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
if (model != null) {
|
||||
propertyList.add(getBodyParameters(model.getProperties(), refSet));
|
||||
} else {
|
||||
propertyList.add(new JSONObject());
|
||||
propertyList.add(new JSONObject(true));
|
||||
}
|
||||
}
|
||||
return propertyList.toString();
|
||||
|
@ -278,7 +278,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
}
|
||||
|
||||
private JSONObject getBodyParameters(Map<String, Property> properties, HashSet<String> refSet) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject jsonObject = new JSONObject(true);
|
||||
if (properties != null) {
|
||||
properties.forEach((key, value) -> {
|
||||
if (value instanceof ObjectProperty) {
|
||||
|
@ -301,7 +301,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
if (model != null) {
|
||||
propertyList.add(getBodyParameters(model.getProperties(), refSet));
|
||||
} else {
|
||||
propertyList.add(new JSONObject());
|
||||
propertyList.add(new JSONObject(true));
|
||||
}
|
||||
jsonObject.put(key, propertyList);
|
||||
} else if (items instanceof ObjectProperty) {
|
||||
|
|
|
@ -340,12 +340,12 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
|
||||
private Object parseSchema(Schema schema, Set<String> refSet, Map<String, Schema> infoMap) {
|
||||
if (schema == null) {
|
||||
return new JSONObject();
|
||||
return new JSONObject(true);
|
||||
}
|
||||
infoMap.put(schema.getName(), schema);
|
||||
if (StringUtils.isNotBlank(schema.get$ref())) {
|
||||
if (refSet.contains(schema.get$ref())) {
|
||||
return new JSONObject();
|
||||
return new JSONObject(true);
|
||||
}
|
||||
refSet.add(schema.get$ref());
|
||||
Object propertiesResult = parseSchemaProperties(getModelByRef(schema.get$ref()), refSet, infoMap);
|
||||
|
@ -386,7 +386,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
if (MapUtils.isEmpty(properties)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONObject jsonObject = new JSONObject(true);
|
||||
properties.forEach((key, value) -> {
|
||||
jsonObject.put(key, parseSchema(value, refSet, infoMap));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue