-
Notifications
You must be signed in to change notification settings - Fork 10
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
Define jsonUnknown trait #180
Conversation
124d80f
to
c6b6d1a
Compare
I made the |
Should we update the Edit: I made the update. I think it makes sense and makes writing JSON encoder more straightforward |
|
||
/// Retain unknown fields of a containing structure in this document member | ||
@trait( | ||
selector: "structure > member :test(> map > member > document)" |
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.
So, to answer your question, I'd like for this to be eventually extended to allow for annotating union members, to allow for capturing unknown values.
As long as we can amend the selector to also cater to that use-case in the future, I'm fine with it.
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.
Once we want to extend this trait to support unions, we can update the selector to
:is(structure > member :test(> map > member > document), union > member :test(> document))
This will allow the trait to be applied to a union member targeting a Document
.
@benoitlouy the code looks good to me. All that's left I think is adding documentation here to describe the expected behaviour associated to the trait when the protocols support it. |
@lewisjkl I'm happy with this. Feel free to review/merge/release |
Implement support for `jsonUnknown` trait defined in disneystreaming/alloy#180
This PR is meant to replace #135