schematype

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyType

type AnyType struct {
}

func (*AnyType) Kind

func (*AnyType) Kind() Kind

func (*AnyType) TypeDefTo

func (*AnyType) TypeDefTo(w io.Writer)

type ArrayType

type ArrayType struct {
	Elem Type
}

func (*ArrayType) Kind

func (*ArrayType) Kind() Kind

func (*ArrayType) TypeDefTo

func (t *ArrayType) TypeDefTo(w io.Writer)

type BoolType

type BoolType struct {
}

func (BoolType) Kind

func (BoolType) Kind() Kind

func (BoolType) TypeDefTo

func (BoolType) TypeDefTo(w io.Writer)

type IntersectionType

type IntersectionType struct {
	AllOf []Type
}

func (*IntersectionType) Kind

func (*IntersectionType) Kind() Kind

func (*IntersectionType) TypeDefTo

func (t *IntersectionType) TypeDefTo(w io.Writer)

type JSONSchemaOptions

type JSONSchemaOptions struct {
	Resolve func(ref string) *jsonschema.Schema
}

type Kind

type Kind int
const (
	Unknown Kind = iota
	Any
	String
	Number
	Bool
	Object
	Array
	Union
	Intersection
	Ref
)

type NamedType

type NamedType struct {
	Name       string
	Underlying Type
}

func (*NamedType) Kind

func (t *NamedType) Kind() Kind

func (*NamedType) TypeDefTo

func (t *NamedType) TypeDefTo(w io.Writer)

type NumberType

type NumberType struct {
	Format string
	Enum   []any
}

func (*NumberType) Kind

func (t *NumberType) Kind() Kind

func (*NumberType) TypeDefTo

func (t *NumberType) TypeDefTo(w io.Writer)

type ObjectType

type ObjectType struct {
	Embeds         []Type
	Props          map[string]Type
	Required       []string
	AdditionalProp Type
}

func (ObjectType) Kind

func (ObjectType) Kind() Kind

func (*ObjectType) PropRequired

func (t *ObjectType) PropRequired(prop string) bool

func (*ObjectType) TypeDefTo

func (t *ObjectType) TypeDefTo(w io.Writer)

type StringType

type StringType struct {
	Format string
	Enum   []any
}

func (*StringType) Kind

func (t *StringType) Kind() Kind

func (*StringType) TypeDefTo

func (t *StringType) TypeDefTo(w io.Writer)

type Type

type Type interface {
	Kind() Kind
	TypeDefTo(w io.Writer)
}

type TypeSystem

type TypeSystem struct {
	Defs map[string]*NamedType
}

func NewTypeSystem

func NewTypeSystem() *TypeSystem

func (*TypeSystem) FromJSONSchema

func (ts *TypeSystem) FromJSONSchema(schema *jsonschema.Schema, opts *JSONSchemaOptions) (tpe Type)

type UnionType

type UnionType struct {
	OneOf []Type
}

func (*UnionType) Kind

func (*UnionType) Kind() Kind

func (*UnionType) TypeDefTo

func (t *UnionType) TypeDefTo(w io.Writer)

Jump to

Keyboard shortcuts

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