stac-validator icon indicating copy to clipboard operation
stac-validator copied to clipboard

Add support for float values that are also valid integers

Open nick-j-roberts opened this issue 1 year ago • 1 comments

When validating a JSON document against a schema which specifies a property as type number, the validator indicates that the document is malformed if the property is a float value which is also a valid integer (ie 1.0, 2.0, 3.0, etc) and indicates that it is an integer and should be a float.

Example:

When checking property shown below with flags --lint and --verbose an error message is shown:

"$comment": "example property",
"proj:transform": [
      1.0,
      0.0,
      5.0,
      0.0,
      1.0,
      5.0
    ]
-- Lint: File is malformed -> use `--format` to fix the issue
- Expected
+ Received
"proj:transform": [
-       1.0,
+       1,
-       0.0,
+       0,
-       5.0,
+       5,
-       0.0,
+       0,
-       1.0,
+       1,
-       5.0
+       5
      ]

nick-j-roberts avatar Oct 24 '24 19:10 nick-j-roberts