-
Notifications
You must be signed in to change notification settings - Fork 137
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
Long data type changed to integer #160
Comments
My recollection may be wrong, but I thought JSON Schema didn't support all Java native types? saasquatch/json-schema-inferrer#17 and from there: https://json-schema.org/understanding-json-schema/reference/type If so, choices are |
I guess I'm trying to do more with the schema than it's designed for. I'd like to generate a JsonSchema from an object and then be able to exactly describe the original object from that schema. But if the JsonSchema spec uses a single type to represent multiple Java types, then it is losing some of the source information so you really can't do the reverse conversion. Based on a suggestion I found somewhere, annotations offer a potential workaround. If my source object is defined with an annotation like this:
then the output includes the description:
So while this is not a general solution, it would help in cases where I have control over the original class. |
Yes, I understand why it would be useful, just pointing out limitations. I probably should also mention that this module is deprecated and no longer actively developed -- there are better, maintained alternatives in existence. |
This was mentioned in an older issue but I want to bring it up again: the JsonSchema generator does not differentiate between longs and ints. Both types end up as "integer" in the schema. It is said that when data is retrieved, it will be treated as long or int based on its size and that may be so. But when one examines the JsonSchema object, everything is "integer". You can see this from the code shown in the Readme for this package. Here is a very simple demonstration of it; generating a schema from an object with an
int
, along
, and aLong
simply represents them all as "integer".Is there any way to preserve the original type information for the properties?
The text was updated successfully, but these errors were encountered: