Skip to content

Unable to use Valibot schema in TanStack Form due to transformed Dates #2380

@oscar-b

Description

@oscar-b

Description

I'm using a @hey-api/transformers to transform dates, together with Valibot validation, all without issues.

However, when I tried to use the same validation schema in TanStack Form (https://tanstack.com/form/v1/docs/framework/react/guides/validation#validation-through-schema-libraries) it fails since the actual object in the form (transformed by heyapi) are proper Date, and the Valibot schema expects it to be a string (pre transform).

Not sure if this is expected behavior and the generated schemas aren't meant to be used in form validation like this? One solution could be to have the schema use a union check with both string and Date?

Related: #2103

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-client-fetch-example

OpenAPI specification (optional)

No response

System information (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions