Help us shape the future of Go! Take the 2026 Go Developer Survey

outschema

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package outschema loads a user-supplied JSON Schema for --output-schema and validates a run's structured result against it.

The accepted subset is the one tinyagent accepts for MCP tool input schemas (see mcptools.CheckSchema): a root "type": "object", every schema declaring a type, and only these keywords: type, description, title, default, examples, properties, required, items, additionalProperties (boolean), enum, const, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, minLength, maxLength, pattern, format, minItems, maxItems, uniqueItems, minProperties, maxProperties. "$schema" is ignored; "format" is an annotation and is not enforced.

Index

Constants

View Source
const MaxFileBytes = 64 << 10

MaxFileBytes caps the schema file size.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

type Schema struct {
	// Params is the schema (minus "$schema"), used as the submit tool's
	// parameters.
	Params map[string]any
	// Digest is "sha256:<hex>" of the canonical JSON of Params.
	Digest string
}

Schema is a loaded, checked output schema.

func Load

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

Load reads and checks the schema at path. Errors name the file and reason.

func Parse

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

Parse checks a schema document.

func (*Schema) Validate

func (s *Schema) Validate(raw string) (json.RawMessage, []string)

Validate decodes raw JSON arguments and validates them. It returns the compact JSON of the object on success, or the validation errors.

Jump to

Keyboard shortcuts

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