Js-graphql-intellij-plugin: template string ${variable} in gql template strings

Created on 29 Nov 2016  路  6Comments  路  Source: jimkyndemeyer/js-graphql-intellij-plugin

Hi,

we get a Syntax Error [0] when we try the following example [1] from https://github.com/apollostack/graphql-fragments

Are there any plan to supprt template string variables within gql queries?

Thanks,
Fabian

[0]

Error:(25, 3) Syntax Error GraphQL (25:3) Unexpected Name "__typename"

[1]

import gql from 'graphql-tag';
const query = gql`
  query {
    field {
      ...MyFragmentName
    }
  }
  ${fragment}
`;

Most helpful comment

All 6 comments

Hi Mischi.

Thanks for using the plugin.

There is support for gql fragments as described in http://dev.apollodata.com/core/fragments.html

Will that work for you?

Yes, that worked perfectly in the past 馃憤. But if i understand https://github.com/apollostack/graphql-fragments correctly, they recommend the use of graphql-anwhere and to inline fragments directly with template string variables. So i'm wondering if that's something we can add support for too?

CC: @tmeasday

@stubailo Can you clarify whether this use case is the recommend approach for fragments going forward?

@jimkyndemeyer Updated guides and GitHunt example recommend this approach.

@jimkyndemeyer that's right - basically we didn't want people to have to use an additional function, and the interpolation approach allowed us to essentially pass "arguments" into gql.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vjpr picture vjpr  路  4Comments

tkvlnk picture tkvlnk  路  3Comments

jamiter picture jamiter  路  3Comments

Globegitter picture Globegitter  路  5Comments

BerndWessels picture BerndWessels  路  5Comments