JSON Schema Type Definitions (json_schema/types.rs)

openinterpreter · codex-rs/tools/src/json_schema/types.rs · rust · Apache-2.0
dev-tools, ai, lang:rust, fw:serde, tag:json-schema

Defines serializable JSON Schema types (string, number, object, array, etc.) used to construct tool schemas, modeled after OpenAI's Structured Outputs subset.

// Source: https://github.com/openinterpreter/openinterpreter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
//! Define serializable tool schema types and their constructors.

use serde::Deserialize;
use serde::Serialize;
use serde_json::Value as JsonValue;
use std::collections::BTreeMap;

/// Primitive JSON Schema type names we support in tool definitions.
///
/// This mirrors the OpenAI Structured Outputs subset for JSON Schema `type`:
/// string, number, boolean, integer, object, array, and null.
/// Keywords such as `enum`, `const`, `anyOf`, `oneOf`, and `allOf` are modeled
/// separately.
/// See <https://developers.openai.com/api/docs/guides/structured-outputs#supported-sch

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key