gen-schema

command
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Command gen-schema emits a JSON Schema for the Ritefile format by reflecting on the public AST types in taskfile/ast. Run it with:

go run ./cmd/gen-schema > website/src/public/schema.json

or via the `gen:schema` task in Ritefile.yml. Two copies are published on the docs site:

  • clintmod.github.io/rite/schema.json — always latest
  • clintmod.github.io/rite/schema/v3.json — frozen at the v3 contract

The -id flag sets the schema's $id so both copies self-identify as the URL they live at (language servers deref $id and need it to match). See #73 for why versioning is independent of the rite binary version.

The reflector does most of the work by walking tagged struct fields. For types that reflection can't handle — orderedmap wrappers (Vars, Tasks, Includes), types that accept multiple YAML shapes (Cmd, Dep, Task, Var, Prompt), and scalar-parsed types (Platform, Glob, *semver.Version) — we register custom Mapper overrides below.

Design note: we deliberately do NOT add JSONSchema() methods on AST types themselves; that would pull invopop/jsonschema into every downstream user of the library. All schema customization lives here.

Jump to

Keyboard shortcuts

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