-
Notifications
You must be signed in to change notification settings - Fork 10
Add (union) discriminator support #47
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
Conversation
cbca271 to
f9c0720
Compare
|
very cool, thanks! i will do php 8.5 and symfony 8 support on the 2.x branch, then add a 3.x branch where we should merge your changes. before we tag the 3.0 release, we should look at the deprecation and do the BC break to cleanup. |
|
i tagged 2.6.2 and now created the 3.x branch. i changed the target, but github reports conflicts. i did apply the cs fixer in the 2.x version, so that is probably not needed anymore. and i added to the changelog - i added the 2.x and 3.x headings so that future changes in 2.x do not conflict with 3.x anymore. can you please rebase this on the 3.x branch and solve the conflicts? |
f9c0720 to
0afd0a6
Compare
I removed the deprecation warning and adjusted the code around it. Other than that I think we are good here, couldn't find any other deprecations.
I resolved the conflicts now, thanks for taking care of the new branch and the cs fixes! |
The `PropertyTypeArray` class was removed in favor the `PropertyTypeIterable` one.
With this change, the `Discriminator` attribute from JMS is now fully supported.
With this change, it is now possible to use primitive union types (like `public int|bool $property`) or the more complex `#[UnionDiscriminator]` attribute from JMS.
Passing a `string` for the `$formats` argument when rendering the assignment of a `DateTime` class was deprecated in `2.x` and thus got for `3.x`.
Those are the more critical BC breaks, so its worth mentioning them here as well. For all further changes, the `CHANGELOG.md` from the `metadata-parser` is also referenced.
0afd0a6 to
e2521f7
Compare
|
thanks! i tweaked the changelog entry a bit and merged on the CLI. thanks a lot for the contribution! i tagged https://github.com/liip/serializer/releases/tag/3.0.0 now |
With these changes it is now possible to use (union) discriminators. A few examples which are supported might look like this 👇
Examples
Discriminators
Union Discriminators
To support this, it is necessary to use the latest changes from the
2.xbranch from themetadata-parser(including the changes necessary for union discriminators via liip/metadata-parser#54).So ideally this change should go into a new
3.xbranch where we then release a new major version, as doing a minor release will potentially break peoples implementation since a few things changed in the parse library.Side note: There is a temporary commit in here which uses the changes from the other PR in the
metadata-parserrepo. It will be removed/adjusted, once merged and a new version exists.