schema

package
v0.0.0-...-cbea63e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatTabs  = Format("tabs")
	FormatTable = Format("table")
)

Variables

View Source
var (
	ReqiredByDefault = true
)

Functions

This section is empty.

Types

type FieldType

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

func NewFieldType

func NewFieldType(name string, kinds ...reflect.Kind) *FieldType

func (*FieldType) MarshalJSON

func (fieldType *FieldType) MarshalJSON() ([]byte, error)

func (*FieldType) String

func (field *FieldType) String() string

func (*FieldType) UnmarshalJSON

func (fieldType *FieldType) UnmarshalJSON(data []byte) error

type Format

type Format string

type JsonSchema

type JsonSchema struct {
	Type                 *FieldType             `json:"type"`
	Properties           map[string]*JsonSchema `json:"properties,omitempty"`
	Items                *JsonSchema            `json:"items,omitempty"`
	AdditionalProperties bool                   `json:"additionalProperties"`
}

type Schema

type Schema struct {
	Schema *Value `json:"schema"`
}

func Of

func Of(s interface{}) *Schema

Generates json-schema for struct or proto

func (*Schema) String

func (schema *Schema) String() string

func (*Schema) Validate

func (schema *Schema) Validate(config string) error

type Value

type Value struct {
	Type                 *FieldType        `json:"type"`
	Properties           map[string]*Value `json:"properties,omitempty"`
	Required             bool              `json:"required"`
	Items                *Value            `json:"items,omitempty"`
	Enum                 []string          `json:"enum,omitempty"`
	Title                string            `json:"title"`
	PropertyOrder        int               `json:"propertyOrder,omitempty"`
	Format               Format            `json:"format,omitempty"`
	Description          string            `json:"description,omitempty"`
	HeaderTemplate       string            `json:"headerTemplate,omitempty"`
	ReadOnly             bool              `json:"readOnly,omitempty"`
	AdditionalProperties bool              `json:"additionalProperties,omitempty"`
}

Jump to

Keyboard shortcuts

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