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
Hi there, I'm trying to move away from Zod to Valibot, but I've hit a snag when generating OpenAPI defintions.
My schemas heavily rely on transform operations for validation, but I'm getting an error that states Error: The "transform" action cannot be converted to JSON Schema.. This is highlighted in the docs and I understand why that's the case. However, there are ways around this that can be explored.
For example, the zod-openapi package gets around this by allowing the user to set effectType to "input" which takes the non-transformed defintion and builds the schema from there. It does this by default when new effects are provided (see: rhinobase/hono-openapi#3)
I'd suggest that valibot should do the same, or even does this by default if a transform operation is detected. That way, the JSON schema package becomes usable for almost any situation.
The text was updated successfully, but these errors were encountered:
bdashore3
changed the title
to-json-schema: Add option to
to-json-schema: Add option to provide input schema for effects
Dec 28, 2024
Also, using 'warn' when running toJsonSchema seems to ignore the failed actions and still produces a valid JSON schema. However, it may be good to look into warning by default on a transform.
What exactly does Zod's toJsonSchema function do when this option is enabled? I would guess it does exactly the same thing as our errorMode option when set to 'warn' or 'ignore'. Are you basically asking to introduce a new option to override/define errorMode specifically for transformations?
Hi there, I'm trying to move away from Zod to Valibot, but I've hit a snag when generating OpenAPI defintions.
My schemas heavily rely on transform operations for validation, but I'm getting an error that states
Error: The "transform" action cannot be converted to JSON Schema.
. This is highlighted in the docs and I understand why that's the case. However, there are ways around this that can be explored.For example, the zod-openapi package gets around this by allowing the user to set
effectType to "input"
which takes the non-transformed defintion and builds the schema from there. It does this by default when new effects are provided (see: rhinobase/hono-openapi#3)I'd suggest that valibot should do the same, or even does this by default if a transform operation is detected. That way, the JSON schema package becomes usable for almost any situation.
The text was updated successfully, but these errors were encountered: