Skip to content

Support big integers in JSON documents #235

@dlo

Description

@dlo

Hi all! Thanks so much for open sourcing this tool.

I noticed that the linter fails when checking a file with a large integer (9223372036854776000), even if it's valid JSON. I ran into this when trying to bundle several files, one of which included the one that failed the linter. Here's the file in its entirety (you'll want to remove the // FAILS HERE text, obviously):

{
  "$id": "main.v1.Pricing.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "amount": {
      "$ref": "google.type.Money.schema.json"
    },
    "count": {
      "anyOf": [
        {
          "exclusiveMaximum": 9223372036854776000, // FAILS HERE
          "minimum": -9223372036854775808,
          "type": "integer"
        },
        {
          "pattern": "^-?[0-9]+$",
          "type": "string"
        }
      ]
    },
  },
  "title": "Pricing",
  "type": "object"
}

Invocation:

$ jsonschema lint main.v1.Pricing.schema.json
error: Failed to parse the JSON document at line 12 and column 31
  REDACTEDPATH/main.v1.Pricing.schema.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions