johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Louis MONTEIRO <jeano...@gmail.com>
Subject Re: Arrays / Lists elements polymorphic support
Date Mon, 23 Apr 2018 16:46:29 GMT
That works for me.
I agree that having that extension into a specific module is the way to go

Le lun. 23 avr. 2018 à 18:44, Romain Manni-Bucau <rmannibucau@gmail.com> a
écrit :

> Maybe raise a spec issue since we tend to be jsonb driven now. Would be
> great to not have a custom api for the id mapping.
>
> In the mean time we can push a jsonb-extra with that impl
>
> Le 23 avr. 2018 18:39, "Jean-Louis MONTEIRO" <jeanouii@gmail.com> a écrit
> :
>
> > Hey Roberto,
> >
> > I think that would be a great feature.
> > Already had this case in the past and looks like Jackson and Gson already
> > have it.
> >
> > Gson subtypes on adapters.
> > https://github.com/google/gson/blob/master/extras/src/
> > main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java
> >
> >
> > Jackson annotations with different strategies
> > https://github.com/FasterXML/jackson-docs/wiki/
> > JacksonPolymorphicDeserialization
> >
> > We should consider adding this feature I believe.
> >
> >
> > Le mer. 18 avr. 2018 à 19:42, Roberto Cortez <radcortez@yahoo.com.invalid
> >
> > a écrit :
> >
> > >  Hi Romain,
> > > Thanks for the quick response.
> > > I'll have a look,
> > > Cheers,Roberto
> > >     On Wednesday, April 18, 2018, 6:35:32 PM GMT+1, Romain Manni-Bucau
> <
> > > rmannibucau@gmail.com> wrote:
> > >
> > >  Hi Roberto
> > >
> > > Yes, an adapter is the way to go using our mapper or jsonb.
> > >
> > > There should be an "animal" test showing how to do that. Just dont
> forget
> > > to use class aliases or a whitelist logic to not open a backdoor.
> > >
> > > Since the model doesnt match the java model im not a fan of that
> feature
> > > being built out of the box. In xml it is more natural but in json you
> can
> > > do it without breaking the model. For me it means the model is broken
> and
> > > must not be used as an input.
> > >
> > > Le 18 avr. 2018 19:31, "Roberto Cortez" <radcortez@yahoo.com.invalid>
> a
> > > écrit :
> > >
> > > > Hi guys,
> > > > I'm trying to serialize a list of elements of multiple types and then
> > > > deserialize it again. It does require to somehow include the type in
> > the
> > > > serialization result to know to which type we should map to
> > deserialize.
> > > I
> > > > think this could possible be done with an Adapter and playing with
> the
> > > > JsonArray.
> > > > I was just wondering if there any kind of out of the box support for
> > > this.
> > > > It doesn't seem so, at least I was not able to find.
> > > > Jackson for instance, includes a set of annotations that allow you to
> > do
> > > > exactly this, without any extra / custom code.
> > > > Any thoughts?
> > > > Thank you.
> > > > Cheers,Roberto
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message