Это работает так, как ожидалось/задокументировано путем определения много-много аннотаций в REST-Endpoint. Например:
@POST
@Operation(summary = "creates a new product")
@APIResponse(responseCode = "201", description = "product creation successful")
@APIResponse(responseCode = "500", description = "Server unavailable")
@Path("/")
@RequestBody(content = @Content(examples = {
@ExampleObject(
name = CreateProductRequest.EXAMPLE1_NAME,
description = CreateProductRequest.EXAMPLE1_DESCRIPTION,
value = CreateProductRequest.EXAMPLE1_VALUE
)
}))
@APIResponse(content = @Content(examples = {
@ExampleObject(
name = CreateProductResponse.EXAMPLE1_NAME,
description = CreateProductResponse.EXAMPLE1_DESCRIPTION,
value = CreateProductResponse.EXAMPLE1_VALUE
)
}))
@ResponseStatus(201)
public CreateProductResponse create(CreateProductRequest createProductRequest) throws ValidationException {
return productManager.create(new RequestContext(1, 1), createProductRequest);
}
В этом случае REST-Endpoint практически становится нечитаемым (это один из небольших примеров)
Мой предпочтительный способ решить эту проблему — это определить интерфейс, который будет реализовывать REST-конечная точка.
Может мне как-то помочь...
- . .. (а) выясните, возможно ли это вообще.
... покажите мне пример того, как определить такой интерфейс в Quarkus
То, что я ожидал, будет работать (но не работает / аннотации в интерфейсе полностью игнорируется платформой и не попадает в сгенерированный файл swagger-json/yaml):
@Path("/api/v1/products")
public class ProductControllerV1 implements ProductApiV1 {
@POST
@Path("/")
@Override
public CreateProductResponse create(CreateProductRequest createProductRequest) throws ValidationException {
return productManager.create(new RequestContext(1, 1), createProductRequest);
}
}
@Tag(
name = "Product Controller V1",
description = "Product Operations, for testing many different use-cases"
)
@Path("/api/v1/products")
public interface ProductApiV1 {
@POST
@Operation(summary = "creates a new product")
@APIResponse(responseCode = "201", description = "product creation successful")
@APIResponse(responseCode = "500", description = "Server unavailable")
@Path("/")
@RequestBody(content = @Content(examples = {
@ExampleObject(
name = CreateProductRequest.EXAMPLE1_NAME,
description = CreateProductRequest.EXAMPLE1_DESCRIPTION,
value = CreateProductRequest.EXAMPLE1_VALUE
)
}))
@APIResponse(content = @Content(examples = {
@ExampleObject(
name = CreateProductResponse.EXAMPLE1_NAME,
description = CreateProductResponse.EXAMPLE1_DESCRIPTION,
value = CreateProductResponse.EXAMPLE1_VALUE
)
}))
@ResponseStatus(201)
CreateProductResponse create(CreateProductRequest createProductRequest) throws ValidationException;
Подробнее здесь: https://stackoverflow.com/questions/791 ... -for-gener