as_foundry_schema: Convert an object to a foundryR JSON Schema

View source: R/schema.R

as_foundry_schemaR Documentation

Convert an object to a foundryR JSON Schema

Description

as_foundry_schema() is a small validation/conversion helper. It returns raw JSON Schema lists unchanged, so code can accept either schemas built with foundryR constructors or hand-written JSON Schema lists. If the ellmer package is installed, ellmer::type_object() specifications are converted to the equivalent strict JSON Schema, so ellmer users can pass their existing type definitions to foundry_extract() and foundry_response().

Usage

as_foundry_schema(x)

Arguments

x

Object to convert. Either a foundryR/JSON Schema list or an ellmer type_object() specification.

Value

A JSON Schema represented as an R list.

Examples

schema <- foundry_schema(label = schema_string())
as_foundry_schema(schema)

foundryR documentation built on Sept. 25, 2026, 1:10 a.m.