OpenAPI Spec Design
The spec is a contract. Optimize for accurate types, examples, error shapes, and non-breaking evolution.
Checklist
- openapi version, info, servers
- paths: methods, operationId, tags, summary
- parameters vs requestBody clarity
- schemas: required fields, enums, formats, nullable
- responses: success + error components
- securitySchemes and per-operation security
- examples that match schemas
- deprecation flags and changelog alignment
Output format
## OpenAPI review / design
### Issues
1. …
### Recommended components
…
### Example path sketch
snippet
Rules
- operationId stable and unique for codegen.
- Do not mark fields required if servers omit them.
- Reuse components.schemas; avoid copy-paste drift.
- Document auth failures (401/403) consistently.
- Breaking schema changes need versioning strategy.
- Examples must validate against the schema mentally.
Edge cases
- File uploads: multipart content types.
- Webhooks: callbacks section.
- Polymorphism: oneOf/anyOf discriminators carefully.