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

Refused promise input to parse #383

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

genki
Copy link
Contributor

@genki genki commented Jan 23, 2024

I have faced to a problem to parse the promise value mistakenly several times.
And I came up with that the parse must not accept any promise values as input.
There must be no needs to parse the promise.

@fabian-hiller
Copy link
Owner

I am not sure I want to change this. What if we add a promise schema function in the future that allows promises to be passed? I understand why you like this change but on the other side I don't want to limit the library unnecessary.

@fabian-hiller fabian-hiller self-assigned this Jan 23, 2024
@fabian-hiller fabian-hiller added the question Further information is requested label Jan 23, 2024
@fabian-hiller
Copy link
Owner

fabian-hiller commented Jan 23, 2024

Also, a Promise schema can already be created with instance and special, so this change could also be a breaking change for some users.

@genki
Copy link
Contributor Author

genki commented Jan 23, 2024

I see, I will respect your design.
For further studies, I would like to know about it.
I though the parseAsync was prepared for such the promise values to parse.
I couldn't came up with use cases that we want to parse Promise object it self.
All instance(Promise) and special<Promise> can't be replaced with anyAsync?

@fabian-hiller
Copy link
Owner

The idea of parseAsync is that you can use async validation functions like customAsync in your pipeline. any and anyAsync allow any value, not just promises. Read more about async validation here: https://valibot.dev/guides/async-validation/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants