hiltontj / serde_json_path

Query serde_json Values with JSONPath
https://serdejsonpath.live/
MIT License
51 stars 4 forks source link

feat: implement integer type to comply with spec #98

Closed hiltontj closed 3 months ago

hiltontj commented 3 months ago

This PR is to address the recent CTS failure.

The JSONPath spec states that integers, e.g., those used as indices or in slice selectors, must be within a specific range [-2^53 +1, 2^53 - 1] (see here).

The CTS recently added tests to verify this behaviour in https://github.com/jsonpath-standard/jsonpath-compliance-test-suite/pull/90, and serde_json_path which was not accounting for it, was failing the updated CTS.

This PR adds a new Integer type to represent such integers and check that they stay within that range. It also caught a couple of places where overflows would have led to panics.

hiltontj commented 3 months ago

@Marcono1234 - thanks for the comments and for calling out the quirks in the API - I will submit another PR to update the API, and may request your review.