Documentation
¶
Overview ¶
Package notes defines a type that holds information passed between keywords during schema validation. This permits validation of one keyword to depend on information gathered while validating another keyword.
For example, this supports keywords like "unevaluatedItems", that impose requirements only on fields that were not already validated by other keywords like "items" or "contains".
This package is visible to support people who want to define their JSON schema definitions. People who are only interested in validating JSON objects using standard JSON schemas do not need to use this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendNote ¶
AppendNote appends values to a note. This is a function, not a method, so that it can be generic. This expects any existing note to have type []E, and panics if it does not.
Types ¶
type Notes ¶
type Notes struct {
// contains filtered or unexported fields
}
Notes is a set of notes. Each note has a name and a value. The name should normally be the name of a JSON schema keyword. The value may be anything; it is normally a bool, an int, or a slice of some elements.
The zero value of Notes is directly usable. Notes may not be used concurrently by multiple goroutines.
Notes are not annotations as defined by the JSON schema definition. Currently this module does not support JSON schema annotations. Notes could evolve into annotations if that seems desirable; we would need a way to save them and make them available after validation, and we would need to record the instance location and the schema location.
func (*Notes) AddNotes ¶
AddNotes adds all notes in the elements of ns to n. Scalar values in added notes replace those in n. Slices in added notes are appended to slices in n; if the element types differ, or if the value in n is not a slice, AddNotes will panic. Names in n that do not appear in added notes are unchanged.