Skip to content
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

fix (graphql): disallowing field names with as #6579

Merged
merged 4 commits into from
Sep 29, 2020
Merged

Conversation

aman-bansal
Copy link
Contributor

@aman-bansal aman-bansal commented Sep 28, 2020

This is related to GRAPHQL-564. as is Dgraph reserved keyword. It's being used by DQL to identify variables. This PR is to restrict the naming for fields with the name as.

Though interesting things have been found while working on this. There is a difference in how we check as keyword while query parsing. For example, in normal DQL queries, the parser uses this strings.ToLower(peekIt[0].Val) == "as" (dgraph/gql/parser.go:2552) this means as, As, AS, aS all are the same.

But while parsing facets, its been treated like this !trySkipItemVal(it, "as") (dgraph/gql/parser.go:1984).

Though having a different use case, keyword significance is the same. Would love to hear thoughts about these implementations.


This change is Reviewable

Docs Preview: Dgraph Preview

@github-actions github-actions bot added area/documentation Documentation related issues. area/graphql Issues related to GraphQL support on Dgraph. labels Sep 28, 2020
Copy link
Contributor

@abhimanyusinghgaur abhimanyusinghgaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 0 of 3 files reviewed, all discussions resolved (waiting on @danielmai, @MichaelJCompton, and @pawanrawal)

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @danielmai and @MichaelJCompton)

@aman-bansal aman-bansal merged commit 587c45b into master Sep 29, 2020
@aman-bansal aman-bansal deleted the aman/fix_as_keyword branch December 15, 2020 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Documentation related issues. area/graphql Issues related to GraphQL support on Dgraph.
Development

Successfully merging this pull request may close these issues.

None yet

3 participants