You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment the "number" type corresponds to st.float strategy, but as integers are valid for the "number" type in JSON Schema, I am wondering whether it will make sense to generate integers there as well.
I believe it may increase the output variation. What do you think?
I was thinking about your comment in the context of negating schemas and tried to canonicalise {"not": {"minimum": 42}} which gives {'not': {'minimum': 42, 'type': 'number'}, 'type': 'number'}. Even though it is a valid transformation, it seems too restrictive. For example, the end-user might expect that negating {"minimum": 42} will give e.g. 41, or some other integers, but there will be always floats. Having type: integer in place will solve this ({"not": {"minimum": 42}, "type": "integer"} works), but still sometimes it happens that it is missing.
The text was updated successfully, but these errors were encountered:
I remember that a while ago I looked at adding some logic along the lines of "sometimes try casting "number" values to Python type int" and vice-versa, but ran into trouble with the semantics on older jsonschema versions (I think draft-04?). See python-jsonschema/jsonschema#705 for upstream discussion when I raised this last year.
It's a nice feature to have, but might not be practical short of the 'rewrite everything to use objects and track schema version etc' plan that is eternally somewhere low on my todo list 😕
At the moment the "number" type corresponds to
st.float
strategy, but as integers are valid for the "number" type in JSON Schema, I am wondering whether it will make sense to generate integers there as well.I believe it may increase the output variation. What do you think?
I was thinking about your comment in the context of negating schemas and tried to canonicalise
{"not": {"minimum": 42}}
which gives{'not': {'minimum': 42, 'type': 'number'}, 'type': 'number'}
. Even though it is a valid transformation, it seems too restrictive. For example, the end-user might expect that negating{"minimum": 42}
will give e.g.41
, or some other integers, but there will be always floats. Havingtype: integer
in place will solve this ({"not": {"minimum": 42}, "type": "integer"}
works), but still sometimes it happens that it is missing.The text was updated successfully, but these errors were encountered: