jsonschema

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package jsonschema contains JSON Schema helpers shared by Genkit provider plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnforceStrict

func EnforceStrict(schema map[string]any) map[string]any

EnforceStrict returns a deep copy of schema with additionalProperties: false set on every object subschema, recursing through "properties" and "items". This is the shape OpenAI and Anthropic require for strict tool schemas.

The input is not mutated. If the schema is not JSON-marshalable, the original map is returned unchanged.

func ReflectConfigSchema added in v1.12.0

func ReflectConfigSchema(config any, overrides map[string]*jsonschema.Schema) map[string]any

ReflectConfigSchema reflects an SDK request-params struct into the JSON schema map a model advertises as its config. The provider SDKs wrap optional primitives in generic Opt types that marshal as bare values but reflect as objects, so those are mapped to their wire shapes; overrides adds SDK-specific mappings by type name (e.g. inline unions) that take precedence.

Types

This section is empty.

Jump to

Keyboard shortcuts

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