-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Reimplement goTag using FieldMutateHook #1682
Conversation
This change does not change the logic of goTag, merely reimplements it using a FieldMutateHook and sets it as the default FieldMutateHook for the modelgen plugin.
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.
Thanks! This looks good to me, but I'm also wondering about fleshing out the hooks documentation a bit to promote this technique a bit more.
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.
Though this was not mentioned in the PR, I assumed that this is the intended behaviour and this has also been implemented in the FieldMutateHook.
Yes it was intended. Apologies for not mentioning in the PR, but felt that that was a sensible fallback.
Thanks for putting this together @tprebs! 🙏 |
I agree. Though there are some examples in the recipes section, the plugins documentation in the reference section has not been updated in a couple of years |
I didn't want to hold up merging this PR so I merged it as it was, but I'm sorry if you weren't finished. If you get the time to polish any documentation or examples up more, I would be very grateful and glad to merge them as a separate PR. |
I'm Happy to create another PR updating the plugin reference documentation and hooks. The thoughts I had were
Is there anything else you can think of that we should add? |
any update? |
This PR reimplements the extraTags/goTag directive as a fieldMutateHook and applies it as the default hook for the modelgen Plugin. This has been done as a request off the back of #1680.
I did notice that some functionality did change during the renaming of
@extraTag
to@goTag
. e.g. if the value argument is not passed the value of the tag is set to the field name. e.g.testField String @goTag( key:"yaml")
sets the tagjson:"testField" yaml:"testField"
. Though this was not mentioned in the PR, I assumed that this is the intended behaviour and this has also been implemented in the FieldMutateHook.I have: