-
-
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
@JsonTypeInfo with As.EXTERNAL_PROPERTY doesn't work if external type property is referenced more than once #291
Comments
Hmmh. This isn't actually a use case I was familiar with (or design to support)... but ok, if it can be supported, all the better. :) |
@cowtowncoder is this a supported use case now? |
@dvdh No changes have been made, and it is unlikely I will have time to work on this in near future. So no. |
Thanks @cowtowncoder |
As suggested by @Starkom i have done the changes , but two tests are failing after those changes. Failed tests: Any suggestions @cowtowncoder for fixing these TESTS |
@ABHINAVKR you would need bit more context (stack traces). And also know which Jackson versions they are for. |
Seems fixable; ideally would avoid use of |
Finally found time to fix this; also improved testing a bit to cover other cases (differently ordered input, with and without additional |
Test model:
Test JSON:
Stacktrace:
The reason:
com.fasterxml.jackson.databind.deser.impl.ExternalTypeHandler:262
addExternal() method is called in property loop, but _nameToPropertyIndex is Map, so addExternal() can't be called twice correctly for property "type".
So _nameToPropertyIndex doesn't contain type=0: {field1=1, type=1, field2=0}
I think type of _nameToPropertyIndex should be changed from HashMap[String, Integer] to HashMap[String, Set[Integer]]. It occurs several changes in ExternalTypeHandler. I've patched jar locally and it solved my problem.
The text was updated successfully, but these errors were encountered: