fix: swagger3导入报错

This commit is contained in:
chenjianxing 2021-06-21 13:53:00 +08:00 committed by jianxing
parent ab9d698b66
commit b62cdf5e01
1 changed files with 5 additions and 1 deletions

View File

@ -356,7 +356,11 @@ public class Swagger3Parser extends SwaggerAbstractParser {
} else {
if(schema.getType() != null) { // 特判属性不是对象的情况直接将基本类型赋值进去
if(StringUtils.equals(schema.getType(), "string")) {
String example = (String) schema.getExample();
Object exampleObj = schema.getExample();
String example = null;
if (exampleObj != null) {
example = exampleObj.toString();
}
return example == null ? "" : example;
} else if(StringUtils.equals(schema.getType(), "boolean")) {
return schema.getExample();