feat: support nested objects, typed arrays, and enums in schema conversion#4
Open
Alex647648 wants to merge 1 commit intodimensionalOS:masterfrom
Open
feat: support nested objects, typed arrays, and enums in schema conversion#4Alex647648 wants to merge 1 commit intodimensionalOS:masterfrom
Alex647648 wants to merge 1 commit intodimensionalOS:masterfrom
Conversation
…conversion The jsonSchemaToTypebox function previously flattened nested objects into Record<string, unknown> and arrays into Array<unknown>, losing all type information. Enum values were also ignored. Extract a recursive jsonSchemaPropToTypebox helper that: - Recursively converts nested object schemas with their properties - Preserves array item schemas (e.g. Array<number> instead of Array<unknown>) - Converts enum values to TypeBox Union/Literal types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jsonSchemaPropToTypeboxhelper for per-property conversionobjectschemas withpropertiesare now recursively converted instead of flattened toRecord<string, unknown>arraytypes now preserve theiritemsschema (e.g.Array<number>instead ofArray<unknown>)enumvalues are converted toType.Union(Type.Literal(...))Motivation
MCP tools often define complex input schemas with nested objects, typed arrays, and enum constraints. The previous flat conversion lost all this type information, meaning OpenClaw's type validation and agent tooling couldn't enforce correct parameter shapes.
Test plan
items: { type: "number" }array — verify Array schema