I recently started working on a project where we plan to expose some rest API’s with Spring Boot. Our project will have some modules which could have some common models.
We are going with API first approach and are using Open API specs to define the API’s and then generate required API’s and model classes, Java Pojo classes that can be used as request and response DTO’s and some interfaces with Spring Controller annotations.
We will be updating the specs in the future, there will be changes to the specs with time and we will need to generate the code again. Also, we don’t plan to commit the generated code to SCM but generate it every time as a part of the build process.
My question is, will it be better to keep OpenAPI specs as a separate module and then generate the required APIs and model classes or should each module define its own API spec even though it could lead to some code duplication?
Thank you.
6