Skip to content

Conversation

ardatan
Copy link
Member

@ardatan ardatan commented May 9, 2024

Do not allow reserved context keys in UserContext and ServerContext if they don't match

For example, you cannot have request as a key in UserContext or ServerContext unless it is Request like below;

// @ts-expect-error Not allowed
createYoga<{
    request: FastifyRequest
}>(/* ... */);

// But allowed
createYoga<{
    req: FastifyRequest
}>(/* ... */);

// Also allowed
createYoga<{
    request: Request // From Fetch API
}>(/* ... */);

Copy link

changeset-bot bot commented May 9, 2024

🦋 Changeset detected

Latest commit: e78e15c

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

This PR includes changesets to release 9 packages
Name Type
graphql-yoga Patch
apollo-federation-gateway-with-yoga Patch
apollo-subgraph-with-yoga Patch
graphql-lambda Patch
cloudflare-advanced Patch
cloudflare Patch
functions Patch
nextjs-app Patch
hello-world-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

@ardatan ardatan marked this pull request as draft May 9, 2024 14:25
Copy link
Member

@enisdenjo enisdenjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

@EmrysMyrddin
Copy link
Collaborator

Great idea ! You need help to actually finalize it ?

@ardatan
Copy link
Member Author

ardatan commented May 17, 2024

It'd be great @EmrysMyrddin
There are still issues with TS stuff.

@EmrysMyrddin EmrysMyrddin self-assigned this May 28, 2024
@EmrysMyrddin
Copy link
Collaborator

I will take a look :-)

@ardatan ardatan marked this pull request as ready for review September 16, 2025 13:41
Copy link
Contributor

🚀 Snapshot Release (alpha)

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

Package Version Info
@graphql-yoga/apollo-link 5.1.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/urql-exchange 5.1.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
graphql-yoga 5.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/nestjs-federation 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-inline-trace 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/apollo-managed-federation 0.15.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apollo-usage-report 0.11.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-apq 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-csrf-prevention 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-defer-stream 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-disable-introspection 2.17.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-graphql-sse 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-jwt 3.10.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-persisted-operations 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-prometheus 6.11.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-response-cache 3.18.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/plugin-sofa 3.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/render-apollo-sandbox 0.1.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎
@graphql-yoga/render-graphiql 5.16.0-alpha-20250916134242-84e37e7f34704aa7434b00ca67392c98179ef766 npm ↗︎ unpkg ↗︎

Copy link
Contributor

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link
Contributor

💻 Website Preview

The latest changes are available as preview in: https://pr-3263.graphql-yoga.pages.dev

Copy link
Contributor

✅ Benchmark Results

     ✓ no_errors{mode:graphql}
     ✓ expected_result{mode:graphql}
     ✓ no_errors{mode:graphql-jit}
     ✓ expected_result{mode:graphql-jit}
     ✓ no_errors{mode:graphql-response-cache}
     ✓ expected_result{mode:graphql-response-cache}
     ✓ no_errors{mode:graphql-no-parse-validate-cache}
     ✓ expected_result{mode:graphql-no-parse-validate-cache}
     ✓ no_errors{mode:uws}
     ✓ expected_result{mode:uws}

     checks.......................................: 100.00% ✓ 524794      ✗ 0     
     data_received................................: 2.1 GB  14 MB/s
     data_sent....................................: 106 MB  703 kB/s
     http_req_blocked.............................: avg=1.52µs   min=1.02µs   med=1.31µs   max=5.44ms   p(90)=1.99µs   p(95)=2.16µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=159.37µs p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=355.68µs min=208.33µs med=329.14µs max=15.56ms  p(90)=461µs    p(95)=480.01µs
       { expected_response:true }.................: avg=355.68µs min=208.33µs med=329.14µs max=15.56ms  p(90)=461µs    p(95)=480.01µs
     ✓ { mode:graphql-jit }.......................: avg=274.96µs min=208.33µs med=259.3µs  max=15.56ms  p(90)=287.15µs p(95)=297.52µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=484.54µs min=404.75µs med=463.36µs max=8.41ms   p(90)=497.31µs p(95)=512.02µs
     ✓ { mode:graphql-response-cache }............: avg=341.63µs min=259.12µs med=325.6µs  max=8.54ms   p(90)=354.1µs  p(95)=363.66µs
     ✓ { mode:graphql }...........................: avg=361.41µs min=280.95µs med=334.47µs max=15.13ms  p(90)=376.44µs p(95)=426.65µs
     ✓ { mode:uws }...............................: avg=354.03µs min=282.74µs med=335.23µs max=5.96ms   p(90)=365.29µs p(95)=378.42µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 262397
     http_req_receiving...........................: avg=32.63µs  min=16.29µs  med=31.84µs  max=2.92ms   p(90)=38.48µs  p(95)=40.64µs 
     http_req_sending.............................: avg=8.5µs    min=6.07µs   med=7.45µs   max=280.28µs p(90)=10.84µs  p(95)=11.84µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=314.54µs min=178.49µs med=289.63µs max=15.45ms  p(90)=419.75µs p(95)=436.62µs
     http_reqs....................................: 262397  1749.298405/s
     iteration_duration...........................: avg=566.73µs min=381.84µs med=536.66µs max=16.06ms  p(90)=675.09µs p(95)=696.94µs
     iterations...................................: 262397  1749.298405/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2   

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.

3 participants