schemaparams

package
v0.2026331.148 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 20 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, compose them as ONE CUE module instance through `schemacompose`, generate the Go structs in-process from the CUE Go API, 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), `schemacompose` (the one module-aware compose, with its offline resolution of the contract module), `schemaretag` (the tag normalization), and the in-process generator (`gotypes.go`).

Composition and generation share ONE resolution path (opencharly/spec#271, Direction 1). A plugin's schema may carry `import "github.com/opencharly/spec/schema"`; the compose resolves it against the contract module the Go binary already links, with no published CUE module, no module cache and no `cue` CLI, and the generator emits the definition through the Go package that actually owns the shapes (`gohome.go`). That is what a projected params file needs to compile: `cue exp gengotypes` could do neither, because the CLI resolves modules only through an OCI registry and its generator lives in cuelang.org/go's INTERNAL tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

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

Generate returns the Go file the schema directory produces.

func GenerateExcluding

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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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