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

parse_truthy_value should return a boolean ? #18

Open
gabrielhamel opened this issue Feb 19, 2023 · 1 comment
Open

parse_truthy_value should return a boolean ? #18

gabrielhamel opened this issue Feb 19, 2023 · 1 comment

Comments

@gabrielhamel
Copy link
Contributor

I've just seen that you have a function named parse_truthy_value who actually parsing boolean fields. Why she isn't returning a boolean ?

@gabrielhamel gabrielhamel changed the title parse_truthy_value should return a boolean parse_truthy_value should return a boolean ? Feb 19, 2023
@dacite
Copy link
Collaborator

dacite commented Feb 19, 2023

Yes, I think it can be changed to return boolean.

The original reason its not returning boolean is because it was copied from the bool_to_int function in the utils crate. WG likes to change type of a field between versions. For example:

// 0.9.18.0
{
    "flagCapture": false
}
// 1.12.1.0
{
    "flagCapture": 0
}

In the above case, I didn't know how to convert 0 to bool using serde. So I did it that way.

But here it doesn't seem to apply so it can be changed to boolean

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