Crash and error on int64 properties with minimum limits lower than int32 lowest value
Describe the bug
Program throws an error Value was either too large or too small for an Int32. System.OverflowException for properties that are int64 data types, and whose minimum value is specified to be lower than (farther from zero than) -2147483648
OpenAPI Specifications This is the specification in which I encountered the issue: netbox API
Additional context
I don't know whether this is an issue in your code or in the NJsonSchema library. The lowest value permissible in int64 is -9223372036854775808, but this error is received whenever a minimum value is specified lower than the int32 limit of -2147483648.
For example, this YAML does not produce the error:
WritableL2VPNRequest:
type: object
description: Adds support for custom fields and tags.
properties:
identifier:
type: integer
maximum: 9223372036854775807
minimum: -2147483648
format: int64
nullable: true
But this one does:
WritableL2VPNRequest:
type: object
description: Adds support for custom fields and tags.
properties:
identifier:
type: integer
maximum: 9223372036854775807
minimum: -2147483649
format: int64
nullable: true
And this one (that should be legal!) is right out!
WritableL2VPNRequest:
type: object
description: Adds support for custom fields and tags.
properties:
identifier:
type: integer
maximum: 9223372036854775807
minimum: -9223372036854775808
format: int64
nullable: true
The netbox API I linked above will succeed if you globally search/replace all instances of minimum: -9223372036854775808 with minimum: -2147483648
@dpotter-intoto thanks for taking the time to report this. I'll see what I can do.
I can't promise anything anytime soon as I'm "trying" to stay offline over the holidays. Unfortunately, as you can see, so far I'm failing at that 😞
@christianhelle Lol, thanks so much for the fast response. There's no urgency for a resolution on this - I've worked around the issue handily. Indeed, it might not even be your issue... perhaps the OpenAPI is in error.
Have a wonderful holiday!