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
Description
This was already closed in #2931, but I would like you to reconsider.
Since it's quite limiting not being able to use Doctrine's Inheritance mapping and OpenAPI has nowadays quite good polymorphism support thanks to discriminator, oneOf, anyOf etc, I believe it makes sense to reconsider support of this. At beginning, I think most people would be fine if APIP at least allowed serialization/deserialization of properties in subclasses. Schema generator could be adjusted later to generate things like this
Main issue I would like to solve is that serializer does not see properties from subclasses. After further debugging I found that PropertyNameCollectionFactory and PropertyMetadataFactory are responsible. However, these factories only accept $resourceClassand not an actual class that Serializer is serializing/deserializing, hence it's not possible to simply add own implementation of these factories.
Similarly, deserialization should accept (and write to) these properties
Further context
Currently, I have added support for this in application I'm maintaining by enabling allow_extra_attributes and implementing custom normalizer:
Even OpenAPI schema is adjusted thanks to implementing own OpenApiFactory which generates definitions for subclasses, then linking to them from resource like so
Description
This was already closed in #2931, but I would like you to reconsider.
Since it's quite limiting not being able to use Doctrine's Inheritance mapping and OpenAPI has nowadays quite good polymorphism support thanks to
discriminator
,oneOf
,anyOf
etc, I believe it makes sense to reconsider support of this. At beginning, I think most people would be fine if APIP at least allowed serialization/deserialization of properties in subclasses. Schema generator could be adjusted later to generate things like thisMain issue I would like to solve is that serializer does not see properties from subclasses. After further debugging I found that
PropertyNameCollectionFactory
andPropertyMetadataFactory
are responsible. However, these factories only accept$resourceClass
and not an actual class that Serializer is serializing/deserializing, hence it's not possible to simply add own implementation of these factories.Example
Here, I expect serialization will result in
or
Similarly, deserialization should accept (and write to) these properties
Further context
Currently, I have added support for this in application I'm maintaining by enabling
allow_extra_attributes
and implementing custom normalizer:Even OpenAPI schema is adjusted thanks to implementing own OpenApiFactory which generates definitions for subclasses, then linking to them from resource like so
The text was updated successfully, but these errors were encountered: