Not that I can see. I've read this page many times. What would be more helpful, and something I could not find is an example of encoding a property that is an array of an interface. The PolymorphicSerializer doc page only shows how to deal with a list of class, not a list of an interface. List of class is working for me, not list of interface, at least not yet.
d
diesieben07
02/09/2021, 4:03 PM
An interface itself cannot be serialized, you need to specify list of possible subclasses as seen in the docs for PolymorphicSerializer
➕ 1
p
pajatopmr
02/09/2021, 4:06 PM
Hmmm. You might be right. I'll mull that one for a bit ... is this a limitation for collections? I can certainly serialize interfaces that are not collections as long as the implementations are registered using a polymorphic serializer like JsonContentPolymorphicSerializer. Use that all the time. This is my first attempt with a collection of an interface.
pajatopmr
02/10/2021, 5:19 AM
It turns out you can serialize a list of interfaces, as I was trying to do. The solution comes from @Sergey Shanshin on Github and is hugely appreciated!