Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
openapi-generator
OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
The only issue I saw on this is that controllers get a lot more cluttered. See an example.
I found SpringDoc, a library that automates the generation of the spec from the source code. It relies on annotations for textual bits (like tags and descriptions), but it also infers stuff from Spring annotations.
FWIW, we go the other way, i.e., using the spec to generate code using openapi-generator. Generated code quality is high. We generate both model classes and service interfaces. In practice, this allows the team to discuss API design decisions at a high level on the fly in the spec editor, and then use the generated code to quickly divide and conquer implementation. We are also more microservice than monolith, though, so we tend to have more, smaller APIs, which probably factors into our experience.
FWIW, we go the other way, i.e., using the spec to generate code using openapi-generator. Generated code quality is high. We generate both model classes and service interfaces. In practice, this allows the team to discuss API design decisions at a high level on the fly in the spec editor, and then use the generated code to quickly divide and conquer implementation. We are also more microservice than monolith, though, so we tend to have more, smaller APIs, which probably factors into our experience.
I'm at a fairly small company (15devs max) and we do code first -> generate openapi spec with springdoc-openapi -> generate typescript httpclient with openapi-typescript for our frontend