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

Schema documentation is requested but not shown even if received (v1.5.1) #2027

Closed
learnerEvermore opened this issue Nov 15, 2021 · 13 comments
Closed

Comments

@learnerEvermore
Copy link

I can see that the schema description is requested:

query IntrospectionQuery {
  __schema {
    description
    ...
}

but it isn't displayed even if received. Just the default "A GraphQL schema provides a root type for each kind of operation." shows up.

@acao
Copy link
Member

acao commented Dec 4, 2021

I have tests that confirm that it works now!

If schema prop was provided it was already working, just had to specify schemaDescription: true in getIntrospectionQuery(), see #2077! if you want to try this before it's released, you can try the canary release mentioned in the PR comments :)

@acao
Copy link
Member

acao commented Dec 6, 2021

released!

@acao acao closed this as completed Dec 6, 2021
@sebastienbarre
Copy link

sebastienbarre commented Dec 7, 2021

Unfortunately 1.5.9, 1.5.11, and 1.5.12 are broken at this point when using unpkg (1.5.10 does not exist).
Only 1.5.8 is functioning.
So for people landing here, replace https://unpkg.com/graphiql/graphiql.min.js with https://unpkg.com/graphiql@1.5.8/graphiql.min.js until it is fixed.

The latest error message is:

{
  "errors": [
    "{\n  \"errors\": [\n    {\n      \"message\": \"Cannot query field \\\"description\\\" on type \\\"__Schema\\\".\",\n      \"extensions\": {\n        \"category\": \"graphql\"\n      },\n      \"locations\": [\n        {\n          \"line\": 4,\n          \"column\": 9\n        }\n      ]\n    }\n  ]\n}"
  ]
}

@acao
Copy link
Member

acao commented Dec 7, 2021

@sebastienbarre what version of graphql js are you using? Cypress tests are passing against graphql@16 and the latest graphql@15

@sebastienbarre
Copy link

sebastienbarre commented Dec 7, 2021

I'm not entirely sure what you mean, but let me see if I can help.
I'm using webonyx/graphql-php: A PHP port of GraphQL reference implementation under the hood, and the latest version is v14.11.3. This is pretty much the one and only (or at least the most popular by far) GraphQL implementation for PHP.

Did GraphiQL become tied to the JavaScript reference implementation for GraphQL specifically?
I thought one could use it against any server implementation of the spec, seems it had been the case for a while now...

@acao
Copy link
Member

acao commented Dec 7, 2021

@saihaj or @IvanGoncharov what do I do about this? do i feature flag based on the version when introspection schemaDescription was introduced? Or set the peer dependency at the version when graphql introduced this, add a note to the docs, and move on?

I could also make it an opt-in feature via a prop as I did with inputTypeDeprecation

@acao
Copy link
Member

acao commented Dec 7, 2021

ohh right so @sebastienbarre this is a schema introspection issue. this means graphql-php doesn't support schema description in type introspection

@acao
Copy link
Member

acao commented Dec 7, 2021

this is where graphql-php is missing the description field for Schema:

https://github.com/webonyx/graphql-php/blob/44ed079229b6e954ba4edd55e65d697a2df67211/src/Type/Introspection.php#L233

we use this at work, so maybe I'll add it :)

@acao
Copy link
Member

acao commented Dec 7, 2021

@learnerEvermore this is now an opt-in feature via props, fyi! same with argument deprecations which is now supported by DocExplorer as well. It seems that a lot of GraphQL reference implementations need to add the __Schema.documentation field

@sebastienbarre
Copy link

Thanks @acao. I'm going to try to tag @spawnia here since they are very active on that graphqlphp repo and that feature might be in v15.

@spawnia
Copy link
Member

spawnia commented Dec 7, 2021

Tracked in webonyx/graphql-php#1027, I will happily accept PRs.

@learnerEvermore
Copy link
Author

I confirmed that this works now, with the freshest version from unpkg.

@learnerEvermore
Copy link
Author

learnerEvermore commented Dec 8, 2021

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants