Skip to main content

Module schema_transform

Module schema_transform 

Source
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

  1. additionalProperties: false - added to every object that lacks it (required by Anthropic’s constrained decoding).
  2. $ref / $defs inlining - JSON Schema references are resolved and inlined, since the CLI may not support $ref.
  3. Meta-field removal - $schema, title, and default are 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.