Skip to content

Commit

Permalink
Merge pull request #741 from baboy/main-DGL
Browse files Browse the repository at this point in the history
fixed #740: 添加对openapi规范中枚举类型的说明属性
  • Loading branch information
shalousun authored Feb 26, 2024
2 parents 7da5b8c + fc3b06c commit 4b42422
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -315,6 +315,9 @@ public Map<String, Object> buildParametersSchema(ApiParam apiParam) {
} else {
// "string", "integer", "number"
schema.put("format", apiParam.getType());
if ("enum".equals(apiParam.getType())) {
schema.put("enum", apiParam.getEnumValues());
}
}
return schema;
}
@@ -411,6 +414,9 @@ private Map<String, Object> buildPropertiesData(ApiParam apiParam, Map<String, O
if (!"object".equals(openApiType)) {
propertiesData.put("type", openApiType);
propertiesData.put("format", "int16".equals(apiParam.getType()) ? "int32" : apiParam.getType());
if ("enum".equals(apiParam.getType())) {
propertiesData.put("enum", apiParam.getEnumValues());
}
}
if ("map".equals(apiParam.getType())) {
propertiesData.put("type", "object");

0 comments on commit 4b42422

Please sign in to comment.