-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 @type directive to enforce type constraints. #3003
Conversation
Predicates in queries can now have a @type predicate that enforces that all the given results are of the given type. For now this is just the equivalent of filtering using the existing type function but later more checks will be added.
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.
Wao! I wouldn't have imagined this would be such a simple change for such useful functionality.
One comment. Address that before merging.
Reviewed 3 of 4 files at r1, 1 of 1 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @golangcibot)
gql/parser.go, line 2148 at r1 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
Error return value of
parseType
is not checked (fromerrcheck
)
if err := ..; err != nil { return err }
please.
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @golangcibot)
gql/parser.go, line 2148 at r1 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
if err := ..; err != nil { return err }
please.
Done. I had fixed it already but I guess the comment is not resolved automatically.
gql/parser.go, line 2151 at r2 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
File is not
goimports
-ed (fromgoimports
)
Done.
Predicates in queries can now have a @type predicate that enforces that all the given results are of the given type. For now this is just the equivalent of filtering using the existing type function but later more checks will be added.
Predicates in queries can now have a @type predicate that enforces
that all the given results are of the given type. For now this is
just the equivalent of filtering using the existing type function but
later more checks will be added.
This change is