openapi

package
v0.9.3-beta.16 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: AGPL-3.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SchemaFieldName    = "schemas"
	ComponentFieldName = "components"
	DefaultSchemaName  = "spec"
	SchemaStructType   = "object"
)

Variables

This section is empty.

Functions

func DeReference

func DeReference(f *ast.File, rt *Runtime) func(path string) (*apiextv1.JSONSchemaProps, error)

func FlattenSchema

FlattenSchema flattens the given schema to a single level.

func FromCueAST

func FromCueAST(rt *Runtime, cueSchema []ast.Decl) (*apiextv1.JSONSchemaProps, error)

func GenerateOpenAPISchema

func GenerateOpenAPISchema(cueTpl string, schemaType string) (*apiextv1.JSONSchemaProps, error)

GenerateOpenAPISchema generates openapi schema from cue type Definitions.

func GetFieldByLabel

func GetFieldByLabel(n ast.Node, label string) (*ast.Field, error)

func IsFieldWithLabel

func IsFieldWithLabel(n ast.Node, label string) bool

Types

type Runtime

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

func NewRuntime

func NewRuntime(cueString string) (*Runtime, error)

func (*Runtime) BuildFile

func (r *Runtime) BuildFile(file *ast.File, options ...cue.BuildOption) cue.Value

func (*Runtime) Context

func (r *Runtime) Context() *cue.Context

func (*Runtime) Underlying

func (r *Runtime) Underlying() cue.Value

Jump to

Keyboard shortcuts

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