An OpenAPI specification is most useful when it remains part of the development workflow rather than becoming a document that is updated after the code ships. This checklist explains how to design or generate an API specification, describe schemas and authentication accurately, validate changes, publish usable documentation, test the contract, and decide when a version requires a deliberate review.
Overview
OpenAPI provides a structured description of an HTTP API: its paths, operations, parameters, request bodies, responses, security requirements, and reusable components. Tools can use that description to render reference documentation, generate client libraries, validate requests, create test cases, and support contract testing. The specification is commonly written in YAML or JSON.
“Swagger” and “OpenAPI” are related terms, but they are not interchangeable in every context. Swagger began as an API description project and remains the name of a tool ecosystem. OpenAPI is the specification format maintained through an open governance process. When choosing tools, check which OpenAPI versions and features they support instead of relying on the product name alone.
The central maintenance question is simple: which artifact is authoritative? In a design-first workflow, the OpenAPI document is reviewed before implementation and guides the server contract. In a code-first workflow, annotations or framework metadata are used to generate the document from application code. Either approach can work. The risk appears when teams edit code, documentation, and generated clients independently without a validation step.
A dependable workflow therefore has four properties:
- One clearly identified source of truth for the public contract.
- Automated validation in local development and continuous integration.
- Documentation and examples generated or checked from the same specification.
- A review process for compatibility, security, and versioning before release.
Keep the specification in version control beside the service or in a deliberately managed API repository. This makes changes reviewable and lets documentation updates travel with the code. Repository governance practices can be paired with the Open-Source Repository Maintenance Checklist.
Checklist by scenario
Scenario 1: Starting a new API with design-first development
- Define the API boundary. Record the server URL pattern, supported environments, media types, and whether the API is public, internal, or used by a controlled set of clients.
- Choose a supported specification version. Use the version required by your documentation, validation, gateway, and code-generation tools. Confirm support before adopting newer features.
- Describe resources and operations. Give each path operation a clear summary, operation identifier, parameter definition, request body, response status, and response schema. Avoid documenting only the successful response.
- Model data deliberately. Use reusable components for shared objects, pagination, error responses, and common parameters. Mark required properties explicitly and distinguish nullable values, omitted properties, empty strings, and empty collections where the API does so.
- Specify behavior, not just shape. Explain validation rules, permitted enum values, default behavior, idempotency expectations, pagination conventions, and whether an operation is asynchronous.
- Define authentication and authorization. Document the security scheme, required scopes or permissions, and operation-level exceptions. Do not place real credentials, tokens, or sensitive production examples in the document.
- Add realistic examples. Include representative requests and responses for ordinary success, validation failure, authentication failure, authorization failure, not-found results, and service errors where relevant.
- Review before implementation. Ask API consumers to review naming, resource relationships, error handling, and likely client ergonomics. Resolving ambiguity at this stage is cheaper than changing deployed behavior.
Scenario 2: Documenting an existing service with a code-first workflow
- Generate the specification from the framework integration or annotations used by the service.
- Compare the generated output with actual routes, middleware, serializers, and error handlers. Generated documentation may omit behavior implemented outside the annotated controller.
- Check that query parameters, headers, cookies, request bodies, and response content types are represented accurately.
- Move stable explanations and examples into a maintained description layer rather than relying on generated names alone.
- Run an integration test that exercises important operations and compares observed responses with the declared contract.
- Commit the generated document or generate it reproducibly in CI, but make the choice explicit. A committed artifact is easy to inspect; a generated artifact avoids stale output when the build is reliable.
Code-first does not remove the need for API design review. It changes where the contract begins. Treat annotations and serializers as contract inputs, not as proof that the published description is complete.
Scenario 3: Adding an endpoint to a maintained API
- Identify whether the endpoint is additive, behavior-changing, or potentially breaking.
- Reuse existing naming, authentication, pagination, error, and envelope conventions unless there is a documented reason to depart from them.
- Add the path, operation, schemas, examples, security requirements, and error responses together in one change.
- Validate the specification and run contract or integration tests against the implementation.
- Check generated documentation at the same time a reviewer checks the code. The rendered page is often where confusing descriptions, missing examples, or incorrect required fields become obvious.
- Record the release or version impact in the change notes used by API consumers.
Scenario 4: Making a potentially breaking change
Review changes to required request fields, property types, enum values, authentication requirements, status codes, response shapes, and error semantics with extra care. Removing a response property may break strict clients even if the server still accepts the same request. Adding a required request field can break older clients immediately.
Use a compatibility checker where appropriate, but treat its result as an input to review rather than a complete compatibility decision. A tool may not understand undocumented client assumptions, business behavior, or changes inside free-form fields. Decide whether the change needs a new API version, a new operation, a deprecation period, or a coordinated client release.
What to double-check
Reusable specification outline
openapi: <supported-version>
info:
title: Example API
version: <contract-version>
description: Purpose, audience, and important behavior
servers:
- url: https://api.example.test
paths:
/resources:
get:
summary: List resources
operationId: listResources
parameters: []
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceList'
components:
schemas:
Resource:
type: object
required: [id]
properties:
id:
type: string
securitySchemes:
bearerAuth:
type: http
scheme: bearer
This outline is intentionally small. Expand it with the fields your service needs and verify syntax against the specification version and tools selected for the project. The document should explain the actual contract, not serve as a collection of guessed defaults.
OpenAPI review checklist
- Metadata: Is the title, description, contact information, and contract version useful to a consumer?
- Paths: Does every public operation appear exactly once with the correct HTTP method and route parameters?
- Parameters: Are location, type, format, required status, defaults, and constraints accurate?
- Request bodies: Are supported media types and required properties documented?
- Responses: Are success, validation, authentication, authorization, not-found, conflict, and server-error cases represented where applicable?
- Schemas: Do required fields, formats, nullability, read-only fields, write-only fields, and examples match serialization behavior?
- Security: Are schemes and scopes attached to the right operations, with public exceptions made explicit?
- Examples: Can a developer construct a valid request and understand the returned data without reading server code?
- References: Do component references resolve, and are circular relationships handled by the selected tools?
- Automation: Does CI validate the document and run a meaningful contract or integration check?
Keep the published documentation close to the delivery workflow. A repository-based CI/CD process can validate the specification on pull requests and publish a reviewed version with the service. For broader deployment workflow ideas, see How to Deploy a Web App from a Git Repository and the guide to building a self-hosted CI/CD pipeline.
Common mistakes
- Documenting only the happy path. Clients need predictable error shapes and status codes to handle failures correctly.
- Letting generated output become the only explanation. Type names rarely communicate workflow, permissions, side effects, or business rules.
- Using examples that cannot work. Examples should match required fields, formats, authentication expectations, and current route behavior.
- Overusing copy-and-paste schemas. Duplicated models drift. Reusable components reduce inconsistency, but do not force unrelated resources into one vague schema.
- Treating validation as testing. A valid YAML document can still describe the wrong endpoint. Combine structural validation with requests against a running service or consumer-driven contract tests.
- Publishing secrets in examples. Use placeholders and review generated output before it leaves a private development environment.
- Changing the contract without a compatibility decision. Ask who consumes the operation and how clients handle the changed field, response, or status code.
- Ignoring tool boundaries. Documentation renderers, generators, gateways, and validators may support different subsets of a specification version. Test the complete toolchain.
When to revisit
Review the workflow before a planned release cycle, whenever the API gains a new consumer, and whenever the documentation, framework integration, or CI tooling changes. Revisit it immediately before a breaking change, authentication redesign, schema migration, or client-generation update.
A practical maintenance routine is to run specification validation on every change, review generated documentation during pull requests, and perform a deeper compatibility review at release boundaries. During seasonal planning or other scheduled maintenance periods, inspect stale examples, unused schemas, deprecated operations, server URLs, security definitions, and links to external documentation.
When tools or specification versions change, test a representative operation from the full path: author the document, validate it, render it, generate or exercise a client, and run it against the service. Update the workflow only after confirming that the resulting contract remains understandable to both humans and machines.
Before merging the next API change, use this short sequence: identify the source of truth, update the operation and its schemas, add working examples and failure responses, validate references and syntax, run contract or integration tests, inspect the rendered documentation, and record the compatibility decision. That habit keeps API documentation synchronized with code without making documentation a separate afterthought.