pyjsonschema

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 31 Imported by: 0 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 pyjsonschema ports python-jsonschema 4.26.0 with referencing 0.37.0 so validation errors read as Python renders them

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSchema

func CheckSchema(schema any, callerDepth int) error

validator_for(schema).check_schema(schema), the first metaschema error as a SchemaError

func Str

func Str(err error, callerDepth int) (text string, failed error)

str of an error the port raised as Python computes it callerDepth frames deep, a RecursionError when Python's would fail

func Validate

func Validate(instance, schema any, callerDepth int) error

jsonschema.validate called from callerDepth Python frames deep, raising the SchemaError or the best matching ValidationError

Types

type Exception

type Exception struct {
	Type string
	Msg  string
	// contains filtered or unexported fields
}

Python exception the port raised, its str text fixed in Msg or rendered on demand

func (*Exception) Error

func (e *Exception) Error() string

func (*Exception) PyTypeName

func (e *Exception) PyTypeName() string

Python class name of the raised exception

type IterError

type IterError struct {
	Message string
	// Keyword that failed, nil for a false schema
	Validator    any
	AbsolutePath []any
}

One error of an iter_errors pass with its message and absolute instance path

func IterErrors

func IterErrors(instance, schema any, callerDepth int) ([]*IterError, error)

Every error validator_for(schema)(schema).iter_errors(instance) yields, called from callerDepth Python frames deep

type SchemaError

type SchemaError struct {
	Message string
	// contains filtered or unexported fields
}

Metaschema violation check_schema raises, Error giving the str Python renders

func (*SchemaError) Error

func (e *SchemaError) Error() string

type ValidationError

type ValidationError struct {
	Message string
	// Keyword that failed, nil for a false schema
	Validator    any
	AbsolutePath []any
	// contains filtered or unexported fields
}

Best matching jsonschema error of a validation, Error giving the str Python renders

func BestMatch

func BestMatch(instance, schema any, callerDepth int) (*ValidationError, error)

validator_for, check_schema and best_match over iter_errors run from callerDepth Python frames deep, nil when valid

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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