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.

Why does the gateway expand interface fragment into multiple implementations fragments? (federation)

See original GitHub issue

For example we have SDL with interface and multiple implementations:

interface Node{
    id: ID!
}

type Brand implements Node{
    id: ID!
    title: String!
}

type Department implements Node{
    id: ID!
    title: String!
}

type Query{
    brand: Brand
}

Then query

{
    brand {
        ... on Node {
            id
        }
    }
}

will be transformed into

Fetch(service: "data") {
    {
      brands {
        ... on Brand {
          id
        }
        ... on Department {
          id
        }
    }
}

So, the result will be error “Fragment cannot be spread here as objects of type "Brand" can never be of type "Department".”

Why don’t we pass fragments as is?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
vitramircommented, Sep 10, 2019

Looks like I have fixed this in last commit

0reactions
rtymchykcommented, Sep 24, 2019

@vitramir Ah ok, my bad, got confused thinking there was an app-specific fix. The PR makes sense and fixes the problem in our use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Federated schema design best practices - Apollo GraphQL Docs
Define, reference, and extend entities as needed. The Apollo Federation specification indicates that an Object or Interface type can be made into an...
Read more >
Fragment to Fragment communication - why is the interface ...
Interfaces are best for communicating two fragments, 2 activities or communicate with any class, because interface triggered at same time ...
Read more >
Resolve IPv4 Fragmentation, MTU, MSS, and PMTUD ... - Cisco
In Example 2, fragmentation does not occur at the endpoints of a TCP connection because both outgoing interface MTUs are taken into account...
Read more >
fragment-limit | Junos OS - Juniper Networks
Adaptive Services Interfaces User Guide for Routing Devices ... the maximum number of fragments permitted in a packet before the packet is dropped....
Read more >
Type Merging – GraphQL Tools
The difference in interface fields between the gateway schema and the layouts subschema will automatically be expanded into typed fragments ...
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