simplecue

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAST

func GenerateAST(val cue.Value, c Config) (*ast.Schema, error)

Types

type Config

type Config struct {
	// Package name used to generate code into.
	Package string

	// ForceNamedEnvelope decorates the parsed cue Value with an envelope whose
	// name is given. This is useful for dataqueries for example, where the
	// schema doesn't define any suitable top-level object.
	ForceNamedEnvelope string

	SchemaMetadata ast.SchemaMeta

	Libraries []LibraryInclude

	// NameFunc allows users to specify an alternative naming strategy for
	// objects and references. It is called with the value passed to the top
	// level method or function and the path to the entity being parsed.
	NameFunc NameFunc

	// InlineExternalReference instructs the parser to follow external
	// references (ie: references to objects outside the current schema)
	// and inline them.
	// By default, external references are parsed as actual `ast.Ref` to the
	// external objects.
	InlineExternalReference bool
}

type LibraryInclude

type LibraryInclude struct {
	FSPath     string // path of the library on the filesystem
	ImportPath string // path used in CUE files to import that library
}

func ParseImports

func ParseImports(cueImports []string) ([]LibraryInclude, error)

type NameFunc

type NameFunc func(value cue.Value, path cue.Path) string

Jump to

Keyboard shortcuts

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