Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash and error on int64 properties with minimum limits lower than int32 lowest value #36

Open
dpotter-intoto opened this issue Dec 26, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@dpotter-intoto
Copy link

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 dpotter-intoto added the bug Something isn't working label Dec 26, 2023
@christianhelle
Copy link
Owner

@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 😞

@dpotter-intoto
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants