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

Dynamic GrapQL Query Fields #5635

Closed
pungggi opened this issue May 31, 2018 · 1 comment
Closed

Dynamic GrapQL Query Fields #5635

pungggi opened this issue May 31, 2018 · 1 comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@pungggi
Copy link

pungggi commented May 31, 2018

I searched about dynamic queries but did not found exactly what I am looking for, so my question:

Is it possible to pass Query Variables to be used as Fields?

Let me explain with an example:

query SpecificationsTemplateQuery($categoryName: String, $fields: datasheet_2) {
  allSpecificationsYaml(filter: {categoryName: {eq: $categoryName}}) {
    edges {
      node {
        title
        datasheet {
          $fields
        }
      }
    }
  }
}

This is similar idea> apollographql/react-apollo#330 (comment)

@jquense
Copy link
Contributor

jquense commented May 31, 2018

unfortunately no, there is no way to do this. GraphQL variables don't work like that, we'de need to see it added to the spec :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants