fix: swagger2导入报空指针
This commit is contained in:
parent
0d5643919b
commit
e9eed278ea
|
@ -293,6 +293,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
HashSet<String> refSet = new HashSet<>();
|
||||
Model model = getRefModelType(schema, refSet);
|
||||
item.setType("object");
|
||||
if (model != null)
|
||||
item.setProperties(parseSchemaProperties(model.getProperties(), refSet));
|
||||
} else if (schema instanceof ArrayModel) {
|
||||
//模型数组
|
||||
|
@ -301,11 +302,9 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
handleArrayItemProperties(item, arrayModel.getItems(), refSet);
|
||||
} else if (schema instanceof ModelImpl) {
|
||||
ModelImpl model = (ModelImpl) schema;
|
||||
Map<String, Property> properties = model.getProperties();
|
||||
if (model != null) {
|
||||
item.setType("object");
|
||||
item.setProperties(parseSchemaProperties(properties, new HashSet<>()));
|
||||
}
|
||||
if (model != null)
|
||||
item.setProperties(parseSchemaProperties(model.getProperties(), new HashSet<>()));
|
||||
}
|
||||
if (schema.getExample() != null) {
|
||||
item.getMock().put("mock", schema.getExample());
|
||||
|
|
Loading…
Reference in New Issue