-
-
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
Deserializing nested polymorphic types does not work #2000
Comments
This is not supported usage: |
What are issues in supporting this feature? We need to deserialize a Type by "category" property, an then a SubType to deserialize by another property "status". |
@raderio It is not meant to work that way. Basic premise is that wrt type handling declared base type is used; never subtypes. On serialization it would be theoretically possible to change that, but on deserialization I am not sure how it could work. So it is safe to say that what you are attempting to do will not work with standard |
First read Is it possible to support this scenario? |
@raderio No. This is not supported by the design at all. As I said, if you want something like that, you will have to implement it without using existing polymorphic type handling. |
Yes I can implement such deserializer, but I also use a library(https://github.com/springfox/springfox) that generate Swagger documentation based on Jackson annotations, so if Jackson not support this, the library also will not support
What are impediments to change the design? It will not break any code. |
This also will be supported by other tools Redocly/redoc#210 |
That is too bad since it is once again a construct difficult and inefficient to support. There are many JSON standards that build things in a way that does not considered feasibility of implement or support. I will not continue discussion on this issue: if you are interested in learning why it is difficult to implement I suggest you try to implement it. Support for polymorphic types is rather complicated to begin with, when databinding is incremental. Adding multiple levels of indirection will significantly complicate things, which in itself is unfortunate, but becomes impractical when couple with all other functionality supported (with pluggable modular handles, object identity handling, unwrapping, builders and all the jazz). |
This really will simplify the REST API, instead of having multiple endpoints for related things, will have just one endpoint |
@cowtowncoder can you please give me a starting point in the code? So, I want to try to implement it BTW, https://github.com/cbeust/klaxon library supports this |
@raderio I am sure other libraries can implement it. I have no interest in implementing, or using my limited time on documenting why I think it is not worth the hassle. If you truly want to figure it out that's fine of course. It may be fun exercise. One starting point would be figuring out how polymorphic deserialization actually works. |
@raderio Hi. I know it's been a couple of time. But I was facing the same issue and I developed a custom |
Using jackson 2.9.5
The text was updated successfully, but these errors were encountered: