-
-
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 property added twice to generated JSON: add support for JsonType.As.EXISTING_PROPERTY
#528
Comments
I think there's another issue opened for this. And yes, it is a bug; and also yes, |
JsonType.As.EXISTING_PROPERTY
I also have a need for JsonType.As.EXISTING_PROPERTY to be implemented. I have done this locally, but would like to know how extensive the test cases need to be before I commit to my fork and issue a pull request. Thanks! |
@fleebytes I think a fork & Pull Request is a good way -- we can help with tweaks, and testing. Usually the first thing is to ensure that none of existing tests start failing, but here it may not help a lot, given that For what it is worth, this is a REALLY important feature, and should go in 2.5. I have been hoping to find time to tackle it myself, after resolving other somewhat related problems (wrt visibility of type info). |
…OPERTY serialization and deserialization
@cowtowncoder I've taken a stab at writing the tests. There is round-trip serialization for three scenarios: (1) sub-classes each have the type property (no reference in base class), (2) sub-classes each have getType() method implemented but no explicit property, and (3) base class has abstract getType() method that enforces sub-classes to have that method. All three of them have working round trip test cases. Let me know if there is anything else I can do to help complete adding this feature to jackson-databind. Thanks! |
…tween inclusion mechanism EXISTING_PROPERTY and PROPERTY via inheritance.
Fixes #528 - Add support for As.EXISTING_PROPERTY inclusion mechanism
Hi Can you tell me in which version this fix has been released ? |
Original fix was in 2.5.0. There is one related fix (#222) that will be included in 2.6.0 (and 2.6.0-rc3 if such is released before 2.6.0 final). |
Toteutustyyppi was not serialized in JSON response when creating/updating a koulutus. Need to update Jackson to a newer version, because there was a bug with previous version related to @JsonTypeInfo serialization. See more: FasterXML/jackson-databind#528
Hi,
I have an abstract super class annotated with
where
type
is an existing property of the class.The full class hierarchy looks like this:
Now when a SubClass of this class gets serialised, the
type
is added twice to the generated JSON. E.g. the JSON for a SubClassB would look like this:For the most part this does not seem to be an issue, but some clients (e.g. Postman) refuse this as
Malformed JSON
.I know I could add e.g.
@JsonTypeId
or@JsonIgnore
but in that case,type
will not be included in generated JSON when using aList<AbstractSuperClass>
, which is what I definitely need.I assume that
include = JsonTypeInfo.As.EXISTING_PROPERTY
would solve my problem but this results injava.lang.IllegalStateException: Do not know how to construct standard type serializer for inclusion type: EXISTING_PROPERTY
The text was updated successfully, but these errors were encountered: