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: graphiql enable schema description, default headers #2172

Merged

Conversation

tuanpt-0634
Copy link
Contributor

@tuanpt-0634 tuanpt-0634 commented Nov 28, 2022

GraphiQL schema description

Currently, schema description was intended to enable by default

const executor = urlLoader.getExecutorAsync(endpoint, {
subscriptionsProtocol: SubscriptionProtocol.SSE,
credentials: 'same-origin',
specifiedByUrl: true,
directiveIsRepeatable: true,
schemaDescription: true,
...props,
headers: props.additionalHeaders || {},
})

But specifying it in fetcher props does not work, in this pull I change to use GraphiQLProvider's props, same as GraphiQL default components

GraphiQL default headers

We are allowing passing default headers when create yoga, but it hasn't been passed to GraphiQLProvider

/**
* The initial headers to render inside the header editor. Defaults to `"{}"`.
*/
headers?: string

Unused options

https://github.com/graphql/graphiql/blob/main/docs/migration/graphiql-2.0.0.md

  • defaultVariableEditorOpen was changed to defaultEditorToolsVisibility
  • headerEditorEnabled was changed to isHeadersEditorEnabled

And these two options were enabled by default

<GraphiQLInterface
isHeadersEditorEnabled
defaultEditorToolsVisibility

@changeset-bot
Copy link

changeset-bot bot commented Nov 28, 2022

🦋 Changeset detected

Latest commit: f5cc228

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/graphiql 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

@tuanpt-0634 tuanpt-0634 changed the title fix: enable schema description by default fix: graphiql enable schema description, default headers Nov 28, 2022
Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

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

@tuanpt-0634 Do you think you can add an integration test to preventring future regressions?

@theguild-bot theguild-bot mentioned this pull request Nov 28, 2022
@tuanpt-0634 tuanpt-0634 requested review from n1ru4l and saihaj and removed request for n1ru4l and saihaj November 29, 2022 10:02
@n1ru4l n1ru4l merged commit 62fc9e4 into dotansimha:main Nov 29, 2022
@github-actions
Copy link
Contributor

✅ Benchmark Results

     ✓ no_errors
     ✓ expected_result

     checks.........................: 100.00% ✓ 185856      ✗ 0    
     data_received..................: 26 MB   870 kB/s
     data_sent......................: 11 MB   356 kB/s
     http_req_blocked...............: avg=1.18µs   min=700ns    med=1µs      max=273.71µs p(90)=1.5µs    p(95)=1.9µs   
     http_req_connecting............: avg=1ns      min=0s       med=0s       max=114µs    p(90)=0s       p(95)=0s      
   ✓ http_req_duration..............: avg=248.84µs min=172.5µs  med=221.71µs max=18.94ms  p(90)=274.61µs p(95)=308.81µs
       { expected_response:true }...: avg=248.84µs min=172.5µs  med=221.71µs max=18.94ms  p(90)=274.61µs p(95)=308.81µs
     http_req_failed................: 0.00%   ✓ 0           ✗ 92928
     http_req_receiving.............: avg=18.74µs  min=10.9µs   med=16µs     max=6.48ms   p(90)=22µs     p(95)=25.7µs  
     http_req_sending...............: avg=6.11µs   min=3.9µs    med=4.8µs    max=3.15ms   p(90)=7.5µs    p(95)=9.7µs   
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=223.98µs min=153.9µs  med=200.51µs max=18.81ms  p(90)=244.71µs p(95)=276.91µs
     http_reqs......................: 92928   3097.468303/s
     iteration_duration.............: avg=317.19µs min=225.11µs med=282.56µs max=19.49ms  p(90)=353.21µs p(95)=392.61µs
     iterations.....................: 92928   3097.468303/s
     vus............................: 1       min=1         max=1  
     vus_max........................: 1       min=1         max=1  

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.

None yet

4 participants