You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to exclude a field from the serialized output (it causes a cyclic serialization issue -> stack overflow). I cannot (ab)use a custom mapper, it's out of my control in that case (in a dependency).
This seems to be working with deftype but not defrecord:
(deftypeD [a])
(deftypeT [^{com.fasterxml.jackson.annotation.JsonIgnore true} a])
(defrecordR [^{com.fasterxml.jackson.annotation.JsonIgnore true} a])
;; just so that it doesn't blow up on the deftype
(defmapper
(doto (object-mapper {})
(.configure com.fasterxml.jackson.databind.SerializationFeature/FAIL_ON_EMPTY_BEANS false)))
(write-value-as-string (D.1) mapper) -> {"a": 1}
(write-value-as-string (T.1) mapper) -> {}
(write-value-as-string (R.1) mapper) -> {"a": 1}
I would expect it to work the same way for records.
I guess this might have to do with the custom serializer for Maps in jsonista.
The text was updated successfully, but these errors were encountered:
I guess the record gets interpreted as a java.util.Map and serialized via a MapSerializer which doesn't then interpret annotations since a java.util.Map isn't a POJO.
I am trying to exclude a field from the serialized output (it causes a cyclic serialization issue -> stack overflow). I cannot (ab)use a custom mapper, it's out of my control in that case (in a dependency).
This seems to be working with deftype but not defrecord:
I would expect it to work the same way for records.
I guess this might have to do with the custom serializer for Maps in jsonista.
The text was updated successfully, but these errors were encountered: