-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add EnsureNoExportedKindName check #8
Conversation
The Though, looking now, i realize this is awkward because for sch := lin.First(); sch != nil; sch = sch.Successor() {
if err := validation.EnsureNoExportedKindName(sch.Underlying()); err == nil {
return err
}
} Hmmm. Maybe that means it's best done here, instead. That feels to me like it's too late...but for now it's probably the most convenient spot. |
That should be probably fine, as I search for the lineage node first here. And then search for the keyword in the lineage node elements. |
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.
This approach looks good to me 👍🏻
Next question is where we hook in to apply it!
As we discussed in the chat, put it here in Grafana https://github.com/grafana/grafana/pull/66516/files |
i think this should be good to mark as ready so that we can get it merged and progress on the other PR |
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.
I really like this approach, very clean and reusable! Great! 🚀
PS: Thinking out loud -- Could we add a unit test? It may also help understanding how to use the function from the consumer perspective.
IMO definitely worth doing. It'll necessarily also be tested on our corpus once we have one, but it deserves a smaller unit test too |
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.
LGTM, too!
Issue: in some cases using
Kind
as a schema field name leads to generatingKind
type in Go that shadows existing type in that same package in Grafana.Related to https://github.com/grafana/schematization-and-as-code-project/issues/31