API Documentation
OpenAPI / Swagger concept
- OpenAPI (formerly Swagger) is a machine-readable spec for HTTP APIs: paths, methods, schemas, security, examples.
- Specs can drive code generation, mock servers, contract tests, and developer portals.
- Keep the spec close to the truth (generated from code or validated in CI) to avoid drift.
Why documentation matters
- Reduces time-to-first-successful-call for integrators and internal teams.
- Surfaces breaking changes during review when diffs are visible.
- Becomes the contract for SLAs, deprecation, and support expectations.
Examples and schemas
- Provide request/response examples for happy path and common errors.
- Mark required fields, defaults, and nullable types explicitly.
- Document enums, id formats, pagination, and rate limits next to operations.
Auto-generated docs
- Generate from annotations (Springdoc, FastAPI) or from hand-maintained YAML with CI checks.
- Host alongside changelog and migration guides for each version.
- Add Try it consoles cautiously in prod (auth, abuse, CORS implications).