jsonschema

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package jsonschema validates JSON values against a bounded, offline subset of JSON Schema 2020-12 given as raw JSON. Unsupported assertion keywords fail compilation instead of being ignored. References are local JSON pointers only; compilation never fetches resources. Evaluation is bounded in depth and work, and values and schemas follow the plugin JSON rules (UTF-8, unique keys, no unpaired surrogates, 64 levels, at most plugin.MaxFrameBytes).

This package validates arbitrary caller schemas. Package schema is the small typed vocabulary for plugin payload declarations in package manifests; the two are independent.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = fmt.Errorf("%w: JSON Schema validation failed", plugin.ErrInvalid)

ErrInvalid is wrapped by every validation failure; it also matches plugin.ErrInvalid.

Functions

func Validate

func Validate(schema, value json.RawMessage) error

Types

type Schema

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

func Compile

func Compile(raw json.RawMessage) (*Schema, error)

Compile supports type, properties, required, additionalProperties, items, prefixItems, enum, const, numeric/string/array/object bounds, uniqueItems, allOf/anyOf/oneOf/not, and local $ref/$defs. format is an annotation.

func (*Schema) Validate

func (s *Schema) Validate(raw json.RawMessage) error

Jump to

Keyboard shortcuts

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