Expand description
JSON Schema transformations for Claude CLI compatibility.
The Claude CLI --json-schema flag has known compatibility issues with
certain JSON Schema features. This module normalizes schemas before
sending them to the CLI to maximize structured output reliability.
§Transformations applied
additionalProperties: false- added to every object that lacks it (required by Anthropic’s constrained decoding).$ref/$defsinlining - JSON Schema references are resolved and inlined, since the CLI may not support$ref.- Meta-field removal -
$schema,title, anddefaultare stripped (not used by the CLI and may cause issues).
§Examples
use ironflow_core::schema_transform::transform_schema;
let schema = r#"{"type":"object","properties":{"name":{"type":"string"}}}"#;
let transformed = transform_schema(schema);
assert!(transformed.contains("additionalProperties"));Functions§
- transform_
schema - Transform a JSON Schema string for Claude CLI compatibility.