Repository navigation
Publish a machine-readable API contract (OpenAPI 3.1) - #10
Merged
Merged
Conversation
The contract existed only as prose and tests, so a consumer had to hand-code
the response shape and could get it wrong without either side noticing. That is
what happened: wiki-polis reads `event` from a /check response, which never
carries it.
- openapi.json describes /check, /policies, /policies/{id}, /health and /,
with schemas for Verdict, Criterion, Requirement, PolicyText, PolicySummary,
PolicyList, PolicyDetail, PolicyRule, Error, Health and Index.
- Served at /openapi.json; version written once (VERSION), echoed on / and as
the Canivote-Version header.
- Errors carry a stable `code`; 429 now returns the same Error shape instead
of the limiter's body.
- Removed the `event` alias for `policy`; no consumer reached it.
- tests/test_openapi_contract.py validates fixture-driven responses against the
document and asserts the three version sources agree. It immediately caught
two under-typed fields: list-valued criteria values and the queries list.
Refs #9
Owner
Author
Live verification of the published contractDeployed at
The consumer that motivated this (wiki-polis #425) was reading Follow-ups filed: #11 (bad requests should show a good one), #12 (verbose / non-verbose). |
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.
The contract existed only as prose and tests, so a consumer had to hand-code the response shape and could get it wrong without either side noticing. That is what happened: wiki-polis reads
eventfrom a /check response, which never carries it.code; 429 now returns the same Error shape instead of the limiter's body.eventalias forpolicy; no consumer reached it.Refs #9