Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance overriding ? #639

Closed
smtlab opened this issue Mar 7, 2018 · 2 comments
Closed

Inheritance overriding ? #639

smtlab opened this issue Mar 7, 2018 · 2 comments

Comments

@smtlab
Copy link

smtlab commented Mar 7, 2018

Hi Guys,

Is there any plan on implementing overriding of serialization meta-data by inheritance.
Currently, we are able to override by changing the metadata directory as described
in below link
https://jmsyst.com/bundles/JMSSerializerBundle/master/configuration#overriding-third-party-metadata

But is there a way to override the metadata similar to how Symfony validation and doctrine mapping can be overridden just by overriding specific properties needed?
Reference: https://symfony.com/doc/current/bundles/override.html
Symfony supports creating a friendly configuration which can be easily overridden across bundles
Reference: https://symfony.com/doc/current/bundles/configuration.html
If this is possible I am ready to contribute wherever needed :)

Thanks

@goetas
Copy link
Collaborator

goetas commented Mar 7, 2018

Not really.

The current override strategy working well (even if it has its own trade offs).

Overriding specific properties and keeping the other brings various problems:

  • dependency with the parent definitions
  • how to remove a definition defined in a previous metadata file?

If you have better suggestions I'm ready to re-open the ticket, but closing for now.

@smtlab
Copy link
Author

smtlab commented Mar 8, 2018

Exactly,

This is what is written in Symfony documentation regarding validation overriding.

Symfony loads all validation configuration files from every bundle and combines them into one validation metadata tree. This means you are able to add new constraints to a property, but you cannot override them.

Similarly, At least we should be able to add a new group to previously defined properties but not changing any of the previously defined groups and definitions (not overriding here but adding new groups and fields)

Currently, I need to copy all metadata files associated with third party bundles to the custom directory just to add a single field/group in a single metadata file.

Whats your thought?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants