Replies: 1 comment 1 reply
-
@jnichols0 Hmm, i guess this is something where there might be some inconsistency between the original specification from kwalify and how i interpreted it and implemented it. From the specification you find this
But what i am going to say is that i think i have implemented the specification right based on the original source code and how it worked over in ruby, but i do get your point about the inconsistency and i kinda agree with that point as well. So what we got here then in the end is that how we should fulfill both the specifications but also update it to make it both compatible and logical in a python context. So if we say that we make it so a int is attempted to be converted before checking then we get into some strange cases as well because how do you then define or trust that in some cases all you really want to check is |
Beta Was this translation helpful? Give feedback.
-
In version 1.8.0, given a schema like so:
the following yaml is valid:
something: "1"
This seems to also be the case where "something" requires type float. However the yaml isn't valid when "something" requires type int. I saw in type.py that is_int returns True when an obj is an int object and not a boolean. However is_float returns True when an obj is a float or when that obj can t be successfully cast to a float. Why not check if the obj can be cast to an int to determine if it's an int? I am wondering if this seeming inconsistency is purposeful. I am not terribly familiar with kwalify outside of use of this library. It just seems so odd that the string literal "1" is a valid float and number, but not integer.
My environment:
CPython 3.7.9 and 3.8.5
pykwalify 1.8.0
Beta Was this translation helpful? Give feedback.
All reactions