fix: swagger 参数描述中带有/导入报错
This commit is contained in:
parent
ec3276edff
commit
cef3c8dea7
|
@ -130,8 +130,15 @@ public class Swagger2Parser extends ApiImportAbstractParser {
|
||||||
Model schema = bodyParameter.getSchema();
|
Model schema = bodyParameter.getSchema();
|
||||||
|
|
||||||
if (schema instanceof RefModel) {
|
if (schema instanceof RefModel) {
|
||||||
|
String simpleRef = "";
|
||||||
RefModel refModel = (RefModel) bodyParameter.getSchema();
|
RefModel refModel = (RefModel) bodyParameter.getSchema();
|
||||||
Model model = definitions.get(refModel.getSimpleRef());
|
String originalRef = refModel.getOriginalRef();
|
||||||
|
if (refModel.getOriginalRef().split("/").length > 3) {
|
||||||
|
simpleRef = originalRef.replace("#/definitions/", "");
|
||||||
|
} else {
|
||||||
|
simpleRef = refModel.getSimpleRef();
|
||||||
|
}
|
||||||
|
Model model = definitions.get(simpleRef);
|
||||||
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions);
|
JSONObject bodyParameters = getBodyJSONObjectParameters(model.getProperties(), definitions);
|
||||||
body.setRaw(bodyParameters.toJSONString());
|
body.setRaw(bodyParameters.toJSONString());
|
||||||
} else if (schema instanceof ArrayModel) {
|
} else if (schema instanceof ArrayModel) {
|
||||||
|
|
Loading…
Reference in New Issue