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

Allow undefined/empty fields #889

Closed
TeemuKoivisto opened this issue May 11, 2020 · 4 comments
Closed

Allow undefined/empty fields #889

TeemuKoivisto opened this issue May 11, 2020 · 4 comments

Comments

@TeemuKoivisto
Copy link

TeemuKoivisto commented May 11, 2020

Hi,

so my problem is as follows: I am using yup as a necessity to parse my form inputs as numbers without having to mess with my TypeScript type definitions.

Which has caused me then another problems. Namely that there isn't a built-in way to support Joi.alternatives type of validation, with multiple possible schemas (yes I've seen #321). I think that should be a must for any validation library since it's so basic functionality.

And because there is not an easy way to do that, I now have an input of type number, which I can't leave empty since yup automatically makes it required. So I'm really having to fight against the library here, which to me is a waste of time and it makes me sad this is so hard.

I can leave it empty by making it a mixed/string but that just beats the purpose of using yup in the first place.

I know maintaining a library without compensation or much assistance is a pain in the ass, but c'mon, I think what I'm suggesting are very basic requirements.

Example form:

https://codesandbox.io/s/react-hook-form-useform-template-469zb

EDIT: I switched to Joi and Joi.number().min(0).empty('') solved my issue.

@TeemuKoivisto TeemuKoivisto changed the title Allow undefined fields Allow undefined/empty fields May 11, 2020
@jquense
Copy link
Owner

jquense commented May 11, 2020

Most polymophic types can be represented via lazy() just fine, as noted in the other issue. Joi's exact api is not supported for a few reasons mostly because it is not generally feasible due to other choices yup has made that differentiate it from Joi that are more important to me.

I know maintaining a library without compensation or much assistance is a pain in the ass, but c'mon, I think what I'm suggesting are very basic requirements.

It doesn't help you sound less entitled to preface complaining that someone's free work doesn't suit your needs, by noting that it's free and thankless work and then complaining about it anyway.

Just because something is a "basic requirement" for you doesn't mean it is for others. It's your requirement, not mine. If yup doesn't suit your needs, you can use something else without making a big stink about how this project failed you in the issue tracker.

@jquense jquense closed this as completed May 11, 2020
@TeemuKoivisto
Copy link
Author

Well I'm sorry if my wording was poor. I myself am quite direct in my communication and write things in a way I'd write them to myself. But if you can separate the emotional side of me critiquing your work from the feedback, I think my suggestion is not unreasonable. No need to get upset. But suit yourself.

@jquense
Copy link
Owner

jquense commented May 11, 2020

your feedback wasn't direct, it was rude and entitled there is a difference, emotion has nothing to do with it. If anything, your feedback is vague and poorly defined. You didn't follow the issue template, your repro uses an unrelated library, you didn't clearly articulate what behavior you wanted or in what way's yup didn't do what you wanted. Please, don't confuse complaining for "being direct"

If you want an author to consider your use-cases and dedicate their free time to helping you should show up with more than complaints about how your job was hard. I don't really care whether yup works for you or not, that's not an emotional position or me being upset it's just the plain reality of it, i built yup for me and my needs, to the extend others get value out of it awesome. If you want me to care being collaborative and helpful is the way to do it. Not chastising the author because their library doesn't do what you need.

to be clear, i am not upset or bothered, i'm taking the time to explain this to you assuming you aren't trying to be rude and unhelpful and would like some direct feedback on how these interactions could be productive

@TeemuKoivisto
Copy link
Author

Well I just don't get you then, I guess. Because from how you responded, I took the notion you were quite upset. Which I had no intention to do in the first place, but maybe my way of saying things can be quite rude. Depends on the person. But thanks for taking the time to respond to clear this out.

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

No branches or pull requests

2 participants