schemalite

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 9 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 schemalite validates JSON documents against the small subset of JSON Schema (2020-12) that the drift manifest and the test bundle's schemas use, so that those schemas stay the single description of the formats without a third-party validator. A schema that uses a keyword outside the subset is refused when it is loaded, never silently ignored. It is a development tool, not part of hopsesh.

Supported: type (a name or a list), properties, required, additionalProperties (a boolean or a schema), items, enum, const, pattern, minLength, maxLength, minItems, maxItems, minimum, maximum, $ref to "#/$defs/<name>", $defs, and the annotations $schema, $id, $comment, title, description and examples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

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

Schema is a loaded schema.

func Load

func Load(path string) (*Schema, error)

Load reads a schema file.

func Parse

func Parse(b []byte) (*Schema, error)

Parse reads a schema and checks that it uses only the supported keywords.

func (*Schema) Validate

func (s *Schema) Validate(doc []byte) []string

Validate checks a JSON document. It returns every problem found, each with the JSON path where it is ("$.targets[2].id"), sorted.

Jump to

Keyboard shortcuts

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