У меня есть следующий java REST сервис
@GET
@Path("/{customerId}")
@Operation(
summary = "Test summary",
description = "Test desciption",
responses = {
@ApiResponse(
responseCode = "200",
content = @Content(
schema = @Schema(implementation = CustomerDto.class),
mediaType = "application/json"),
description = "CustomerDto description"),
@ApiResponse(
responseCode = "400",
description = "Description for 400 status")
//Here you can add all response statuses and their's descriptions
})
public CustomerDto findCustomerById(@Parameter(description = "Id of the customer", required = true) @PathParam("customerId") Long customerId) {
return apiFacade.getCustomerDtoByCustomerId(customerId);
}
Простой dto-класс
public class CustomerDto {
private TestInfo testInfo;
}
Простой подкласс
public class TestInfo {
private Long testId;
private Long checkId;
public TestInfo(Long testId, Long checkId) {
this.testId = testId;
this.checkId = checkId;
}
public Long getTestId() {
return testId;
}
public Long getCheckId() {
return checkId;
}
public boolean isDecisionMade() {
return testId != null || checkId != null;
}
}
Я бы хотел увидеть TestInfo-json без раздела 'SolutionMade'. Можете ли вы помочь мне? Это возможно?
"TestInfo" : {
"type" : "object",
"properties" : {
"testId" : {
"type" : "integer",
"format" : "int64"
},
"checkId" : {
"type" : "integer",
"format" : "int64"
},
"decisionMade" : {
"type" : "boolean"
}
}
}
Можно ли сказать, что swagger использует поля класса вместо getter + setter? Я использую чванство версии 2.2.2. Генерация JSON через BaseOpenApiResource. Все конфиги по умолчанию.