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

v22 docs confusing about DQL and GraphQL variables passed in #547

Open
damonfeldman opened this issue Mar 31, 2023 · 0 comments
Open

v22 docs confusing about DQL and GraphQL variables passed in #547

damonfeldman opened this issue Mar 31, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@damonfeldman
Copy link
Contributor

damonfeldman commented Mar 31, 2023

The Query Variable page (https://dgraph.io/docs/query-language/query-variables/) is confusing in how it differs from Value Variables. I was expecting "Query Variables" to describe how to send an external value into the query using $varname.

After some time I realized "query variables" are actually variables who's use is to store UIDs (objects) and value variables store primitive values (indexed by UID). So you can call val(valueVar) but only call uid(queryVar). "Query Variable" does not seem to be a widely used term elsewhere.

Also there is a "GraphQL Variable" page within the DQL section, which defines is what I expected. But the term "GraphQL variable" is not well-defined, and I think this should be renamed to "Using variables in DQL" with a note that it is basically the same as GraphQL. This is my best guess for the intent of the "GraphQL Variables" page inside the DQL section.

Three elements should be specifically called out:

  1. Is the sending of the variables the same. I.e. in HTTP or gRPC calls to a DQL endpoint, is the same header, encoding etc. used to specify the variables.
  2. Is the declaration of the variables in the query the same? E.g. a formal parameter list with $variable values.
  3. Is the use of the variables the same? E.g. can you use a declared "$variable" wherever a constant or list is valid?
@damonfeldman damonfeldman added the bug Something isn't working label Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant