Skip to content

Type Validation failing when a huge number (More than 19 Digits) is given in place of String #120

@rameshms671

Description

@rameshms671

Hi Team,

I have given here a sample schema to understand the scenario. Schema has an element UserName of type String.

Sample Schema:
{
"$schema": "http://json-schema.org/schema#",
"properties": {
"User": {
"type": "object",
"properties": {
"UserName": {
"type": "string"
}
},
"required": [
"UserName"
]
}
}
}

Sample Json 1:
{
"User": {
"UserName": 100
}
}

When I try to give a number for UserName as given in Sample Json 1, ValidationException is thrown with Message "expected type: String, found: Integer".

Sample Json 2:
{
"User": {
"UserName": 1234567890123456789
}
}

When I try to give a number in range of Long for UserName as given in Sample Json 2, ValidationException is thrown with Message "expected type: String, found: Long".

Sample Json 3:
{
"User": {
"UserName": 1234567890123456789012345
}
}

When I try to give a huge number out of range of Long for UserName as given in Sample Json 3, Validation is passing without any error. But as it is not a String value, it has to throw ValidationException.

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