dotansimha / graphql-yoga

🧘 Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance & great developer experience. The core of Yoga implements WHATWG Fetch API and can run/deploy on any JS environment.
https://the-guild.dev/graphql/yoga-server
MIT License
8.21k stars 569 forks source link

fix(persisted-operations): include in context params #3339

Closed ziolekjj closed 3 months ago

ziolekjj commented 3 months ago

According to the GraphQL Yoga Context, the default provided values in params includes query, operationName, variables, and extensions. When following the the APQ Specification of Apollo, the client sends operationName within the request, which would be helpful to keep in the context values if already exist. The current implementation strips the provided operationName value. I think it would be a good idea to add one, what do you think?

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: eb8edafc4683478dad041fbc9b6e175416538816

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

This PR includes changesets to release 1 package | Name | Type | | ----------------------------------------- | ----- | | @graphql-yoga/plugin-persisted-operations | 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 commented 3 months ago

Looks good to me! Thanks!

github-actions[bot] commented 3 months ago

✅ 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}

     checks.......................................: 100.00% ✓ 429386      ✗ 0     
     data_received................................: 1.8 GB  15 MB/s
     data_sent....................................: 87 MB   723 kB/s
     http_req_blocked.............................: avg=1.37µs   min=972ns    med=1.24µs   max=292.89µs p(90)=1.76µs   p(95)=1.99µs  
     http_req_connecting..........................: avg=2ns      min=0s       med=0s       max=126µs    p(90)=0s       p(95)=0s      
     http_req_duration............................: avg=352.9µs  min=214.86µs med=315.64µs max=24.9ms   p(90)=453.75µs p(95)=474.36µs
       { expected_response:true }.................: avg=352.9µs  min=214.86µs med=315.64µs max=24.9ms   p(90)=453.75µs p(95)=474.36µs
     ✓ { mode:graphql-jit }.......................: avg=276.75µs min=214.86µs med=255.17µs max=18.19ms  p(90)=285.75µs p(95)=298.06µs
     ✓ { mode:graphql-no-parse-validate-cache }...: avg=477.85µs min=389.62µs med=449.57µs max=9.19ms   p(90)=492.13µs p(95)=521.74µs
     ✓ { mode:graphql-response-cache }............: avg=333.44µs min=264.8µs  med=313.95µs max=5.99ms   p(90)=347.18µs p(95)=357.73µs
     ✓ { mode:graphql }...........................: avg=360.02µs min=271.9µs  med=324.3µs  max=24.9ms   p(90)=374.41µs p(95)=429.94µs
     http_req_failed..............................: 0.00%   ✓ 0           ✗ 214693
     http_req_receiving...........................: avg=33.18µs  min=15.5µs   med=32.95µs  max=896.54µs p(90)=38.25µs  p(95)=40.42µs 
     http_req_sending.............................: avg=7.57µs   min=5.76µs   med=6.78µs   max=267.12µs p(90)=10.16µs  p(95)=10.91µs 
     http_req_tls_handshaking.....................: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting.............................: avg=312.13µs min=175.33µs med=275.74µs max=24.72ms  p(90)=412.43µs p(95)=430.99µs
     http_reqs....................................: 214693  1789.087347/s
     iteration_duration...........................: avg=554.3µs  min=376µs    med=513.39µs max=25.65ms  p(90)=658.71µs p(95)=685.92µs
     iterations...................................: 214693  1789.087347/s
     vus..........................................: 1       min=1         max=1   
     vus_max......................................: 2       min=2         max=2