Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Node subschema pattern #6126

Merged
merged 1 commit into from
May 2, 2024
Merged

fix: Node subschema pattern #6126

merged 1 commit into from
May 2, 2024

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented May 2, 2024

When there is a Node subschema, and others to resolve the rest of the entities by using a union resolver as in Federation like below, it was failing. This version fixes that issue.

query {
  node(id: "1") {
    id # Fetches from Node
    ... on User {
      name # Fetches from User
    }
  }
}
type Query {
  node(id: ID!): Node
}

interface Node {
  id: ID!
}

type User implements Node {
  id: ID!
}

type Post implements Node {
  id: ID!
}
# User subschema
scalar _Any
type Query {
  _entities(representations: [_Any!]!): [_Entity]!
}
union _Entity = User
interface Node {
  id: ID!
}
type User implements Node {
  id: ID!
  name: String!
}
# Post subschema
scalar _Any
union _Entity = Post
type Query {
  _entities(representations: [_Any!]!): [_Entity]!
}
interface Node {
  id: ID!
}
type Post implements Node {
  id: ID!
  title: String!
}

Copy link

changeset-bot bot commented May 2, 2024

🦋 Changeset detected

Latest commit: 8faa65d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@graphql-tools/federation Patch
@graphql-tools/delegate Patch
@graphql-tools/stitch Patch
federation-benchmark Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented May 2, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-tools/delegate 10.0.9-alpha-20240502141744-8faa65d16da9b26fb043a60b4ce6431b74632e4e npm ↗︎ unpkg ↗︎
@graphql-tools/federation 1.1.32-alpha-20240502141744-8faa65d16da9b26fb043a60b4ce6431b74632e4e npm ↗︎ unpkg ↗︎
@graphql-tools/stitch 9.2.7-alpha-20240502141744-8faa65d16da9b26fb043a60b4ce6431b74632e4e npm ↗︎ unpkg ↗︎

Copy link
Contributor

github-actions bot commented May 2, 2024

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.........................: 100.00% ✓ 334       ✗ 0  
     data_received..................: 39 MB   3.9 MB/s
     data_sent......................: 143 kB  14 kB/s
     http_req_blocked...............: avg=3.9µs    min=2.05µs   med=2.66µs   max=170.11µs p(90)=3.84µs  p(95)=4.11µs  
     http_req_connecting............: avg=692ns    min=0s       med=0s       max=115.56µs p(90)=0s      p(95)=0s      
     http_req_duration..............: avg=55.92ms  min=47.87ms  med=52.38ms  max=147.65ms p(90)=60.21ms p(95)=87.28ms 
       { expected_response:true }...: avg=55.92ms  min=47.87ms  med=52.38ms  max=147.65ms p(90)=60.21ms p(95)=87.28ms 
     http_req_failed................: 0.00%   ✓ 0         ✗ 167
     http_req_receiving.............: avg=129.12µs min=105.59µs med=125.99µs max=287.57µs p(90)=143.9µs p(95)=147.53µs
     http_req_sending...............: avg=24.9µs   min=19.19µs  med=24.7µs   max=70.89µs  p(90)=30.28µs p(95)=32.25µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s      p(95)=0s      
     http_req_waiting...............: avg=55.76ms  min=47.71ms  med=52.24ms  max=147.3ms  p(90)=60.08ms p(95)=87.11ms 
     http_reqs......................: 167     16.614998/s
     iteration_duration.............: avg=60.16ms  min=51.53ms  med=56.36ms  max=151.52ms p(90)=65.85ms p(95)=91.41ms 
     iterations.....................: 167     16.614998/s
     vus............................: 1       min=1       max=1
     vus_max........................: 1       min=1       max=1

Copy link
Contributor

github-actions bot commented May 2, 2024

💻 Website Preview

The latest changes are available as preview in: https://02289481.graphql-tools.pages.dev

@ardatan ardatan merged commit 680351e into master May 2, 2024
30 checks passed
@ardatan ardatan deleted the node-rsolver-thing branch May 2, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant