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

[REQ] request to adjust storage of numeric json schema constraints #2023

Open
spacether opened this issue Nov 28, 2023 · 0 comments
Open

[REQ] request to adjust storage of numeric json schema constraints #2023

spacether opened this issue Nov 28, 2023 · 0 comments

Comments

@spacether
Copy link
Contributor

spacether commented Nov 28, 2023

Right now these are the storage of some json schema numeric constraints for this library's Java parsing:
BigDecimal maximum/minimum
BigDecimal exclusiveMaximum/exclusiveMinimum
Integer minLength/maxLength
Integer minProperties/maxProperties
Integer minItems/maxItems
BigDecimal multipleOf

And these are the definitions per the 2020-12 json schema draft:
maximum/minimum (defined as number)
exclusiveMaximum/exclusiveMinimum (defined as number)
minLength/maxLength (defined as non-neg integer)
minProperties/maxProperties (defined as non-neg integer)
minItems/maxItems (defined as non-neg integer)
multipleOf (defined as number > 0)
the josn schema spec does not define any allowed maxes, so json specifications are the only limit on number and integer sizes here

So the range defined is

Keywords Spec Definition Current Java Definition Proposed Java
exclusiveMaximum/exclusiveMinimum defined as number BigDecimal BigDecimal or Number
minLength/maxLength defined as non-neg integer Integer Long or BigInteger
minProperties/maxProperties defined as non-neg integer Integer Long or BigInteger
minItems/maxItems defined as non-neg integer Integer Long or BigInteger
multipleOf defined as number > 0 BigDecimal BigDecimal or Number

I am aware that ArrayList size and String size is integer (32 bit) in Java and your parser is used to generate code in many languages in openapi-generator and other projects. Those languages have different constraints.
In python for example list size + string size is limited by your architecture and can be 32 bit or 64 bit maximums.
For this reason, can the below keywords be changed to Long or BigInteger?

  • minLength/maxLength
  • minProperties/maxProperties
  • minItems/maxItems
@spacether spacether changed the title [REQ] request to adjust storage of numeric constraints [REQ] request to adjust storage of numeric json schema constraints Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant