Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dereference ¶
Types ¶
type Fetcher ¶
type Fetcher interface {
GetSchema(uri *url.URL) (s Instance, ok bool, err error) // Retrieve a schema
}
Fetcher fetches a parsed schema, given a URL. The URL may be unclean (have hash fragments)
type Instance ¶
type Instance map[string]interface{}
Instance is an instance of a parsed JSON schema (in generic map[string]interface{} form)
func Merge ¶
Merge merges multiple schema instances into a single one, folding in properties that do not overlap, and
func Sorted ¶
Sorted produces a sorted slice of schemas, based on the following rules:
If one schema is referenced by another in a $ref, then that schema appears before the other ¶
For schemas that are independent of one another, the one with the greatest number of form properties (/definitions/form/properties) appears before those that have fewer.
If two schemas have no dependencies and have the same number of properties, the one that appears first in the initial list will be first in the result.
type Map ¶
Map is a simple map of schema URIs to schema instances, serving as a static schema Fetcher
func Load ¶
Load scans the provided list of files and directories recursively and produces a Map of schema id to parsed instance documents
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates an instance document against its schema
func NewValidator ¶
func NewValidator(schema io.ReadCloser) *Validator
NewValidator creates a JSON schema validator instance for the given schema document