Opt-in OpenAPI 3.0 root document (#53)#84
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds the preferParams $ref on RPC POST (issue #53 item 3) and the rest of the makeParamDefs parity: preferParams def with suppressed empty enum, preferPost resolution enum values, on_conflict def, args body required:true, PATCH/DELETE parameter lists without select, rowFilter description over format. Each cited to Response/OpenAPI.hs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The most-parameters overload supplies the whole path item, mirroring PostgREST's overload sort + last-insert-wins assembly (issue #53 item 2). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GET / in follow-privileges mode no longer runs two catalog queries per
request: results are cached per {instance, role} in a public ETS table and
stamped with the schema-cache snapshot generation, so a reload invalidates
them with zero coordination (issue #53 item 4).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rescue ArgumentError around the ETS lookup/insert path so a table that died between a GenServer crash and its restart degrades to calling the loader directly instead of raising into the request; trap exits and erase the persistent_term tid in terminate/2 so a clean shutdown never leaves a stale handle published. Mirrors the identical defense in Bier.JwtCache. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- lib/bier.ex: document that follow-privileges caches per-role privilege filtering and refreshes on schema-cache reload; add the same one-liner to README.md's config-options table. - test/bier/privileges_cache_test.exs: add on_exit cleanup for the dead tid the table-gone test re-publishes into :persistent_term. - lib/bier/privileges_cache.ex: add an explicit fetch/4 clause that bypasses the cache for a nil generation (pre-first-snapshot-load caller), instead of leaving it an unreachable implicit invariant. - CLAUDE.md: note the conditional Bier.JwtCache child in the boot-sequence list, matching lib/bier.ex's actual children. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Add moduledoc note on component key charset limitations - Add inline comment in convert/1 about eight top-level keys - Replace weak map-equality assertion with map_size check Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vdh3cbYLtKJfGkZ1ijrYGt
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Resolves conflicts with the SSE events feature (#81): - README.md: keep the openapi_version option row alongside main's table - lib/bier/plugs/action_controller.ex: keep the extended build_openapi_document comment covering openapi_version - .credo.exs: raise Bier.Config StructFieldAmount cap to 50 (the two branches together grew the struct to 46 fields, past the old 45 cap) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@claude review once. |
|
Claude finished @milmazz's task in 3m 9s —— View job Review: Opt-in OpenAPI 3.0 root document (#53 item 1)Todo list
Nice, focused implementation — converting the finished 2.0 map instead of forking the emitter is the right call for keeping one wire-format source of truth. I traced the converter against every top-level/operation-level key the 2.0 emitter ( Findings (both minor, non-blocking):
Everything else looks solid:
No blocking issues. This looks ready to merge once #83 lands and this is re-targeted to |
Review follow-up on #84: the inline-body branch of extract_body/2 duplicated the requestBody shape convert_body/1 already builds; the inline RPC args param never carries a description, so put_nonempty makes the swap behavior-identical. 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>
Closes item 1 of #53. Stacked on #83 — re-target to
mainonce that merges.What's here
openapi_versionconfig option —"2.0"(default, byte-identical to today's PostgREST-parity Swagger document) or"3.0". A Bier extension: PostgREST core has never shipped OpenAPI 3.x (OpenAPI 3.0.0 PostgREST/postgrest#932, open since 2017).db_root_specstill overrides the document entirely.Bier.OpenAPI.V3.convert/1— converts the finished Swagger 2.0 map into OpenAPI 3.0.3:definitions→components.schemas, shared params →components.parameters/components.requestBodieswith schema nesting,$refrewriting, body params →requestBody,collectionFormat: multi→style: form+explode: true, responsecontentwrapping,serversfolding from scheme/host/basePath,securityDefinitions→components.securitySchemes. Converting the finished 2.0 doc (rather than emitting 3.0 in parallel from the internal model) keeps one wire-format source of truth: every future 2.0 parity fix flows into the 3.0 output for free.build_openapi_document/2pipes through the converter only when the instance setsopenapi_version: "3.0"; negotiation, HEAD,openapi-mode, anddb-root-specprecedence are untouched. An HTTP test boots a real instance and asserts the 3.0.3 wire behavior.Notes
mix precommitclean).🤖 Generated with Claude Code
https://claude.ai/code/session_01Vdh3cbYLtKJfGkZ1ijrYGt