schemacompose

package
v0.2026331.1629 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 19 Imported by: ? modules, 0 packages

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServedSchema

func ServedSchema(ctx *cue.Context, schemaFS fs.FS, dir string) (cue.Value, error)

ServedSchema composes a plugin's embedded schema as one CUE module instance: the concatenated `schema/*.cue` body of schemaFS under dir, evaluated inside the plugin's own module declaration when its FS ships `cue.mod/module.cue`, and under the derived declaration when it does not. ctx is the context the value is built in (a cue.Value is only valid inside the context that built it); nil gets a fresh one.

func ServedText

func ServedText(ctx *cue.Context, body string) (cue.Value, error)

ServedText composes the package-less body a plugin serves on `Capabilities.schema_cue` — the host's half of the contract, and the same source the serve side concatenates. It is the SAME compose ServedSchema runs, under the DERIVED module declaration, because the wire carries no `cue.mod/module.cue`: the host cannot be told the plugin's declaration, so the declaration must be one both sides can derive. For a plugin that ships no declaration — every plugin today — the two entry points are byte-for-byte the same compose.

Types

type Instance added in v0.2026313.1428

type Instance struct {
	Ctx   *cue.Context
	Build *build.Instance
	Value cue.Value
}

Instance is ONE composed CUE module instance: the context its value belongs to, the loader's build instance and the built value. The two halves of the contract read the VALUE; the Go projection reads the build instance as well, because the import graph and the package attributes live there and not in the value.

func ComposeText added in v0.2026313.1428

func ComposeText(ctx *cue.Context, body, pkg string) (*Instance, error)

ComposeText composes a package-less schema body under `package pkg`, in the virtual plugin module, under the DERIVED declaration, with spec served by the offline registry. It is the same compose as ServedText and is exported for the Go projection (schemaparams): a plugin's params are generated from the SAME source text the two halves of the contract judge, which is what lets that source carry `import "github.com/opencharly/spec/schema"` — the import resolves against the same offline registry, with no published CUE module and no `cue` CLI in the loop.

Jump to

Keyboard shortcuts

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