schema

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package schema embeds the baum.review/1 JSON Schema and compiles it for validation.

review-1.json is the schema itself, published at URL. The local tool and the hosted service both read it from this package and support the same features. legacy-review-tiles.json keeps the tile kinds the schema retired, for stored documents that still carry them. Additive schema edits bump the revision recorded at $defs/schemaRevision/const, which a generated document echoes in generator.schema_revision.

Index

Constants

View Source
const Name = "baum.review/1"

Name is the value of a document's top-level "schema" field.

View Source
const URL = "https://static.usebaum.com/schemas/review/1.json"

URL is the schema's $id and the address it is published at.

Variables

View Source
var Document []byte

Document is the vendored schema file.

View Source
var Example []byte

Example is a complete example document that validates against the schema. It is what "baum internal view --sample" serves.

View Source
var LegacyTiles []byte

LegacyTiles holds the definitions of the tile kinds the schema retired, as $defs/legacyTile and the definitions it uses; a $ref it does not define resolves against Document's $defs. Generation never produces these kinds and the file is not published, but stored documents may still carry them, so stored-document validation accepts them and the viewer renders them.

Functions

func Compile

func Compile() (*jsonschema.Resolved, error)

Compile returns the vendored schema resolved as JSON Schema draft 2020-12. The result is safe for concurrent use.

func Revision

func Revision() (string, error)

Revision returns the schema revision at $defs/schemaRevision/const.

func Validate

func Validate(document []byte) error

Validate checks a JSON document against the schema.

The library does not assert "format", so date-time and uri values are validated by the caller where it matters. It also treats a json.Number as a string, so the document is decoded to float64 numbers rather than with UseNumber; integers beyond 2^53 lose precision, which no keyword in the schema depends on.

Types

This section is empty.

Jump to

Keyboard shortcuts

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