Documentation
¶
Overview ¶
Provides JSON Schema validation API.
Uses the embedded blueprint.SchemaJSON to validate against JSON or YAML documents.
Index ¶
- Variables
- type Schema
- func (s *Schema) ReadAndValidateJSON(reader io.Reader) (bool, string, error)
- func (s *Schema) ReadAndValidateYAML(reader io.Reader) (bool, string, error)
- func (s *Schema) ValidateJSON(data []byte) (bool, string, error)
- func (s *Schema) ValidateMap(data map[string]any) (bool, string)
- func (s *Schema) ValidateYAML(data []byte) (bool, string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCannotCompileSchema = errors.New("cannot compile schema")
ErrCannotCompileSchema is returned when the schema cannot be compiled.
Functions ¶
This section is empty.
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
func CompileSchema ¶
CompileSchema compiles the JSON schema. Uses the embedded schema available as blueprint.SchemaJSON.
func (*Schema) ReadAndValidateJSON ¶
ReadAndValidateJSON reads JSON from the reader and calls ValidateMap.
func (*Schema) ReadAndValidateYAML ¶
ReadAndValidateYAML reads YAML from the reader and calls ValidateMap.
func (*Schema) ValidateJSON ¶
ValidateJSON unmarshals JSON and calls ValidateMap.
func (*Schema) ValidateMap ¶
ValidateMap validates the map against the schema. Returns true if the data is valid, otherwise false and a string with details.
Click to show internal directories.
Click to hide internal directories.