Documentation ¶
Overview ¶
Package schema implements JSON validation utilities
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is a utility to validate JSON object against a given schema
func NewValidator ¶
NewValidator creates a new Validator using schemas for the top level JSON schemas and refs for refs that may be referenced in the top level schemas. Top level schemas cannot reference each others. If a reference is mentioned, it can only be in the list of refs
func NewValidatorFromFS ¶
NewValidatorFromFS creates a new Validator using schemas from schemaFS. Json files from / will be used as toplevel schemas, while json files in /refs/ will be used as references
func (*Validator) ValidateString ¶
ValidateString validates the given json against schemaID. If no error is returned, then the passed json is valid
func (*Validator) ValidateStruct ¶
ValidateStruct validates the given json as a struct against schemaID. If no error is returned, then the passed json is valid