fix(接口测试): 修复接口导入未导入query值的缺陷

--bug=1039645 --user=王孝刚 【接口测试】接口定义-导入swagger文件中query参数值未导入
https://www.tapd.cn/55049933/s/1500400
This commit is contained in:
wxg0103 2024-04-18 09:47:54 +08:00 committed by 刘瑞斌
parent d41583c4cd
commit e895f6ee8b
1 changed files with 12 additions and 0 deletions

View File

@ -434,6 +434,9 @@ public class Swagger3Parser<T> implements ImportParser<ApiDefinitionImport> {
queryParam.setMinLength(queryParameter.getSchema().getMinLength()); queryParam.setMinLength(queryParameter.getSchema().getMinLength());
queryParam.setMaxLength(queryParameter.getSchema().getMaxLength()); queryParam.setMaxLength(queryParameter.getSchema().getMaxLength());
} }
if (queryParameter.getExample() != null) {
queryParam.setValue(getDefaultObjectValue(queryParameter.getExample()));
}
arguments.add(queryParam); arguments.add(queryParam);
} }
@ -445,6 +448,9 @@ public class Swagger3Parser<T> implements ImportParser<ApiDefinitionImport> {
if (cookieParameter.getSchema() != null) { if (cookieParameter.getSchema() != null) {
headerParams.setValue(getDefaultObjectValue(cookieParameter.getSchema().getExample())); headerParams.setValue(getDefaultObjectValue(cookieParameter.getSchema().getExample()));
} }
if (cookieParameter.getExample() != null) {
headerParams.setValue(getDefaultObjectValue(cookieParameter.getExample()));
}
headers.add(headerParams); headers.add(headerParams);
} }
@ -455,6 +461,9 @@ public class Swagger3Parser<T> implements ImportParser<ApiDefinitionImport> {
if (headerParameter.getSchema() != null) { if (headerParameter.getSchema() != null) {
headerParams.setValue(getDefaultObjectValue(headerParameter.getSchema().getExample())); headerParams.setValue(getDefaultObjectValue(headerParameter.getSchema().getExample()));
} }
if (headerParameter.getExample() != null) {
headerParams.setValue(getDefaultObjectValue(headerParameter.getExample()));
}
headers.add(headerParams); headers.add(headerParams);
} }
@ -470,6 +479,9 @@ public class Swagger3Parser<T> implements ImportParser<ApiDefinitionImport> {
restParam.setMinLength(parameter.getSchema().getMinLength()); restParam.setMinLength(parameter.getSchema().getMinLength());
restParam.setMaxLength(parameter.getSchema().getMaxLength()); restParam.setMaxLength(parameter.getSchema().getMaxLength());
} }
if (parameter.getExample() != null) {
restParam.setValue(getDefaultObjectValue(parameter.getExample()));
}
rest.add(restParam); rest.add(restParam);
} }