Is it ok to use annotation for this? I don't understand how to use Yaml.
Example:
@Operation(summary = "Get page of top by rating articles by title")
@ApiResponses(value = {
@ApiResponse(responseCode = "200 successful operation",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(???)))
})
@GetMapping(value = {"/articles/topByRating"})
@JsonView({JsonViews.Short.class})
@ResponseStatus(HttpStatus.OK)
public ItemsDto<Article> getArticlesTopByRating(@RequestParam int numberPage, @RequestParam int sizePage) {
return articleCrud.getTopByRating(numberPage, sizePage);
}
ItemsDto:
public class ItemsDto<E> {
Long total = 0L;
List<E> items;
}
Article:
public class Article{
private Author author;
private String title;
private String body;
}
https://swagger.io/docs/specification/data-models/dictionaries/ Free-Form Objects "If the dictionary values can be of any type (aka free-form object), use additionalProperties: true:"
1. type: object
2. additionalProperties: true
I will try to use 'ref = myfile.yaml' property into @Schema annotation