graphqljsonschema

package
v1.44.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TopLevelType

func TopLevelType(schema string) (jsonparser.ValueType, error)

Types

type Any added in v1.38.4

type Any struct{}

func NewAny added in v1.38.4

func NewAny() Any

func (Any) Kind added in v1.38.4

func (a Any) Kind() Kind

type Array

type Array struct {
	Type     string     `json:"type"`
	Items    JsonSchema `json:"item"`
	MinItems *int       `json:"minItems,omitempty"`
}

func NewArray

func NewArray(itemSchema JsonSchema, minItems *int) Array

func (Array) Kind

func (_ Array) Kind() Kind

type Boolean

type Boolean struct {
	Type string `json:"type"`
}

func NewBoolean

func NewBoolean() Boolean

func (Boolean) Kind

func (_ Boolean) Kind() Kind

type ID added in v1.39.5

type ID struct {
	Type []string `json:"type"`
}

func NewID added in v1.39.5

func NewID() ID

func (ID) Kind added in v1.39.5

func (_ ID) Kind() Kind

type Integer

type Integer struct {
	Type string `json:"type"`
}

func NewInteger

func NewInteger() Integer

func (Integer) Kind

func (_ Integer) Kind() Kind

type JsonSchema

type JsonSchema interface {
	Kind() Kind
}

func FromTypeRef

func FromTypeRef(operation, definition *ast.Document, typeRef int) JsonSchema

func FromTypeRefWithOverrides added in v1.43.2

func FromTypeRefWithOverrides(operation, definition *ast.Document, typeRef int, overrides map[string]JsonSchema) JsonSchema

type Kind

type Kind int
const (
	StringKind Kind = iota + 1
	NumberKind
	BooleanKind
	IntegerKind
	ObjectKind
	ArrayKind
	AnyKind
	IDKind
)

type Number

type Number struct {
	Type string `json:"type"`
}

func NewNumber

func NewNumber() Number

func (Number) Kind

func (_ Number) Kind() Kind

type Object

type Object struct {
	Type                 string                `json:"type"`
	Properties           map[string]JsonSchema `json:"properties,omitempty"`
	Required             []string              `json:"required,omitempty"`
	AdditionalProperties bool                  `json:"additionalProperties"`
}

func NewObject

func NewObject() Object

func NewObjectAny added in v1.38.2

func NewObjectAny() Object

func (Object) Kind

func (_ Object) Kind() Kind

type String

type String struct {
	Type string `json:"type"`
}

func NewString

func NewString() String

func (String) Kind

func (_ String) Kind() Kind

type Validator

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

func MustNewValidatorFromSchema

func MustNewValidatorFromSchema(schema JsonSchema) *Validator

func MustNewValidatorFromString

func MustNewValidatorFromString(schema string) *Validator

func NewValidatorFromSchema

func NewValidatorFromSchema(schema JsonSchema) (*Validator, error)

func NewValidatorFromString

func NewValidatorFromString(schema string) (*Validator, error)

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, inputJSON []byte) bool

Jump to

Keyboard shortcuts

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