schemaparams

package
v0.2026287.1221 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package schemaparams is THE schema→Go params pipeline (R3).

One function runs the whole thing — concatenate a schema directory's `*.cue` files under a `package <pkg>` + `@go(<pkg>)` header, run the pinned `cue exp gengotypes`, then normalize the struct tags — so that the three places that need it cannot drift:

  • spec's own generator (its `cue-gen` task) produces `spec/cue_types_gen.go`;
  • the `charly`-side verb (`charly candy params`) produces a plugin candy's `params/cue_types_gen.go`, and is a THIN wrapper over this;
  • a plugin repo's CI can run it too, because this module is `go install`-able (its tags are `v0.<YYYYDDD>.<HHMM>`) where the charly module's nested CalVer tags are not — so a CI job gets the canonical pipeline without a charly binary and without keeping its own copy of the recipe.

The steps' contracts stay where they are, and this package only sequences them: `schemaconcat` (the concatenation), `cuetoolchain` (the pin and its fetcher), `schemaretag` (the tag normalization). The `gengotypes` generator itself lives in `cuelang.org/go`'s INTERNAL tree, which is why the pinned CLI is provisioned and run here rather than called in-process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(schemaDir, pkg, cueDir string) ([]byte, error)

Generate provisions the pinned `cue` CLI into cueDir and returns the Go file the schema directory produces. cueDir is the caller's choice (spec's task uses `./bin`, the charly-side verb its own cache): the pin, the checksum, the verification and the arch rules all come from cuetoolchain, so every caller runs the SAME toolchain.

func GenerateExcluding

func GenerateExcluding(schemaDir, pkg, cueDir string, exclude func(name string) bool) ([]byte, error)

GenerateExcluding is Generate with a file filter: a schema whose disjunction wrappers (spec's `node.cue`) gengotypes must not see passes an `exclude` that names them. nil includes every `*.cue` file, which is what a plugin candy wants.

func GenerateWithCue

func GenerateWithCue(schemaDir, pkg, cueBin string) ([]byte, error)

GenerateWithCue runs the pipeline with an explicit `cue` binary — the seam for a caller that has already provisioned one, and for a test that stands in for the toolchain rather than downloading it.

func GenerateWithCueExcluding

func GenerateWithCueExcluding(schemaDir, pkg, cueBin string, exclude func(name string) bool) ([]byte, error)

GenerateWithCueExcluding is GenerateWithCue with a file filter (see GenerateExcluding).

Types

This section is empty.

Jump to

Keyboard shortcuts

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