refactor(接口测试): 修改jsonSchema转json
This commit is contained in:
parent
eb235d9a97
commit
8d76cb627b
|
@ -3,7 +3,6 @@ package io.metersphere.api.dto;
|
|||
import io.metersphere.system.dto.sdk.BasePageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
@ -14,11 +13,6 @@ public class ReferenceRequest extends BasePageRequest implements Serializable {
|
|||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{operation_history.project_id.not_blank}")
|
||||
@Size(min = 1, max = 50, message = "{operation_history.project_id.length_range}")
|
||||
private String projectId;
|
||||
|
||||
@Schema(description = "资源id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{operation_history.source_id.not_blank}")
|
||||
private String resourceId;
|
||||
|
|
|
@ -87,6 +87,9 @@ public class JsonSchemaBuilder {
|
|||
|
||||
private static JsonNode generateValue(String propertyName, JsonNode propertyNode, Map<String, String> processMap) {
|
||||
// 获取属性类型
|
||||
if (propertyNode instanceof NullNode) {
|
||||
return NullNode.getInstance();
|
||||
}
|
||||
String type = propertyNode.get(PropertyConstant.TYPE).asText();
|
||||
String value = propertyNode.get(PropertyConstant.EXAMPLE).asText();
|
||||
return switch (type) {
|
||||
|
|
|
@ -2022,7 +2022,8 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
"enumInteger": null,
|
||||
"enumNumber": null,
|
||||
"extensions": null
|
||||
}
|
||||
},
|
||||
"testass": null
|
||||
},
|
||||
"additionalProperties": null,
|
||||
"required": [
|
||||
|
@ -2222,7 +2223,6 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
apiScenarioSteps.add(apiScenarioStep);
|
||||
apiScenarioStepMapper.batchInsert(apiScenarioSteps);
|
||||
ReferenceRequest request = new ReferenceRequest();
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setResourceId("test-api-get-ref");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
|
|
|
@ -2638,7 +2638,6 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
apiScenarioSteps.add(apiScenarioStep);
|
||||
apiScenarioStepMapper.batchInsert(apiScenarioSteps);
|
||||
ReferenceRequest request = new ReferenceRequest();
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setResourceId("test-scenario-get-ref");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
|
|
|
@ -1183,7 +1183,6 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
apiScenarioSteps.add(apiScenarioStep);
|
||||
apiScenarioStepMapper.batchInsert(apiScenarioSteps);
|
||||
ReferenceRequest request = new ReferenceRequest();
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
request.setResourceId("test-case-get-ref");
|
||||
request.setCurrent(1);
|
||||
request.setPageSize(10);
|
||||
|
|
Loading…
Reference in New Issue