question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[v2] Unknown fragment spread "..."

See original GitHub issue

Hi Jim,

I am getting a warning while try to use fragment in a query (which executes without any error):

image

fragment basicInfo on Bathroom {
  name
  slug
}

query {
  bathrooms (pager: {
    limit: 1,
    type: NUMBER
  }) {
    nodes {
      ...basicInfo
    }
  }
}

But no error return after fetch data:

{
  "data": {
    "bathrooms": {
      "nodes": [
        {
          "name": "1",
          "slug": "1"
        }
      ]
    }
  }
}

Details:

PhpStorm 2019.1 EAP
Build #PS-191.6014.13, built on March 6, 2019
PhpStorm EAP User
Expiration date: April 5, 2019
JRE: 1.8.0_202-release-1483-b31 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 8.1 6.3
---
JS GraphQL: v2.0.0-alpha-8

P.S. Please let me know if you need more details.

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
jimkyndemeyercommented, Dec 2, 2019

@jahudka Have you tried the following:

# operations.graphql
type Query
type Mutation
# other-schema-files.graphql
extend type Query {
 operationName: OperationType
}

extend type Mutation {
 operationName: OperationType
}

This validates according to the GraphQL spec, and should be supported by the plugin.

The same extends approach is used by Apollo to add client fields to the Query type and other types: https://github.com/jimkyndemeyer/graphql-config-examples/blob/master/extend-client-fields-and-directives/client-schema-extensions.js

1reaction
blacksmoke26commented, Sep 4, 2019

@dandrei Yeah that’s the valid issue. When you split your schema into multiple files. This error always popup.

@jimkyndemeyer I am facing the same issue. Do you plan to fix this issue?

P.S. I am using the following library to split my schema into chunks (later combined on runtime): https://github.com/prisma/graphql-import

Read more comments on GitHub >

github_iconTop Results From Across the Web

[v2] Unknown fragment spread "..." · Issue #218 - GitHub
Hi Jim, I am getting a warning while try to use fragment in a query (which executes without any error): fragment basicInfo on...
Read more >
Fragments - Apollo GraphQL Docs
A GraphQL fragment is a piece of logic that can be shared between multiple queries and mutations. ... much like JavaScript spread syntax....
Read more >
Fragments | Relay
Relay guide to rendering fragments. ... Fragments are reusable units in GraphQL that represent a set of data to query from a ......
Read more >
Relay directives | Martin Zlámal
The @alias directive allows you to expose a spread fragment — either a named fragment spread or an inline fragment — as a...
Read more >
Unleash the power of Fragments with GraphQL Codegen
gql' const Avatar_UserFragment = graphql(/* GraphQL */ ` fragment ... The other data declared through the additional fragment spread( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found