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
Support Standard Schema for catalog props and action params
#475
Catalogs only accept Zod schemas for component props and action params. We write our schemas with Effect Schema and would rather not maintain a second schema library just for the catalog.
Would you accept support for Standard Schema together with Standard JSON Schema? Zod 4.2+, Effect Schema, Valibot and ArkType implement both.
Types: infer props and params with StandardSchemaV1.InferOutput instead of z.ZodType<infer P>.
Prompt and catalog.jsonSchema(): read the JSON Schema from ~standard.jsonSchema.input() instead of walking Zod's _def. One code path would then cover Zod as well.
For now we convert Effect Schema to Zod with z.fromJSONSchema(Schema.toStandardJSONSchemaV1(s)["~standard"].jsonSchema.input({ target: "draft-2020-12" })) and cast the result to keep the props types. It works, but native support would remove the round trip.
We'd be happy to open a PR if this is a direction you'd take.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Catalogs only accept Zod schemas for component props and action params. We write our schemas with Effect Schema and would rather not maintain a second schema library just for the catalog.
Would you accept support for Standard Schema together with Standard JSON Schema? Zod 4.2+, Effect Schema, Valibot and ArkType implement both.
StandardSchemaV1.InferOutputinstead ofz.ZodType<infer P>.catalog.jsonSchema(): read the JSON Schema from~standard.jsonSchema.input()instead of walking Zod's_def. One code path would then cover Zod as well.~standard.validate, which would also fix catalog.validate() skips per-component props validation when the catalog has more than one component #467.For now we convert Effect Schema to Zod with
z.fromJSONSchema(Schema.toStandardJSONSchemaV1(s)["~standard"].jsonSchema.input({ target: "draft-2020-12" }))and cast the result to keep the props types. It works, but native support would remove the round trip.We'd be happy to open a PR if this is a direction you'd take.
All reactions