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 integers to be given as inputs to fields that require floats #59

Closed
davemoore- opened this issue Jan 22, 2021 · 1 comment
Closed
Labels
enhancement New feature or request release:1.7.0

Comments

@davemoore-
Copy link
Member

The score and quality fields in entity models are floats. Currently, zentity strictly requires the inputs of those fields to be floats. If an integer is submitted to one of these fields, zentity will throw a validation exception.

This behavior is too restrictive for some clients. JavaScript's JSON.stringify() serializer will force any number of 0.0 or 1.0 to be serialized as 0 or 1 and there is no easy way around this (cases: here, here).

zentity should allow integers as inputs to float fields, and then convert those fields to floats for its own purposes.

@davemoore- davemoore- added the enhancement New feature or request label Jan 22, 2021
@davemoore- davemoore- mentioned this issue Jan 22, 2021
12 tasks
@davemoore-
Copy link
Member Author

Merged into main: 5a45d41:

Allow integer values of 0 or 1 for the "score" and "quality" fields, which expect floating point numbers in the range of 0.0 - 1.0. Allow floating point numbers with zero decimal value (e.g. ###.0) for the "weight" field, which expects an integer value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release:1.7.0
Projects
None yet
Development

No branches or pull requests

1 participant