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

Support wrapper variables & caching #1

Open
3 tasks
mattkrick opened this issue Jul 9, 2021 · 0 comments
Open
3 tasks

Support wrapper variables & caching #1

mattkrick opened this issue Jul 9, 2021 · 0 comments

Comments

@mattkrick
Copy link
Member

The new wrapper variable is a string & if you want to inject variables into it, you just do it the JS way with backticks.
A better way would be to accept wrapper, wrapperVars.
Then, we could cache the wrapper AST & reuse that a thousand times instead of always having to parse & print.

AC

  • githubRequest accepts wrapperVars
  • if wrapperVars is present, then variableValue definitions are created for each variable, using the same name.
  • a check for duplicate variable names is performed & the names are changed (e.g. team, team1, team2, etc.) until a unique name is found

e.g.

Here's how we do it today

repositories(name: "nest-graphql-endpoint", owner: "parabolinc") {
  id
}

becomes

query($name: String!, $owner: String!) {
  repositories(name: $name, owner: $owner) {
    id
  }
}

+

{name, owner}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant