API / Swagger Interview questions
Explain the lifecycle of validating an OpenAPI document with a linter like Spectral?
A linter like Spectral checks an OpenAPI document against a configurable rule set — both structural correctness against the specification itself and style/best-practice rules a team defines — and reports violations before the document is ever published or consumed downstream.
Built-in rules catch structural problems — a missing required field, an invalid $ref, a response with no description — while custom rules enforce team-specific conventions, such as requiring every operation to have an operationId, or every error response to follow a standardized problem-details schema.
Wiring this into CI/CD means a spec change that breaks these rules fails the pipeline the same way a failing unit test would, catching documentation quality problems (and, for structural rules, genuinely broken specs) before they reach a published Swagger UI page or get consumed by a code generator further downstream.
More Related questions...