Elffuss BraidHub

kikocis/EDC public

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