Learning on Web Dev Open is free for all.

Backend Engineering > Designing an API someone else has to useDocumentation that stays true
Phase 05Designing an API someone else has to use253 of 434

Documentation that stays true

Generated from the schema you already wrote, or it will be wrong within a fortnight.

Concept11 minAI implements

Documentation written by hand in a separate file describes the API as it was on the day someone cared. Documentation generated from the validation schemas describes the API as it is, because the schemas are load-bearing and cannot silently drift. Both Zod and Pydantic emit OpenAPI with modest effort, and FastAPI does it without being asked.

What generation cannot give you is intent. A field list is not documentation; it is a field list. Add, per endpoint, one sentence on what it is for, one on who is allowed to call it, and one worked example of a failure. That is fifteen minutes per endpoint and it is the part people actually read.

You should now be able to

  • Produce API documentation from a single source of truth
  • Explain why hand-written endpoint docs decay
Ask the community

Loading…