feat(api): expose OpenAPI 3.1 document at /openapi.json - #10
Open
lgalabru wants to merge 1 commit into
Open
Conversation
Assembled from the published schemars registry (studio_types::schemas),
so the OpenAPI contract cannot drift from the wire types: components are
the registry schemas with $defs hoisted into #/components/schemas and
refs rewritten. Registry grows rfq-record, quote-record and field-error
(response and 422 contracts, now also served at /api/v1/schemas/{name}).
Drift guards in tests/openapi_api.rs: every documented operation is
routed (no bare-fallback/405), every endpoint advertised by GET /api/v1
is documented, every $ref resolves, registry fully embedded. Document
validates clean under redocly lint (spec-valid, root security declared,
license stamped).
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.
Serves an OpenAPI 3.1 description of the whole surface at
GET /openapi.json— the discovery document a pay gateway can gate against (ludovic's ask, scarce-studio channel).How
studio_types::schemas) — the same derives that generateschemas/*.json— so the OpenAPI contract cannot drift from the wire types. One mechanical transform: each schema's$defshoist into#/components/schemas(deduplicated, refs rewritten) so the document is plain-pointer resolvable.rfq-record,quote-record,field-error(response + 422 contracts), now also served at/api/v1/schemas/{name}and checked in underschemas/.serverscomes from the configuredpublic_url, so the served doc is addressable as deployed. Rootsecurity: [](buyers never authenticate);create_quoteoverrides with the studio bearer scheme.Drift guards (
tests/openapi_api.rs)GET /api/v1advertises is documented$refresolves; the full registry is embeddedVerified
just ci: fmt + clippy clean, 154 tests pass (149 baseline + 5 new)scarced, curled/openapi.json; document validates spec-clean underredocly lint(remaining warnings are deliberate: ops endpoints with no 4xx, standalonegate-policycomponent)