-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.go
More file actions
31 lines (24 loc) · 951 Bytes
/
Copy pathschema.go
File metadata and controls
31 lines (24 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package schema
// Schema represents a schema.
// Schema is a some description of expected structure of payload.
type Schema interface {
// Len returns length of this schema in bytes.
// Might return ParsingError if schema isn't valid.
Len() (uint, error)
// Example returns an example for this schema.
// Might return ParsingError if schema isn't valid.
Example() ([]byte, error)
// AddType adds a new type to this schema.
// Might return a ParsingError if add type isn't valid.
AddType(name string, schema Schema) error
// AddRule adds a new type to this schema.
// Might return a ParsingError if add type isn't valid.
AddRule(name string, schema Rule) error
// Check checks that this schema is valid.
// Can return ParsingError if schema isn't valid.
Check() error
// GetAST returns a root AST node for this schema.
GetAST() (ASTNode, error)
// UsedUserTypes return all used user types.
UsedUserTypes() ([]string, error)
}