Skip to content

Latest commit

 

History

History

README.md

How to use github.com/lestrrat-go/json-schema

Task-oriented guides for building, validating against, and generating code from JSON Schema 2020-12 documents in Go.

If you would rather read code, every file under examples/ is a runnable go test example.

The two-package model

schema package          validator package
─────────────           ─────────────────
*schema.Schema   ──────▶  validator.Compile(ctx, schema)  ──────▶  validator.Interface
(inert data)              (compiles once)                          (run many times)

A schema is pure data — you build it or unmarshal it from JSON. To validate, you compile it into a validator.Interface and call Validate. Schemas never validate themselves; there is no schema.Validate.

API reference

Full API docs: https://pkg.go.dev/github.com/lestrrat-go/json-schema.