Skip to content

OpenAPI root document: root path item, rpc produces, default host/schemes (#85) - #87

Merged
milmazz merged 5 commits into
mainfrom
openapi-85-wire-gaps
Jul 21, 2026
Merged

OpenAPI root document: root path item, rpc produces, default host/schemes (#85)#87
milmazz merged 5 commits into
mainfrom
openapi-85-wire-gaps

Conversation

@milmazz

@milmazz milmazz commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Closes #85. All three wire gaps verified against PostgREST v14.12 sources (Response/OpenAPI.hs, Network.hs, MediaType.hs, swagger2's ToJSON Host), plus one bundled gap discovered during verification.

  • Root "/" path itempaths now carries the GET-only Introspection entry (tags ["Introspection"], summary "OpenAPI description (this document)", produces: [application/openapi+json, application/json]) per makeRootPathItem (OpenAPI.hs#L370-379).
  • RPC produces list — every /rpc/* GET and POST operation advertises [application/json, application/vnd.pgrst.object+json;nulls=stripped, application/vnd.pgrst.object+json] per procOp (OpenAPI.hs#L360, MediaType.hs#L72-74).
  • Unconditional schemes/host/basePathpostgrestSpec always renders the block; without a proxy it falls back to the server config (proxyUri, OpenAPI.hs#L448-454), with listen-anywhere hosts escaped to 0.0.0.0 (Network.hs#L46-52) and the port always appended to host (swagger2 Host h (Just p)"h:p"). This also removes a pre-existing deviation: Bier used to omit scheme-default ports from proxy hosts, but pickProxy fills 80/443 and the port is always rendered (OpenAPI.hs#L414, L441-446). One PostgREST-intentional divergence, noted in a code comment: PostgREST hardcodes scheme http in the fallback (no native TLS); Bier follows router[:scheme], which matches PostgREST's wire output for the default :http.
  • Bundled (operator-approved): document-level produces/consumes of [application/json, application/vnd.pgrst.object+json;nulls=stripped, application/vnd.pgrst.object+json, text/csv] (OpenAPI.hs#L408-409) — uncased gap found while verifying the above; plan amendment Task 2b.

Safety vs the frozen suite: every OpenAPI conformance case asserts via body_jsonpath, and no absent: predicate targets $.paths['/'], produces, consumes, host, or schemes — additive keys can't break them. Full suite + mix precommit green (902 tests).

Plan: docs/superpowers/plans/2026-07-16-issue-85-openapi-wire-gaps.md

🤖 Generated with Claude Code

milmazz and others added 5 commits July 16, 2026 20:50
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PostgREST v14.12 inserts a GET-only Introspection path item for / (
makeRootPathItem, OpenAPI.hs#L370-379) and stamps every RPC operation
with produces [json, vnd.pgrst.object+json;nulls=stripped,
vnd.pgrst.object+json] (OpenAPI.hs#L360). Issue #85 items 1-2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…roxy

postgrestSpec unconditionally renders the scheme/host/port/basePath block,
falling back to (http, server-host, port, /) when no
openapi-server-proxy-uri is set, with listen-anywhere hosts escaped to
0.0.0.0 and the port always appended - including scheme-default proxy
ports, removing our omit-default-port deviation (OpenAPI.hs#L393-454,
Network.hs#L46-52). Issue #85 item 3.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
postgrestSpec stamps the Swagger root with equal produces and consumes
lists - the rpc trio plus text/csv (OpenAPI.hs#L408-409). Uncased gap
discovered while verifying #85; bundled here on operator approval
(plan amendment Task 2b).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolves the build_openapi_document conflict by combining both sides:
the server_scheme/server_host/server_port build inputs from this branch
plus the openapi_version 3.0 conversion gate from #84.

Semantic follow-through for the merge: the V3 converter now drops the
2.0-only operation-level produces lists this branch added (its 3.0
output stays application/json-only per its moduledoc), and the #84 unit
tests are updated to the emitter's new required server inputs and the
always-present schemes/host/basePath server URL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@milmazz
milmazz merged commit a46b8d6 into main Jul 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAPI root document: remaining wire gaps vs PostgREST v14.12

1 participant