Documentation
¶
Overview ¶
Package jsonassert implements the JSON property assertions shared by the packs: JSONPath lookups with Jayway semantics, and values that mean what they say (ADR 0014), compared with their types.
Index ¶
- func ExpandedProperties(doc string, t *core.Table, expand func(string) string) error
- func IsNumber(v core.Value) bool
- func Properties(doc string, t *core.Table, regex bool) error
- func Strict(field, actual string, v core.Value) (same bool, hint string)
- func StrictAt(doc, path string, v core.Value) (same bool, hint string, err error)
- func StrictStep(field, actual string, v core.Value) (same bool, hint string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandedProperties ¶ added in v0.3.0
ExpandedProperties is Properties of values with the references in their strings expanded, after each value is read (core.Value.Expand): a reference is a string, whatever it expands to, and a failure shows it as written.
func Properties ¶
Properties asserts each path/value row of t against the JSON document. A value is read by the rule every pack follows (core.ParseValue: `42` an integer, `"42"` the string, `null`, `undefined` for no such property) and compared with its type, strictly. With regex, values are Java regular expressions that must match the whole text of the value. All failing rows are reported together, like Hamcrest's allOf.
func Strict ¶ added in v0.3.0
Strict says whether a value a database selected, as JSON, is v, type and all, as a check compares them: for a database whose own equality is looser than the rule's. hint says what to write when they differ only in type.
Types ¶
This section is empty.