normalize-spec

command
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

normalize-spec converts TypeBox-style OpenAPI 3.1 patterns to forms that ogen can handle:

  1. 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"]}.

  2. 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>

Jump to

Keyboard shortcuts

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