Help us shape the future of Go! Take the 2026 Go Developer Survey

cuetools

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExternalDiffEnvVar = "FUNCTION_CUE_DIFF"
)

Variables

View Source
var TestOutput io.Writer = os.Stderr

Functions

func ExtractSchema

func ExtractSchema(reader io.Reader, pkg string) ([]byte, error)

ExtractSchema extracts an openAPI schema from a CRD/ XRD-like object and returns the equivalent cue types.

func GenerateOpenAPISchema

func GenerateOpenAPISchema(dir, pkg string) ([]byte, error)

GenerateOpenAPISchema generates an openapi schema using the contents of the supplied directory and returns it prefixing it with a package declaration for the supplied package.

func PackageScript

func PackageScript(dir string, opts PackageScriptOpts) (_ []byte, finalErr error)

PackageScript generates self-contained definitions from the supplied directory and returns cue code for an object with a _script property that contains the code as a string. The returned object has a package declaration for the package supplied.

Types

type OutputFormat

type OutputFormat string
const (
	FormatRaw OutputFormat = "raw"
	FormatCue OutputFormat = "cue"
)

type PackageScriptOpts

type PackageScriptOpts struct {
	Format        OutputFormat // output format
	OutputPackage string       // package to declare for cue output
	VarName       string       // variable name to use for cue output, default _script
}

type TestConfig

type TestConfig struct {
	Package                   string
	TestPackage               string
	TestTags                  []string
	RequestVar                string
	ResponseVar               string
	LegacyDesiredOnlyResponse bool
	Debug                     bool
}

type Tester

type Tester struct {
	// contains filtered or unexported fields
}

func NewTester

func NewTester(config TestConfig) (*Tester, error)

NewTester returns a test for the supplied configuration. It auto-discovers tags from test file names if needed.

func (*Tester) Run

func (t *Tester) Run() error

Run runs all tests and returns a consolidated error.

Jump to

Keyboard shortcuts

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