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 ¶
const Name = "baum.review/1"
Name is the value of a document's top-level "schema" field.
const URL = "https://static.usebaum.com/schemas/review/1.json"
URL is the schema's $id and the address it is published at.
Variables ¶
var Document []byte
Document is the vendored schema file.
var Example []byte
Example is a complete example document that validates against the schema. It is what "the reference viewer host" serves.
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 Validate ¶
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.