fix(接口测试): 导入失败
--bug=1045492 --user=王旭 [接口测试]github#32739相同的swagger文件导入接口定义,在V2导入成功,V3导入失败 https://www.tapd.cn/55049933/s/1566276
This commit is contained in:
parent
d370961a28
commit
f45bf56307
|
@ -303,7 +303,9 @@ public class Swagger3Parser extends ApiImportAbstractParser<ApiDefinitionImport>
|
||||||
case MediaType.TEXT_PLAIN_VALUE -> {
|
case MediaType.TEXT_PLAIN_VALUE -> {
|
||||||
body.setBodyType(Body.BodyType.RAW.name());
|
body.setBodyType(Body.BodyType.RAW.name());
|
||||||
RawBody rawBody = new RawBody();
|
RawBody rawBody = new RawBody();
|
||||||
|
if (ObjectUtils.isNotEmpty(value.getSchema().getExample())) {
|
||||||
rawBody.setValue(value.getSchema().getExample().toString());
|
rawBody.setValue(value.getSchema().getExample().toString());
|
||||||
|
}
|
||||||
body.setRawBody(rawBody);
|
body.setRawBody(rawBody);
|
||||||
}
|
}
|
||||||
default -> body.setBodyType(Body.BodyType.NONE.name());
|
default -> body.setBodyType(Body.BodyType.NONE.name());
|
||||||
|
@ -352,7 +354,9 @@ public class Swagger3Parser extends ApiImportAbstractParser<ApiDefinitionImport>
|
||||||
case MediaType.TEXT_PLAIN_VALUE -> {
|
case MediaType.TEXT_PLAIN_VALUE -> {
|
||||||
body.setBodyType(Body.BodyType.RAW.name());
|
body.setBodyType(Body.BodyType.RAW.name());
|
||||||
RawBody rawBody = new RawBody();
|
RawBody rawBody = new RawBody();
|
||||||
|
if (ObjectUtils.isNotEmpty(value.getSchema().getExample())) {
|
||||||
rawBody.setValue(value.getSchema().getExample().toString());
|
rawBody.setValue(value.getSchema().getExample().toString());
|
||||||
|
}
|
||||||
body.setRawBody(rawBody);
|
body.setRawBody(rawBody);
|
||||||
}
|
}
|
||||||
default -> body.setBodyType(Body.BodyType.NONE.name());
|
default -> body.setBodyType(Body.BodyType.NONE.name());
|
||||||
|
|
Loading…
Reference in New Issue