Questions tagged [graphql-tag]

GraphQL Tag is a JavaScript template literal tag that parses GraphQL queries.

GraphQL Tag or gql is a open source template literal tag you can use to concisely write a GraphQL query that is parsed into the standard GraphQL AST.

Documentation

71 questions
4
votes
3 answers

Apollo-react compose query is not a function

I am trying to compose a react component with the following queries, but the query getMe is always an object and then I get TypeError: this.props.getMe is not a function. If I change it to a mutation then it all works. If I use the query in the…
Brenwell
  • 767
  • 10
  • 24
3
votes
1 answer

String interpolation in gql tag

I've already posted this as an issue in the graphql-tag repositoy but I'll post it here as I hope somebody on here has a workable solution. What am I trying to do? I'd like to dynamically define typedefs of local types based on props passed to my…
Niklas Moss
  • 61
  • 1
  • 7
3
votes
0 answers

Apollo codegen duplicating nested fragment imports

I'm using reusable fragments in .gql files but the resulting query will declare the fragments multiple times when using codegen. A simplified example: # ImagesInfos.gql fragment ImageInfos { url alt } #Post.gql #import…
rayfranco
  • 3,630
  • 3
  • 26
  • 38
3
votes
1 answer

Webpack loader for graphql-tag not loading in Angular 8

I have been following this guide https://www.apollographql.com/docs/angular/recipes/webpack/ but I am getting this error when I execute ng serve: ERROR in ./src/app/shared/queries.graphql 1:6 Module parse failed: Unexpected token (1:6) You may…
Ashkan Hovold
  • 898
  • 2
  • 13
  • 28
3
votes
1 answer

Import graphql query .gql file into plain Javascript and run an axios call

I have a simple axios call that I want to make to fetch some graphql data. I also have a .gql file that I want to import to use as a query: pages.gql { entries(section: [pages]) { uri slug } } Now in my other file I want to import…
Merc
  • 4,241
  • 8
  • 52
  • 81
3
votes
1 answer

Prisma Connection WhereInput for Array of enum values?

Doing this query { postsConnection(where: { status: PUBLISHED }) { aggregate { count } edges { cursor node { id slug } } } } gives me postsConnection of published posts. The Post…
3
votes
1 answer

graphql-tag/loader: Module build failed with GraphQLError: Syntax Error

Weird issue I am facing. Using Vue-CLI3 npm run serve. Have the following config: // vue.config.js module.exports = { chainWebpack: config => { // GraphQL Loader config.module .rule('graphql') .test(/\.graphql$/) …
Daniel da Rocha
  • 887
  • 13
  • 26
3
votes
0 answers

Invalid variable referenced in @include directive

I'll duplicate my issue here hoping that someone may give me a hint to where I'm going wrong. Here's the schema on GraphCool: type Reservation implements Node { createdAt: DateTime! id: ID!@isUnique updatedAt: DateTime! user: User…
Sammy
  • 3,395
  • 7
  • 49
  • 95
2
votes
1 answer

What is the difference between gql and buildSchema?

What is the difference between graphql-js buildSchema and the apollo-server gql? They appear to do a very similar job.
spinkus
  • 7,694
  • 4
  • 38
  • 62
2
votes
0 answers

Typings for multiple graphql query imports via graphql-tag/loader

I have a component which imports a query from a graphql file via the graphql-tag/loader of webpack. query testQuery { test } query test2Query { test } import { testQuery, test2Query } from './test.graphql' I'm now trying to declare a general…
Nicolai Schmid
  • 1,022
  • 1
  • 14
  • 29
2
votes
0 answers

Appsync Subscriptions not working , but queries and mutations are working fine

I am building a simple React Native app. to test AppSync APIs. I am able to do queries, mutations ; but subscriptions don't seem to work. I am trying this out on an Android Emulator. Here's how i am building my client and creating a subscription. …
nikel
  • 3,402
  • 11
  • 45
  • 71
2
votes
1 answer

Any notable difference between string interpolations and fragments?

Take the following queries: import gql from "graphql-tag"; const FOO = gql` { foo (id: "12") { id qux { id } } } const BAR = gql` { BAR (id: "12") { id qux { id } } } It would be nice if we could keep…
Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114
2
votes
0 answers

Error in Vue graphql: Missing query attribute on result

I want to have multiple queries in one network request. I have put all my queries in vue Apollo but I get this error when data revived(I will get the data in network tab but I cant access it!) error: vue-apollo.esm.js?522d:842 Missing query…
Amir Meimari
  • 520
  • 5
  • 20
2
votes
1 answer

Apollo Refetch Query Component with new Variables

So I have this Apollo Query Component like this: {({ loading,…
Saigo
  • 53
  • 1
  • 6
2
votes
1 answer

GraphQL Union within Union

Below is a query which is conceptually what I'm looking for. But, I cannot figure out how to implement... or even if it's possible. query getMedia($id: ID!) { media(id: $id) { __typename title ... on Movie { fps } ...…
Jesse Lee
  • 1,291
  • 1
  • 8
  • 20