我正在研究 Spring Boot v2.2.6.RELEASE 和 Open API 集成示例。此示例具有使用 20 个不同参数进行搜索的能力。所以这个 POJO 类拥有CustomSearchDto
这 20 个不同的值。
在 POJO 中我使用了 orgName,但@parameter(in = ParameterIn.QUERY, name = "orgizationName",
不知何故我想覆盖变量名。我必须这样做。有什么办法吗?
@Parameter(in = ParameterIn.QUERY, name = "orgizationName", schema = @Schema(type = "string"))
@Parameter(in = ParameterIn.QUERY, name = "employeeId", schema = @Schema(type = "string"))
@Parameter(in = ParameterIn.QUERY, name = "emailId", schema = @Schema(type = "string"))
@Parameter(in=ParameterIn.QUERY, name="page", description="Results page you want to retrieve (0..N)", schema=@Schema(defaultValue = "0"))
@Parameter(in=ParameterIn.QUERY, name="size", description="Number of records per page.", schema=@Schema(defaultValue = "30"))
@GetMapping(value = "/employees/organizations")
public ResponseEntity<PagedModel<Employees>> search(CustomSearchDto requestparams,
@Parameter(hidden=true) Pageable pageRequest) {
......
........
return new ResponseEntity<>(model, HttpStatus.OK);
}
这是我的自定义 DTO 类
public class CustomSearchDto {
@Schema(description = "", type = "string", example = " ")
private String orgName;
@Schema(description = "", type = "string", example = " ")
private String empId;
@Schema(description = "", type = "integer", example = "null")
private Integer email;
.........
..............
.............
}