Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Better experience for GraphQL requests #42

Open
bayne opened this issue Feb 15, 2020 · 0 comments
Open

Better experience for GraphQL requests #42

bayne opened this issue Feb 15, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@bayne
Copy link
Owner

bayne commented Feb 15, 2020

Attempting to create requests for a GraphQL server leads to some nasty syntax:
#9 (comment)

Current plan for a response body generator:

POST {{base_url}}/graphql

< {%
  var query = '{\
    leftComparison: hero(episode: EMPIRE) {\
      ...comparisonFields\
    }\
    rightComparison: hero(episode: JEDI) {\
      ...comparisonFields\
    }\
    }\
    fragment comparisonFields on Character {\
      name\
      appearsIn\
      friends {\
        name\
      }\
  }';

  return {
    "query": query
  };
%}

> {% console.log(response); %}

Note the symmetry of the syntax:

  • < {% ... %} for a request body generator
  • > {% ... %} for a response handler (existing)
@bayne bayne added the enhancement New feature or request label Feb 15, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant