componentsgen

command
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Command componentsgen writes the OpenAPI components of the v1alpha1 types into api/openapi.yaml, between its BEGIN GENERATED and END GENERATED markers (make generate).

It reflects every kind the API carries with v1alpha1.NewReflector (the reflector behind schemas/*.schema.json), so the components match strict decoding, and converts the JSON Schema 2020-12 output to OpenAPI 3.0.3:

  • $ref #/$defs/X → #/components/schemas/X, one component per named v1alpha1 type;
  • const → a one-value enum; oneOf [T, null] → T with nullable: true;
  • propertyNames (not in 3.0) is dropped; boolean schemas become {}, except additionalProperties, which 3.0 takes as a boolean (true for free-form maps);
  • siblings of $ref (descriptions) are dropped, as 3.0 ignores them.

Every component gets x-go-type and x-go-type-import, so oapi-codegen aliases the v1alpha1 type instead of generating a copy. Go doc comments become descriptions. The output is deterministic: components sorted by name, keys in a fixed order.

Jump to

Keyboard shortcuts

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