Keep openapi.yaml valid and in sync with route handlers β lint the spec and fix drift each pass.
Validate openapi.yaml with spectral or swagger-cli. List every error with line numbers.
Update route handlers or the spec so documented paths, schemas, and status codes match reality.
OpenAPI spec lints with zero errors
Start the "OpenAPI Sync Until Valid" loop. Goal: openapi.yaml lints clean and matches implemented routes Max iterations: 8 Between iterations run: npx @redocly/cli lint openapi.yaml Exit when: OpenAPI lint exits 0 Step 1: Lint openapi.yaml. Fix spec errors and handler drift until lint passes. Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.