Help us shape the future of Go! Take the 2026 Go Developer Survey

gen-api-types

command
v0.12.0 Latest Latest
Warning

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

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

Documentation

Overview

Command gen-api-types emits TypeScript types for the console from the Go types the API actually returns.

R-261: the API is the product, and the console, CLI and MCP are clients of it. Design 08 §1.2 says API types are generated and never hand-written, because a hand-written type is a second opinion about what the server returns and the two drift the first time a field is added.

It reflects over Go types rather than reading an OpenAPI document. Writing one by hand to generate from would reintroduce exactly the drift the requirement forbids, one level removed: the spec would be the thing that fell out of step instead of the types. The Go structs are what the handlers serialize, so they are the only honest source. docs/openapi.json does exist, and it is generated from those same handlers by internal/openapi (`make reference`), with the same rules for how a struct becomes JSON; both are readings of the code, so neither generates from the other.

Run through `npm run types` in console/, which the build depends on.

Jump to

Keyboard shortcuts

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