jsonschema

package module
v0.0.0-...-e626c56 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: MIT Imports: 2 Imported by: 2

README

go-jsonschema

json schema skeleton

Documentation

Index

Constants

View Source
const (
	TYPE_ARRAY   = `array`
	TYPE_BOOLEAN = `boolean`
	TYPE_INTEGER = `integer`
	TYPE_NUMBER  = `number`
	TYPE_NULL    = `null`
	TYPE_OBJECT  = `object`
	TYPE_STRING  = `string`
)

Variables

View Source
var JSON_TYPES []string

Functions

This section is empty.

Types

type JsonSchema

type JsonSchema struct {
	// Meta params
	Id          string `json:"id,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	// Used as "Name" tag
	Property string   `json:"-"`
	Type     string   `json:"type,omitempty"`
	Required []string `json:"required,omitempty"`
	// Reference url
	Ref string `json:"$ref,omitempty"`
	// Json reference
	Schema string `json:"$schema,omitempty"`
	// Hierarchy
	Enum                []string               `json:"enum,omitempty"`
	Parent              *JsonSchema            `json:"-"`
	Definitions         map[string]*JsonSchema `json:"definitions,omitempty"`
	DefinitionsChildren []*JsonSchema          `json:"-"`
	Items               *JsonSchema            `json:"items,omitempty"`
	ItemsChildren       []*JsonSchema          `json:"-"`
	PropertiesChildren  []*JsonSchema          `json:"-"`
	Properties          map[string]*JsonSchema `json:"properties,omitempty"`
}

JsonSchema represents a very generic json schema implementation to match the Hailo RPC Api. Currently it does not support all draft 4 features and more will be added as required

func New

func New() *JsonSchema

func (*JsonSchema) AddDefinitionChild

func (s *JsonSchema) AddDefinitionChild(child *JsonSchema)

func (*JsonSchema) AddEnum

func (s *JsonSchema) AddEnum(i interface{}) error

func (*JsonSchema) AddItemsChild

func (s *JsonSchema) AddItemsChild(child *JsonSchema)

func (*JsonSchema) AddPropertiesChild

func (s *JsonSchema) AddPropertiesChild(child *JsonSchema)

func (*JsonSchema) AddProperty

func (s *JsonSchema) AddProperty(pr *JsonSchema) error

func (*JsonSchema) AddRequired

func (s *JsonSchema) AddRequired(value string) error

Jump to

Keyboard shortcuts

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