Documentation ¶
Index ¶
- type ArrayNode
- func (n *ArrayNode) ASTNode() (jschema.ASTNode, error)
- func (n *ArrayNode) AddConstraint(c constraint.Constraint)
- func (n ArrayNode) BasisLexEventOfSchemaForNode() lexeme.LexEvent
- func (n ArrayNode) Child(i uint) Node
- func (n ArrayNode) Children() []Node
- func (n *ArrayNode) Comment() string
- func (n ArrayNode) Constraint(t constraint.Type) constraint.Constraint
- func (n ArrayNode) ConstraintMap() *Constraints
- func (n *ArrayNode) DeleteConstraint(t constraint.Type)
- func (n *ArrayNode) Grow(lex lexeme.LexEvent) (Node, bool)
- func (n ArrayNode) IndentedNodeString(depth int) string
- func (n ArrayNode) IndentedTreeString(depth int) string
- func (n ArrayNode) Len() int
- func (n ArrayNode) NumberOfConstraints() int
- func (n ArrayNode) Parent() Node
- func (n *ArrayNode) RealType() string
- func (n *ArrayNode) SetComment(s string)
- func (n *ArrayNode) SetParent(parent Node)
- func (n *ArrayNode) SetRealType(s string)
- func (n ArrayNode) Type() json.Type
- func (n ArrayNode) Value() bytes.Bytes
- type BranchNode
- type Constraints
- func (m *Constraints) Delete(k constraint.Type)
- func (m *Constraints) Each(fn eachConstraintsFunc) error
- func (m *Constraints) EachSafe(fn eachSafeConstraintsFunc)
- func (m *Constraints) Filter(fn filterConstraintsFunc)
- func (m *Constraints) Find(fn findConstraintsFunc) (ConstraintsItem, bool)
- func (m *Constraints) Get(k constraint.Type) (constraint.Constraint, bool)
- func (m *Constraints) GetValue(k constraint.Type) constraint.Constraint
- func (m *Constraints) Has(k constraint.Type) bool
- func (m *Constraints) Len() int
- func (m *Constraints) Map(fn mapConstraintsFunc) error
- func (m *Constraints) MarshalJSON() ([]byte, error)
- func (m *Constraints) Set(k constraint.Type, v constraint.Constraint)
- func (m *Constraints) Update(k constraint.Type, fn func(v constraint.Constraint) constraint.Constraint)
- type ConstraintsItem
- type InnerObjectNodeKey
- type LiteralNode
- func (n *LiteralNode) ASTNode() (jschema.ASTNode, error)
- func (n *LiteralNode) AddConstraint(c constraint.Constraint)
- func (n LiteralNode) BasisLexEventOfSchemaForNode() lexeme.LexEvent
- func (n *LiteralNode) Comment() string
- func (n LiteralNode) Constraint(t constraint.Type) constraint.Constraint
- func (n LiteralNode) ConstraintMap() *Constraints
- func (n *LiteralNode) DeleteConstraint(t constraint.Type)
- func (n *LiteralNode) Grow(lex lexeme.LexEvent) (Node, bool)
- func (n LiteralNode) IndentedNodeString(depth int) string
- func (n LiteralNode) IndentedTreeString(depth int) string
- func (n LiteralNode) NumberOfConstraints() int
- func (n LiteralNode) Parent() Node
- func (n *LiteralNode) RealType() string
- func (n *LiteralNode) SetComment(s string)
- func (n *LiteralNode) SetParent(parent Node)
- func (n *LiteralNode) SetRealType(s string)
- func (n LiteralNode) Type() json.Type
- func (n LiteralNode) Value() bytes.Bytes
- type MixedNode
- func (n MixedNode) ASTNode() (jschema.ASTNode, error)
- func (n *MixedNode) AddConstraint(c constraint.Constraint)
- func (n MixedNode) BasisLexEventOfSchemaForNode() lexeme.LexEvent
- func (n *MixedNode) Comment() string
- func (n MixedNode) Constraint(t constraint.Type) constraint.Constraint
- func (n MixedNode) ConstraintMap() *Constraints
- func (n *MixedNode) DeleteConstraint(t constraint.Type)
- func (*MixedNode) Grow(lexeme.LexEvent) (Node, bool)
- func (n MixedNode) IndentedNodeString(depth int) string
- func (n MixedNode) IndentedTreeString(depth int) string
- func (n MixedNode) NumberOfConstraints() int
- func (n MixedNode) Parent() Node
- func (n *MixedNode) RealType() string
- func (n *MixedNode) SetComment(s string)
- func (n *MixedNode) SetJsonType(t json.Type)
- func (n *MixedNode) SetParent(parent Node)
- func (n *MixedNode) SetRealType(s string)
- func (n MixedNode) Type() json.Type
- func (n MixedNode) Value() bytes.Bytes
- type MixedValueNode
- func (n *MixedValueNode) ASTNode() (jschema.ASTNode, error)
- func (n *MixedValueNode) AddConstraint(c constraint.Constraint)
- func (n MixedValueNode) BasisLexEventOfSchemaForNode() lexeme.LexEvent
- func (n *MixedValueNode) Comment() string
- func (n MixedValueNode) Constraint(t constraint.Type) constraint.Constraint
- func (n MixedValueNode) ConstraintMap() *Constraints
- func (n *MixedValueNode) DeleteConstraint(t constraint.Type)
- func (n *MixedValueNode) Grow(lex lexeme.LexEvent) (Node, bool)
- func (n *MixedValueNode) IndentedNodeString(depth int) string
- func (n *MixedValueNode) IndentedTreeString(depth int) string
- func (n MixedValueNode) NumberOfConstraints() int
- func (n MixedValueNode) Parent() Node
- func (n *MixedValueNode) RealType() string
- func (n *MixedValueNode) SetComment(s string)
- func (n *MixedValueNode) SetParent(parent Node)
- func (n *MixedValueNode) SetRealType(s string)
- func (n MixedValueNode) Type() json.Type
- func (n MixedValueNode) Value() bytes.Bytes
- type Node
- type ObjectNode
- func (n *ObjectNode) ASTNode() (jschema.ASTNode, error)
- func (n *ObjectNode) AddChild(key ObjectNodeKey, child Node)
- func (n *ObjectNode) AddConstraint(c constraint.Constraint)
- func (n ObjectNode) BasisLexEventOfSchemaForNode() lexeme.LexEvent
- func (n ObjectNode) Child(key string) (Node, bool)
- func (n ObjectNode) Children() []Node
- func (n *ObjectNode) Comment() string
- func (n ObjectNode) Constraint(t constraint.Type) constraint.Constraint
- func (n ObjectNode) ConstraintMap() *Constraints
- func (n *ObjectNode) DeleteConstraint(t constraint.Type)
- func (n *ObjectNode) Grow(lex lexeme.LexEvent) (Node, bool)
- func (n ObjectNode) IndentedNodeString(depth int) string
- func (n ObjectNode) IndentedTreeString(depth int) string
- func (n ObjectNode) Key(index int) ObjectNodeKey
- func (n ObjectNode) Keys() *ObjectNodeKeys
- func (n ObjectNode) Len() int
- func (n ObjectNode) NumberOfConstraints() int
- func (n ObjectNode) Parent() Node
- func (n *ObjectNode) RealType() string
- func (n *ObjectNode) SetComment(s string)
- func (n *ObjectNode) SetParent(parent Node)
- func (n *ObjectNode) SetRealType(s string)
- func (ObjectNode) Type() json.Type
- func (n ObjectNode) Value() bytes.Bytes
- type ObjectNodeKey
- type ObjectNodeKeys
- func (m *ObjectNodeKeys) Delete(k string)
- func (m *ObjectNodeKeys) Each(fn eachObjectNodeKeysFunc) error
- func (m *ObjectNodeKeys) EachSafe(fn eachSafeObjectNodeKeysFunc)
- func (m *ObjectNodeKeys) Filter(fn filterObjectNodeKeysFunc)
- func (m *ObjectNodeKeys) Find(fn findObjectNodeKeysFunc) (ObjectNodeKeysItem, bool)
- func (m *ObjectNodeKeys) Get(k string) (InnerObjectNodeKey, bool)
- func (m *ObjectNodeKeys) GetValue(k string) InnerObjectNodeKey
- func (m *ObjectNodeKeys) Has(k string) bool
- func (m *ObjectNodeKeys) Len() int
- func (m *ObjectNodeKeys) Map(fn mapObjectNodeKeysFunc) error
- func (m *ObjectNodeKeys) MarshalJSON() ([]byte, error)
- func (m *ObjectNodeKeys) Set(k string, v InnerObjectNodeKey)
- func (m *ObjectNodeKeys) Update(k string, fn func(v InnerObjectNodeKey) InnerObjectNodeKey)
- type ObjectNodeKeysItem
- type Schema
- func (s *Schema) AddNamedType(name string, typ *Schema, rootFile *fs.File, begin bytes.Index)
- func (s *Schema) AddType(n string, t Type)
- func (s *Schema) AddUnnamedType(typ *Schema, rootFile *fs.File, begin bytes.Index) string
- func (s Schema) RootNode() Node
- func (s *Schema) SetRootNode(node Node)
- func (s Schema) String() string
- func (s Schema) Type(name string) *Schema
- func (s Schema) TypesList() map[string]Type
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArrayNode ¶
type ArrayNode struct {
// contains filtered or unexported fields
}
func (*ArrayNode) AddConstraint ¶
func (n *ArrayNode) AddConstraint(c constraint.Constraint)
AddConstraint adds new constraint to this node. Won't add if c is nil.
func (ArrayNode) BasisLexEventOfSchemaForNode ¶
func (ArrayNode) Constraint ¶
func (n ArrayNode) Constraint(t constraint.Type) constraint.Constraint
return *Constraint or nil (if not found)
func (*ArrayNode) DeleteConstraint ¶
func (n *ArrayNode) DeleteConstraint(t constraint.Type)
func (ArrayNode) IndentedNodeString ¶
func (ArrayNode) IndentedTreeString ¶
func (ArrayNode) NumberOfConstraints ¶
func (n ArrayNode) NumberOfConstraints() int
func (*ArrayNode) SetComment ¶
func (n *ArrayNode) SetComment(s string)
func (*ArrayNode) SetRealType ¶
func (n *ArrayNode) SetRealType(s string)
type BranchNode ¶
BranchNode that can contain child elements (an array or an object).
type Constraints ¶
type Constraints struct {
// contains filtered or unexported fields
}
Constraints an ordered map of node constraints. gen:OrderedMap
func (*Constraints) Delete ¶
func (m *Constraints) Delete(k constraint.Type)
func (*Constraints) Each ¶
func (m *Constraints) Each(fn eachConstraintsFunc) error
func (*Constraints) EachSafe ¶
func (m *Constraints) EachSafe(fn eachSafeConstraintsFunc)
func (*Constraints) Filter ¶
func (m *Constraints) Filter(fn filterConstraintsFunc)
Filter iterates and changes values in the map.
func (*Constraints) Find ¶
func (m *Constraints) Find(fn findConstraintsFunc) (ConstraintsItem, bool)
Find finds first matched item from the map.
func (*Constraints) Get ¶
func (m *Constraints) Get(k constraint.Type) (constraint.Constraint, bool)
Get gets a value by key.
func (*Constraints) GetValue ¶
func (m *Constraints) GetValue(k constraint.Type) constraint.Constraint
GetValue gets a value by key.
func (*Constraints) Has ¶
func (m *Constraints) Has(k constraint.Type) bool
Has checks that specified key is set.
func (*Constraints) Map ¶
func (m *Constraints) Map(fn mapConstraintsFunc) error
Map iterates and changes values in the map.
func (*Constraints) MarshalJSON ¶
func (m *Constraints) MarshalJSON() ([]byte, error)
func (*Constraints) Set ¶
func (m *Constraints) Set(k constraint.Type, v constraint.Constraint)
Set sets a value with specified key.
func (*Constraints) Update ¶
func (m *Constraints) Update(k constraint.Type, fn func(v constraint.Constraint) constraint.Constraint)
Update updates a value with specified key.
type ConstraintsItem ¶
type ConstraintsItem struct { Key constraint.Type Value constraint.Constraint }
ConstraintsItem represent single data from the Constraints.
type InnerObjectNodeKey ¶
type LiteralNode ¶
type LiteralNode struct {
// contains filtered or unexported fields
}
func (*LiteralNode) AddConstraint ¶
func (n *LiteralNode) AddConstraint(c constraint.Constraint)
AddConstraint adds new constraint to this node. Won't add if c is nil.
func (LiteralNode) BasisLexEventOfSchemaForNode ¶
func (LiteralNode) Constraint ¶
func (n LiteralNode) Constraint(t constraint.Type) constraint.Constraint
return *Constraint or nil (if not found)
func (LiteralNode) ConstraintMap ¶
func (n LiteralNode) ConstraintMap() *Constraints
return map or nil
func (*LiteralNode) DeleteConstraint ¶
func (n *LiteralNode) DeleteConstraint(t constraint.Type)
func (LiteralNode) IndentedNodeString ¶
func (n LiteralNode) IndentedNodeString(depth int) string
func (LiteralNode) IndentedTreeString ¶
func (n LiteralNode) IndentedTreeString(depth int) string
func (LiteralNode) NumberOfConstraints ¶
func (n LiteralNode) NumberOfConstraints() int
func (*LiteralNode) SetComment ¶
func (n *LiteralNode) SetComment(s string)
func (*LiteralNode) SetRealType ¶
func (n *LiteralNode) SetRealType(s string)
type MixedNode ¶
type MixedNode struct {
// contains filtered or unexported fields
}
func NewMixedNode ¶
func (*MixedNode) AddConstraint ¶
func (n *MixedNode) AddConstraint(c constraint.Constraint)
AddConstraint adds new constraint to this node. Won't add if c is nil.
func (MixedNode) BasisLexEventOfSchemaForNode ¶
func (MixedNode) Constraint ¶
func (n MixedNode) Constraint(t constraint.Type) constraint.Constraint
return *Constraint or nil (if not found)
func (*MixedNode) DeleteConstraint ¶
func (n *MixedNode) DeleteConstraint(t constraint.Type)
func (MixedNode) IndentedNodeString ¶
func (MixedNode) IndentedTreeString ¶
func (MixedNode) NumberOfConstraints ¶
func (n MixedNode) NumberOfConstraints() int
func (*MixedNode) SetComment ¶
func (n *MixedNode) SetComment(s string)
func (*MixedNode) SetJsonType ¶
for mixed node n.baseNode.jsonType is an EXAMPLE type
func (*MixedNode) SetRealType ¶
func (n *MixedNode) SetRealType(s string)
type MixedValueNode ¶
type MixedValueNode struct {
// contains filtered or unexported fields
}
func NewMixedValueNode ¶
func NewMixedValueNode(lex lexeme.LexEvent) *MixedValueNode
func (*MixedValueNode) AddConstraint ¶
func (n *MixedValueNode) AddConstraint(c constraint.Constraint)
func (MixedValueNode) BasisLexEventOfSchemaForNode ¶
func (MixedValueNode) Constraint ¶
func (n MixedValueNode) Constraint(t constraint.Type) constraint.Constraint
return *Constraint or nil (if not found)
func (MixedValueNode) ConstraintMap ¶
func (n MixedValueNode) ConstraintMap() *Constraints
return map or nil
func (*MixedValueNode) DeleteConstraint ¶
func (n *MixedValueNode) DeleteConstraint(t constraint.Type)
func (*MixedValueNode) IndentedNodeString ¶
func (n *MixedValueNode) IndentedNodeString(depth int) string
func (*MixedValueNode) IndentedTreeString ¶
func (n *MixedValueNode) IndentedTreeString(depth int) string
func (MixedValueNode) NumberOfConstraints ¶
func (n MixedValueNode) NumberOfConstraints() int
func (*MixedValueNode) SetComment ¶
func (n *MixedValueNode) SetComment(s string)
func (*MixedValueNode) SetRealType ¶
func (n *MixedValueNode) SetRealType(s string)
type Node ¶
type Node interface { // Type returns type of this node. Type() json.Type SetRealType(string) RealType() string // Parent returns a parent of this node. Parent() Node // SetParent sets a parent for this node. SetParent(Node) // BasisLexEventOfSchemaForNode returns a LexEvent from the scheme on the // basis of which the node is created. It is used to check on the schemes for // compliance with the example and the list of constraints. Also used to display // an error. BasisLexEventOfSchemaForNode() lexeme.LexEvent // Grow this method receives the input lexical event from the scanner, fill // yourself with data from them. If necessary, creates children. Returns the // node to which you want to pass the next lexeme (yourself, child, or parent). Grow(lexeme.LexEvent) (Node, bool) // Constraint returns a constraint by its type. Constraint(constraint.Type) constraint.Constraint // AddConstraint adds a constraint to this node. AddConstraint(constraint.Constraint) // DeleteConstraint removes a constraint from this node. DeleteConstraint(constraint.Type) // ConstraintMap returns a list of constraints or nil (if empty). ConstraintMap() *Constraints // NumberOfConstraints returns the number of constraints. NumberOfConstraints() int // IndentedTreeString returns the text representation of the node and recursively // all children. You can specify the indent (number of tabs) that is placed // before each line in the text view. IndentedTreeString(int) string // IndentedNodeString returns the text representation of the node without children. // You can specify the indent (number of tabs) that is placed before each line // in the text view. IndentedNodeString(int) string // Value returns this node's value. Value() bytes.Bytes // ASTNode returns proper ASTNode for this node. ASTNode() (jschema.ASTNode, error) // SetComment sets a comment for this node. SetComment(string) // Comment returns this node comment. Comment() string }
type ObjectNode ¶
type ObjectNode struct {
// contains filtered or unexported fields
}
func (*ObjectNode) AddChild ¶
func (n *ObjectNode) AddChild(key ObjectNodeKey, child Node)
func (*ObjectNode) AddConstraint ¶
func (n *ObjectNode) AddConstraint(c constraint.Constraint)
AddConstraint adds new constraint to this node. Won't add if c is nil.
func (ObjectNode) BasisLexEventOfSchemaForNode ¶
func (ObjectNode) Children ¶
func (n ObjectNode) Children() []Node
func (ObjectNode) Constraint ¶
func (n ObjectNode) Constraint(t constraint.Type) constraint.Constraint
return *Constraint or nil (if not found)
func (ObjectNode) ConstraintMap ¶
func (n ObjectNode) ConstraintMap() *Constraints
return map or nil
func (*ObjectNode) DeleteConstraint ¶
func (n *ObjectNode) DeleteConstraint(t constraint.Type)
func (ObjectNode) IndentedNodeString ¶
func (n ObjectNode) IndentedNodeString(depth int) string
func (ObjectNode) IndentedTreeString ¶
func (n ObjectNode) IndentedTreeString(depth int) string
func (ObjectNode) Key ¶
func (n ObjectNode) Key(index int) ObjectNodeKey
func (ObjectNode) Keys ¶
func (n ObjectNode) Keys() *ObjectNodeKeys
func (ObjectNode) Len ¶
func (n ObjectNode) Len() int
func (ObjectNode) NumberOfConstraints ¶
func (n ObjectNode) NumberOfConstraints() int
func (*ObjectNode) SetComment ¶
func (n *ObjectNode) SetComment(s string)
func (*ObjectNode) SetRealType ¶
func (n *ObjectNode) SetRealType(s string)
func (ObjectNode) Type ¶
func (ObjectNode) Type() json.Type
type ObjectNodeKeys ¶
type ObjectNodeKeys struct {
// contains filtered or unexported fields
}
gen:OrderedMap
func (*ObjectNodeKeys) Delete ¶
func (m *ObjectNodeKeys) Delete(k string)
func (*ObjectNodeKeys) Each ¶
func (m *ObjectNodeKeys) Each(fn eachObjectNodeKeysFunc) error
func (*ObjectNodeKeys) EachSafe ¶
func (m *ObjectNodeKeys) EachSafe(fn eachSafeObjectNodeKeysFunc)
func (*ObjectNodeKeys) Filter ¶
func (m *ObjectNodeKeys) Filter(fn filterObjectNodeKeysFunc)
Filter iterates and changes values in the map.
func (*ObjectNodeKeys) Find ¶
func (m *ObjectNodeKeys) Find(fn findObjectNodeKeysFunc) (ObjectNodeKeysItem, bool)
Find finds first matched item from the map.
func (*ObjectNodeKeys) Get ¶
func (m *ObjectNodeKeys) Get(k string) (InnerObjectNodeKey, bool)
Get gets a value by key.
func (*ObjectNodeKeys) GetValue ¶
func (m *ObjectNodeKeys) GetValue(k string) InnerObjectNodeKey
GetValue gets a value by key.
func (*ObjectNodeKeys) Has ¶
func (m *ObjectNodeKeys) Has(k string) bool
Has checks that specified key is set.
func (*ObjectNodeKeys) Map ¶
func (m *ObjectNodeKeys) Map(fn mapObjectNodeKeysFunc) error
Map iterates and changes values in the map.
func (*ObjectNodeKeys) MarshalJSON ¶
func (m *ObjectNodeKeys) MarshalJSON() ([]byte, error)
func (*ObjectNodeKeys) Set ¶
func (m *ObjectNodeKeys) Set(k string, v InnerObjectNodeKey)
Set sets a value with specified key.
func (*ObjectNodeKeys) Update ¶
func (m *ObjectNodeKeys) Update(k string, fn func(v InnerObjectNodeKey) InnerObjectNodeKey)
Update updates a value with specified key.
type ObjectNodeKeysItem ¶
type ObjectNodeKeysItem struct { Key string Value InnerObjectNodeKey }
ObjectNodeKeysItem represent single data from the ObjectNodeKeys.
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
func (*Schema) AddNamedType ¶
func (*Schema) AddUnnamedType ¶
AddUnnamedType Adds an unnamed TYPE to the SCHEMA. Returns a unique name for the added TYPE.