Documentation
¶
Overview ¶
normalize-spec converts TypeBox-style OpenAPI 3.1 patterns to forms that ogen can handle:
Enum flattening: TypeBox generates string enums as {anyOf: [{type: string, enum: ["a"]}, {type: string, enum: ["b"]}]} and this tool converts them to {type: string, enum: ["a", "b"]}.
Discriminated unions: anyOf where each variant is an object with a "kind" property whose enum has exactly one value is converted to oneOf with a discriminator on "kind". ogen supports oneOf+discriminator but not complex anyOf (see https://github.com/ogen-go/ogen/issues/491).
Output JSON has object keys sorted lexicographically for deterministic diffs.
Usage: normalize-spec <input.json> <output.json>
Click to show internal directories.
Click to hide internal directories.