'How to validate for length of an integer in Json Schema?

Simulator: https://www.jsonschemavalidator.net/s/L3FmJnoE

It looks like json schema validation does not check for regex patterns for integers. How to validate for length of an integer?

Json Schema -

{
  "$schema": "http://json-schema.org/draft/2019-09/schema",

  "title": "title",
  "type": "object",
  
  "properties": {
    "amount": {
      "type": "integer",
        "example": 199,
          "maxLength": 1,
            "pattern": "^[0-9]{1}$"
    }
  }

}

My Json which should fail validation but does not -

{
  
 "amount": 343434343434343434334343434343434
 
 }


Solution 1:[1]

Take a look at the maximum (specification) keyword and the related ones to set a maximum value for numbers. Regular expressions are only applied to string values (more details here).

(maxLength is also only applied to string values)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Clemens