jsonschema

package
v0.2.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package jsonschema implements the single JSON Schema subset that BuildMax's provider-neutral structured output (docs/design/structured-output.md §6) and Workflow input schemas (docs/design/workflow-runtime.md §6.1) both reference. One definition, checked once, means the same thing at every boundary.

The subset is deliberately narrow: objects, the scalar types (string/number/integer/boolean), enums, arrays, required, and additionalProperties:false. Every keyword must be both expressible in each provider's native mechanism and checkable here, so a keyword only one provider supports stays out until a consumer needs it. Growing the subset is adding a keyword when a consumer requires it, never before.

Index

Constants

View Source
const (
	TypeObject  = "object"
	TypeArray   = "array"
	TypeString  = "string"
	TypeNumber  = "number"
	TypeInteger = "integer"
	TypeBoolean = "boolean"
)

Supported type keywords.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

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

Schema is a compiled schema in the supported subset. Compile it once and validate many values against it.

func Compile

func Compile(raw json.RawMessage) (*Schema, error)

Compile parses raw and verifies it is within the supported subset, returning a reusable Schema or an error naming the first unsupported construct. Workflow publication uses it to reject an out-of-subset schema; the runtime uses the result to validate values.

func (*Schema) Validate

func (s *Schema) Validate(value json.RawMessage) error

Validate checks value against the schema, returning an error describing the first mismatch. A nil error means value conforms.

Jump to

Keyboard shortcuts

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