schema

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 5 Imported by: 0

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

func JSON

func JSON() []byte

JSON returns the embedded OpenACR JSON Schema as bytes.

func String

func String() string

String returns the embedded OpenACR JSON Schema as a string.

Types

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator validates JSON data against the OpenACR schema.

func NewValidator

func NewValidator() (*Validator, error)

NewValidator creates a new Validator with the embedded OpenACR schema.

func (*Validator) Validate

func (v *Validator) Validate(data []byte) error

Validate validates JSON data against the OpenACR schema.

func (*Validator) ValidateAny

func (v *Validator) ValidateAny(doc any) error

ValidateAny validates any value against the OpenACR schema. The value should be a map or struct that can be validated against the schema.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL