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

Handle "yes" and "no" as valid boolean type #224

Merged
merged 4 commits into from
Jul 31, 2024

Conversation

kuzalekon
Copy link
Contributor

@kuzalekon kuzalekon commented Jul 22, 2024

I propose to give the opportunity to set Boolean values ​​also using yes and no.

@af
Copy link
Owner

af commented Jul 25, 2024

Thanks for the PR!

Is this a commonly used boolean format? I haven't seen it before, and if it's not widely used I think it probably makes sense to create your own custom validator for this instead, rather than overloading the built-in boolean one.

I wouldn't want this to give users an unexpected result, and it's technically a breaking change.

@kuzalekon
Copy link
Contributor Author

kuzalekon commented Jul 25, 2024

Hi, @af !

I think it's a pretty good idea to make it possible to use this method of setting boolean values ​​in the configurations that people work with :)

Also, this is a relatively common case where values ​​such as yes/no/y/n/on/off are recognized as boolean.
For example, here are several libraries with this approach:

If you decide to approve this PR, I can also add so values like y/n/on/off ​​are also recognized as boolean.

@af
Copy link
Owner

af commented Jul 26, 2024

@kuzalekon Thank you for the references! That definitely eases my concerns. I will let this sit for a few more days to see if anyone has any concerns, but the rationale and changes make sense 👍

@af af merged commit d8bc647 into af:main Jul 31, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants