How to reduce or organize swagger declarations with Kotlin

315 Views Asked by At

how can I organize the swagger annotations, for example I have an endpoint that catches all the users, so the swagger statements were huge. Is there any way I can organize this in another file to be more organized?

enter image description here

1

There are 1 best solutions below

0
Mafor On

One of strategies often used is creating an interface (e.g. PersonApi in your case) and moving all swagger annotations there. The actual controller should implement this interface.

In regard to the error responses: you may consider adding them programatically to all operations/endpoints using OpenApiCustomiser.