Index

Swagger or OpenAPI

My company currently use Swagger 2 to document API.

I want to work with OpenAPI 3 but too lazy to convert (for now of course).

So step by step:

Only step 1 is manual, aka I write my API spec completely with my hand (no auto gen from code whatever). The others can be done with tools:

# Convert
go install github.com/mikefarah/yq/v4@latest
yq -o=json '.' ./docs/swagger.yaml > ./docs/swagger.json

# Format
bunx prettier --write ./docs/swagger.yaml ./docs/swagger.json

# Render locally
bunx @redocly/cli preview-docs ./docs/swagger.json

Thanks

Feel free to ask me via email or Mastodon. Source code is available on GitHub