fix: describe the whole API in openapi.json, not the read half - #281
Merged
Conversation
The document was generated from READ_ROUTES, so it advertised seven GET endpoints out of eighteen. Ingestion, the JUnit path, OTLP traces, artifact presigning, the run summary, the quality gate, CODEOWNERS, notification routing and quarantine were all invisible to anything generating a client, and nothing in the document said a fraction was on offer. It now comes from REST_ENDPOINTS — the same table the human reference is built from — so there is one description of the API and two renderings of it, rather than two descriptions that can disagree. Request bodies come from the zod schemas the endpoints already validate against, inlined rather than named: a name puts the schema under `definitions` and leaves a $ref pointing where OpenAPI does not look, which a generated client cannot resolve. Four guards, because a specification that drifts is worse than none — it is wrong with authority. Every documented endpoint must appear; every endpoint taking a body must describe one; the liveness probe must not demand a token, since a document that does teaches people to ignore its security blocks; and every path parameter a URL names must be declared, or no generated client can build that URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the last observation from the audit.
What was wrong
/openapi.jsonwas generated fromREAD_ROUTES, so it advertised 7 endpoints out of 18:Everything a client would actually write to was missing, and nothing in the document said a fraction was on offer. Meanwhile the human reference was generated from
REST_ENDPOINTSand had all eighteen — two descriptions of one API, free to disagree.Now
One table,
REST_ENDPOINTS, two renderings. Request bodies come from the zod schemas the endpoints already validate against, so the specification cannot describe a body the server would reject.Schemas are inlined, not named. Passing a
nametozodToJsonSchemaputs the schema underdefinitionsand leaves a$refpointing where OpenAPI does not look — I generated it that way first, saw$ref+definitionsin the served document, and changed it, because a generated client cannot resolve that. Verified on the live API: zero#/definitionsreferences remain.Four guards
A specification that drifts is worse than none — it is wrong with authority.
/healthteaches people to ignore its security blocks entirelyThe pre-existing assertion that counted paths against
READ_ROUTESnow checks them against the documented endpoints instead, and a new one keeps every read route inREST_ENDPOINTS.Verified live
62/62 turbo tasks.