python-jsonschema / python-jsonschema/jsonschema
Instance validates if `multipleOf` is an integer, but fails if it's a float
Open
Nobody has claimed this yet.
Bug
- Dominant language
- Python
- Stars
- 5k
- Forks
- 671
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Description
from jsonschema import validate
instance = 9007199254740995
validate(instance, schema={"type": "integer", "multipleOf": 11}) # passes
validate(instance, schema={"type": "integer", "multipleOf": 11.0}) # fails
I'm pretty sure that this is a bug, on the basis that the spec says all integer-valued numbers should be treated as integers.
Found via https://github.com/python-jsonschema/hypothesis-jsonschema/pull/103.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two validation calls from the issue and trace the numeric validation path for integer and float-valued multipleOf schemas. Add or update regression coverage so mathematically integer-valued multiples behave consistently, then confirm the example passes and the existing validation tests remain green.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100