Skip to main content

flatten_base_plus_oneof

Function flatten_base_plus_oneof 

Source
pub fn flatten_base_plus_oneof(schema: &Value) -> Result<Value>
Expand description

The McpServerElicitationRequestParams typify-0.7.0 workaround: merges a schema’s top-level object properties/required into each sibling oneOf branch, producing a pure oneOf-of-self-contained-objects. Returns the schema unchanged unless it actually has this exact shape (top-level oneOf and properties both present).

Every oneOf branch must itself be an inline {"type": "object", ...} schema with a properties object (required may be absent, meaning no branch-specific required fields) - bails otherwise rather than silently treating an unrecognized branch shape (e.g. a bare $ref to a named branch type) as if it contributed no fields. Silently defaulting a branch to empty would let typify accept the resulting schema while silently dropping every field that branch’s $ref would have contributed, with no build failure.