Documentation
¶
Overview ¶
Command oas-nullable post-processes the swag-generated OpenAPI 3.1 artifacts (oas/swagger.yaml and oas/docs.go). swag v2 cannot emit a JSON Schema type union, so a struct field that accepts an explicit JSON null is tagged `extensions:"x-nullable"`; this tool rewrites every such schema's `type: X` into the OAS 3.1 union `type: [X, "null"]` and drops the marker. It fails if a marker cannot be converted, so a generator change surfaces at `make swagger` instead of silently publishing a contract that rejects null (Spec 117 PR-2, #1566: expected_hashes).
Usage: go run ./cmd/oas-nullable oas/swagger.yaml oas/docs.go
Click to show internal directories.
Click to hide internal directories.