DEV Community

Jitendra Balla
Jitendra Balla

Posted on

Your OpenAPI spec is already your documentation

If your team defines APIs with an OpenAPI spec, you're closer to good docs than you think.

That spec already describes every endpoint, parameter, and response. Machines love it. Humans reading raw YAML? Not so much. And that gap is where docs die. Someone hand-writes a "readable" version that immediately drifts out of sync with the spec.

Close the gap. Feed your spec into OpenAPI to Markdown and get formatted docs out: https://markdown.co.in/tools/openapi-to-markdown.html

The best part is it kills the "two sources of truth" problem. Update the spec, regenerate the docs. They can't drift apart because one comes from the other.

Pro move: keep the generated docs in your repo next to the spec. When the spec changes in a PR, regenerate in the same PR. Reviewers see both change together, and nothing slips through.

Stop maintaining docs by hand next to a perfectly good spec. Let the spec do the work.

Top comments (0)