definition

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefPrefix is the JSON Schema prefix required in the definition map
	DefPrefix = "#/definitions/"
)

Variables

This section is empty.

Functions

func GetFieldTag

func GetFieldTag(field *ast.Field) reflect.StructTag

GetFieldTag gets the StructTag for a field

func JSONPropName

func JSONPropName(tag reflect.StructTag) string

JSONPropName returns the name for marshaling to/from json

Types

type CommentInformation

type CommentInformation struct {
	SynthesizedComment string
	RemainingComment   string
}

CommentInformation holds information interpreted from a comment string

type Definition

type Definition struct {
	Ref                  string                 `json:"$ref,omitempty"`
	Items                *Definition            `json:"items,omitempty"`
	Required             []string               `json:"required,omitempty"`
	Properties           map[string]*Definition `json:"properties,omitempty"`
	PreferredOrder       []string               `json:"preferredOrder,omitempty"`
	AdditionalProperties interface{}            `json:"additionalProperties,omitempty"`
	Type                 string                 `json:"type,omitempty"`
	ContentEncoding      string                 `json:"contentEncoding,omitempty"`
	OneOf                []*Definition          `json:"oneOf,omitempty"`
	Description          string                 `json:"description,omitempty"`
	HTMLDescription      string                 `json:"x-intellij-html-description,omitempty"`
	KubernetesGvk        []*GroupVersionKind    `json:"x-kubernetes-group-version-kind,omitempty"`
	Default              interface{}            `json:"default,omitempty"`
	Examples             []string               `json:"examples,omitempty"`
	Enum                 []string               `json:"enum,omitempty"`
}

Definition represents a JSON Schema definition

type Generator

type Generator struct {
	Strict      bool
	Definitions map[string]*Definition
	Importer    importer.Importer
}

Generator can create definitions from Exprs

func (*Generator) CollectDefinitionsFromStruct

func (dg *Generator) CollectDefinitionsFromStruct(root string)

CollectDefinitionsFromStruct gets a complete definition for the root object

type GroupVersionKind added in v0.39.0

type GroupVersionKind struct {
	Group   string `json:"group"`
	Version string `json:"version"`
	Kind    string `json:"kind"`
}

type Meta

type Meta struct {
	Required bool
	NoDerive bool
}

Jump to

Keyboard shortcuts

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