Closed mwolff-fn closed 8 months ago
Hi! Thanks for feedback. I believe that exposing FQN in APIs are not popular practice in the APIs. Looking at the implementation it would require a lot of changes in the serialiser as there is no easy way to fetch child class names. I do not think that adding such feature would be possible at this point.
Best, Marcin.
Ok, thanks for looking into it anyway :-)
When I want to deserialize some JSON into a class which contains child object that have an abstract class or interface as a typehint, I need to set the Discriminator annotation for the abstract class, providing a map that associates the value of a given property with the concrete class name, like so:
As you can see, in my case, the property "type" in the JSON data already contains the fully qualified name of the concrete class. Yet, I still have to define the map array in the Discriminator annoation - otherwise, it would throw an error ("InvalidMetadataException: The discriminator map cannot be empty").
This seems very redundant. Would you consider a feature like passing "map: false" or "literal: true" to disable manual mapping and using the value of the given property as the literal class name?