Bier.OpenAPI.V3 (bier v0.1.0)

Copy Markdown View Source

Converts the generated Swagger 2.0 root document (Bier.OpenAPI.build/1) into an OpenAPI 3.0.3 document.

Opt-in via the openapi_version: "3.0" config option; the default remains the PostgREST-parity Swagger 2.0 wire format. Converting the finished 2.0 map (rather than emitting 3.0 from the introspection model in parallel) keeps a single wire-format source of truth: parity fixes to the 2.0 emitter propagate here automatically. PostgREST core has no OpenAPI 3.x emitter (PostgREST/postgrest#932), so this output has no conformance surface and is shaped by the OpenAPI 3.0.3 spec alone.

The converter is intentionally NOT general purpose: it handles exactly the shapes the 2.0 emitter produces (body params only as body.* shared definitions or the inline RPC args, application/json as the implied media type, collectionFormat: "multi" only on query params). The 2.0 document- and operation-level produces/consumes lists are dropped rather than expanded into per-media-type content maps: the 3.0 output keeps application/json as its single advertised media type.

Known limitation: component keys inherit relation and column names verbatim; names outside OAS 3.0.3's component-key charset (^[a-zA-Z0-9.-_]+$) produce technically invalid 3.0 component keys, and key sanitization is deliberately out of scope for this parity-driven converter.

Summary

Functions

Converts a Swagger 2.0 document map into an OpenAPI 3.0.3 one.

Functions

convert(doc)

@spec convert(map()) :: map()

Converts a Swagger 2.0 document map into an OpenAPI 3.0.3 one.