oas-nullable

command
v0.71.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 4 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL