JSON-Schema-Test-Suite icon indicating copy to clipboard operation
JSON-Schema-Test-Suite copied to clipboard

Add test for multipleOf to ensure that implementation does not have an issue regarding scale

Open seamusv opened this issue 5 years ago • 2 comments

This is not a float/double related issue but is one regarding scale. Consider the following schema:

[
    {
        "description": "by deep scale",
        "schema": {"multipleOf": 0.25},
        "tests": [
            {
                "description": "8.75 is multiple of 0.25",
                "data": 8.75,
                "valid": true
            },
            {
                "description": "8.750000000001 is not multiple of 0.25",
                "data": 8.750000000001,
                "valid": false
            },
            {
                "description": "8.7500000000001 is not multiple of 0.25",
                "data": 8.7500000000001,
                "valid": false
            },
            {
                "description": "8.75000000000001 is not multiple of 0.25",
                "data": 8.75000000000001,
                "valid": false
            }
        ]
    }
]

This will ensure libraries with language support for a rich big decimal are not constrained by a low exponent check.

seamusv avatar Dec 31 '19 09:12 seamusv

For implementations that don't use a big decimal library, since the validation will fail ("valid" will turn out to be true), is there a way to ignore these tests?

ssilverman avatar Apr 23 '20 01:04 ssilverman

This repository is just a bunch of data files. It's up to the individual implementation libraries to decide how to pull those files in and provide interfaces for running tests with them. So: check with your library to see what options are available, or submit a patch to enhance them :)

karenetheridge avatar Apr 23 '20 01:04 karenetheridge