You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A schema with an id gets no options, only --json #233
Giving an input schema an id, as one does to name it in JSON Schema or in an OpenAPI document, removes its options. With trpc-cli 0.17.1 and zod 4.6.7:
greet --help lists only --json, with "procedure's schema couldn't be converted to CLI arguments: Invalid input type {...}, expected object or tuple", and greet --name Ada fails with "unknown option '--name'". Without the id, --name <string> is there. .register(z.globalRegistry, { id: "Greeting" }) does the same.
Zod writes a schema that has an id as a reference: the root is {"$ref": "#/$defs/Greeting", "$defs": {"Greeting": {...}}}, or #/definitions/Greeting for draft-07, and trpc-cli reads that root as the input's type. A field with an id has a smaller version of the problem: retries: z.int().meta({ id: "Retries" }).optional() becomes --retries [json] instead of --retries [integer].
Resolving a local $ref against the schema's own $defs or definitions before reading it would fix both. I tried the root case from outside, passing the same JSON Schema with its root $ref replaced by its target as a Standard JSON Schema, and greet --help then lists --name <string> and greet --name Ada prints "hi Ada".
For now we pass a copy of the object's fields, z.object(Greeting.shape), which has no id.
Activity
pullfrog commentedon Oct 24, 2026