jsonschema

package
v0.0.0-...-33be302 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalCueValue

func MarshalCueValue(v cue.Value) (map[string]interface{}, error)

MarshalCueValue generates an openAPI schema for the given cue value, utilizing Cue's OpenAPI integration package. This returns a single schema for the given Cue value - the value must be a Cue struct containing type definitions.

func UnmarshalString

func UnmarshalString(schema string) (string, error)

UnmarshalString returns a cue type for an event from a JSON schema definition.

Types

type Schemas

type Schemas struct {
	// All stores all generated schemas, in a map.
	All map[string]map[string]interface{}
}

Schemas stores all schemas generated for a cue file.

func MarshalString

func MarshalString(cuestr string) (Schemas, error)

MarshalString generates OpenAPI schemas given cue configuration. Schemas are generated for each top-level identifier; many schemas are generated:

#Event: {
	name: string
}

Cue types without identifiers will have no schemas generated.

func (Schemas) Find

func (s Schemas) Find(identifier string) map[string]interface{}

Find returns a schema for the given identifier

Jump to

Keyboard shortcuts

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