-
Notifications
You must be signed in to change notification settings - Fork 8
Add discriminator support #54
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
20c457b to
0e34b15
Compare
dbu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thanks a lot for implementing this feature!
i have one small detail, apart from that this looks good to merge to me. as we don't have extensive documentation, i don't think there is a place where this should be documented. however, please add a note to the changelog.
With this addition, the class metadata now also holds the discriminator information (if any exists).
This class was only used in the `Parser` class, but even in there nothing was really done with it, so we can remove it.
With this change we also allow the following additional primitive types: `false`, `true`, `null`.
With this change one can now use primitive union types which will be properly (de-)serialized when using the `ReflectionParser`.
One can now use this attribute to define more complex union types.
0e34b15 to
9b7f781
Compare
9b7f781 to
15aa305
Compare
Added a changelog entry now, I somehow keep forgetting this, sorry 😞 |
| $type = $type->getLeafType(); | ||
| } | ||
| if ($type instanceof PropertyTypeClass) { | ||
| $this->parseModel($type->getClassName(), $context->push($property), $registry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the context class, it looks like it was made to provide the reference to where the error happened in case something does not work. but it is completely unused, so i agree we can drop it.
|
do you need further tests or shall i tag a release? |
Fine for me if you tag a new release now, thanks 🙇 |
Took a bit longer than initially anticipated to get this done, but with this change (union) discriminators are now parsed into proper meta data which can then be used to create the corresponding (de-)serialize classes in
liip-serializer.Its probably worth to mention that I tried to mimic the behaviour of what JMS is doing for certain cases (like having multiple primitive union types).