What steps will reproduce the problem?
1. Define a property in the schema with type 'integer' or 'number', such as
{'type':'number'}
2. Give the property a value of 12345678901 (integer of eleven digits)
3. Validate the value
What is the expected output? What do you see instead?
Expected output:
>>> jsonschema.validate(12345678911, {'type':'number'})
>>> jsonschema.validate(12345678911, {'type':'integer'})
Actual output:
...
File "jsonschema/validator.py", line 108, in validate_type
raise ValueError("Value %r for field '%s' is not of type %r" % (value,
fieldname, fieldtype))
ValueError: Value 12345678911L for field '_data' is not of type 'number'
What version of the product are you using? On what operating system?
jsonschema-0.2a, OSX Leopard, Python 2.5.1
Please provide any additional information below.
I fixed this bug by adding types.LongType to the _typesmap (validator.py,
line 20) as follows:
-------
"integer": [types.IntType, types.LongType],
"number": [types.IntType, types.FloatType, types.LongType],
-------
Original issue reported on code.google.com by samuel...@gmail.com on 9 Jun 2009 at 2:39
Original issue reported on code.google.com by
samuel...@gmail.com
on 9 Jun 2009 at 2:39