-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Problem with enums, @JsonProperty
, numbers-as-Strings property name
#1626
Comments
The problem may lay deeper.
Here is JsonResponseEnvelope itself
|
I afraid we need to fully reproduce my situation. So just in case i put all needed info here.
Full enum:
Object that uses this enum (i think we can safely replace ShippingProviders and ShippingCoverage with int values):
Example respose:
|
I also wrote a test for you and it fails.
|
@YuriIvanov Ohhh.... Actually, I did not look carefully at your input. The problem here is actually quite simple, from implementation perspective: values come as numbers, so they are expected to be indexes. If value is This is not something that would be easy to change as there isn't anything to reliably distinguish between the options (that is: when a number is seen to prevent use as index, look for explicit name). I think you have 2 main choices here:
Doing (2) should be relatively simple, even while still supporting use of |
Thanks for help. I have implemented this workaround (boilerplate but understandable and working):
When I will have more time i'll investigate second option with introspection. |
@YuriIvanov Yes I believe this is the way to do it at this point. You should be able to simplify the code, however, by iterating over |
Not 100% sure what could be done here; will close, may be re-filed with specific feature request, improvement idea. |
(reported on mailing list)
It appears that use of naming like:
does not work as expected, possibly due to number auto-detection for Enum deserialization.
The text was updated successfully, but these errors were encountered: