Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options for toJsonSchema to handle unknown types #1227

Open
ciscoheat opened this issue Dec 16, 2024 · 1 comment
Open

Options for toJsonSchema to handle unknown types #1227

ciscoheat opened this issue Dec 16, 2024 · 1 comment
Labels
confirmed The maintainers of the repo would like to address this enhancement New feature or request

Comments

@ciscoheat
Copy link

Request a feature

🤷 Motivation

The toJsonSchema feature of a schema is very welcome. I'm using it to extract default values from the schema, so you don't have to specify that manually when doing form validation. Right now though, Arktype throws an exception when it encounters a type it cannot convert to JSON Schema, like Date.

What I would like is an option to handle that myself, for example to return a custom JSON Schema for those types.

Of course, it's vital that default values are also included. :)

💡 Solution

I've looked at numerous "to-json-schema" solutions for Superforms, and one of the best parsers I've seen is valibot-json-schema. I've linked to its options for custom conversions. It has well-defined types which makes it easy to handle compared to Arktype, but maybe it will give some inspiration at least.

@github-project-automation github-project-automation bot moved this to To do in arktypeio Dec 16, 2024
@ssalbdivad ssalbdivad moved this from To do to Backlog in arktypeio Dec 17, 2024
@ssalbdivad ssalbdivad added the confirmed The maintainers of the repo would like to address this label Dec 17, 2024
@ssalbdivad
Copy link
Member

Yes, I'd love to see more options around this!

Would accept external contributions, but otherwise will try and prioritize it after 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed The maintainers of the repo would like to address this enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants