DEV Community

Discussion on: How to auto-generate detailed Swagger/OpenAPI for all your Rails routes

Collapse
 
max_lapshin profile image
Max Lapshin

I see a lot of generators of spec from code and it is a biggest misunderstanding of the idea of openapi.

  • what program do you write?
  • I have no idea, will launch and take a look.

Idea of openapi is design-first approach. You write specs, discuss them with all stakeholders and then generate code from these specs.

Mechanical code generation will give you confidence and tell for sure that code is working according to specs.

When spec is generated from api, than any minor fix in code can break contracts and no test will fail.

Collapse
 
orlando profile image
Orlando Del Aguila

This is the right approach when you are in a greenfield project. Other than that you will want to document the existing infrastructure and this is exactly where rswag and appmap-swagger come into play.