What do you think about generating OpenAPI specs from code?

This page summarizes the projects mentioned and recommended in the original post on /r/java

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • springfox

    Automated JSON API documentation for API's built with Spring

  • The only issue I saw on this is that controllers get a lot more cluttered. See an example.

  • springdoc-openapi

    Library for OpenAPI 3 with spring-boot

  • 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.

  • 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.

    WorkOS logo
  • raido

    Raido - Oceania region implementation of the RAiD ISO standard

  • swagger-editor

    Swagger Editor

  • 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.

  • openapi-generator

    OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)

  • 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.

  • openapi-typescript

    Generate TypeScript types from OpenAPI 3 specs

  • 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

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts