| 1 | # Swagger annotations |
| 2 | |
| 3 | ## Decision |
| 4 | To avoid overloading `*Controller` api classes with too many Swagger annotations, |
| 5 | every one of these classes them must implement an interface that reports all the methods exposed (public). |
| 6 | This decision affects all the extensions that expose a REST api. |
| 7 | |
| 8 | The interfaces will be annotated all the swagger annotations needed to improve documentation, e.g. |
| 9 | ``` |
| 10 | @OpenAPIDefinition |
| 11 | public interface AssetApi |
| 12 | ``` |
| 13 | |
| 14 | While the controller implementation will only be annotated with the Jakarta annotations, e.g. |
| 15 | ``` |
| 16 | @Consumes({ MediaType.APPLICATION_JSON }) |
| 17 | @Produces({ MediaType.APPLICATION_JSON }) |
| 18 | @Path("/assets") |
| 19 | public class AssetApiController implements AssetApi |
| 20 | ``` |
| 21 | |
| 22 | In this context naming is also important to keep things tidy. |
| 23 | The interface should be called `<context>Api`, and the controller class that implements it `<context>ApiController`. |