Skip to content

Deeply nested fields missing depending on the order of inline fragments within an interface fragment #2346

@yokazawa

Description

@yokazawa

Component(s)

router

Component version

0.262.1

wgc version

0.96.1

controlplane version

0.169.3

router version

0.262.1

What happened?

Description

I encountered an issue where fields inside a nested inline fragment are missing from the response, but only when the inline fragment is placed after another inline fragment within a named fragment on an Interface.

Changing the order of the inline fragments resolves the issue, but it would be challenging to change the queries to support existing API clients.

Scenario:

  • I have an Interface Base implemented by ProductA and ProductB.
  • I am querying a ProductA.
  • I use a named fragment fragment ProductDetail on Base.
  • Inside this fragment, I have inline fragments for both ... on ProductB and ... on ProductA.

Steps to Reproduce

  1. Define schema with Interface Base, implementing types ProductA and ProductB. ProductA has a nested object field category. Category has two fields id and owner. Owner has field name.
  2. Execute a query that selects fields from ProductA via the interface fragment.
query Reproduce {
    productA {
        category {
            id
        }
        ... on Base {
            ...ProductDetail
        }
    }
}

fragment ProductDetail on Base {
  # 1. ProductB is defined FIRST
  ... on ProductB {
    category {
      # Fields here (e.g. "owner") are MISSING in the response
      owner { name }
    }
  }
  # 2. ProductA is defined SECOND
  ... on ProductA {
    category {
      # Fields here (e.g. "owner") are MISSING in the response
      owner { name }
    }
  }
}

Expected Result

{
  "data": {
    "productA": {
      "category": {
        "id": "category-id",
        "owner": {
          "name": "category-owner-name"
        }
      }
    }
  }
}

Actual Result

{
  "data": {
    "productA": {
      "category": {
        "id": "category-id"
      }
    }
  }
}

Environment information

Environment

OS: Linux(on Docker Compose)
Compiler(if manually compiled): go1.25.4

Router configuration

Router execution config

Log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions