OpenAPI 3.1 Spec Template
Start with this minimal template and extend it for your API. Follows the OpenAPI 3.1 specification.
Base Structure
Every spec needs openapi, info, and paths. Add components/schemas for reusable models. Use $ref to keep things DRY.
Authentication
Define security schemes under components/securitySchemes. Apply them globally or per-operation. Bearer tokens are the most common choice for APIs.
Validation
Run your spec through a linter before publishing. Tools like Spectral catch common mistakes like missing descriptions or inconsistent naming.