Documentation
¶
Overview ¶
Package schema provides JSON Schema validation for OpenACR documents.
The JSON Schema is embedded from the GSA OpenACR project and can be used to validate OpenACR documents before processing.
Usage ¶
validator, err := schema.NewValidator()
if err != nil {
log.Fatal(err)
}
data, _ := os.ReadFile("report.json")
if err := validator.Validate(data); err != nil {
log.Printf("Validation failed: %v", err)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates JSON data against the OpenACR schema.
func NewValidator ¶
NewValidator creates a new Validator with the embedded OpenACR schema.
func (*Validator) ValidateAny ¶
ValidateAny validates any value against the OpenACR schema. The value should be a map or struct that can be validated against the schema.
Click to show internal directories.
Click to hide internal directories.