You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Team, first let me say what a great tool. Sorry if this belongs in the Discussions, but I didn't see any conversations there, so I am not sure if Discussions are being used.
What I am trying to do is create static documentation for our GraphQL API as part of our build and deployment process. I am using the SpectaQL tool and so far it's working great. I would also love to add an option to visualize our schema with GraphQL Voyager.
So let's make this simple. As proof of concept, I modified the index.html example in the following manner:
Where data is the result of executing an introspection query against our schema.
Works great! But during our build process I can't execute an introspection query. The only thing I have access to is our schema file.
I read some older issues and I see this seems to be a common question. I enabled allowToChangeSchema and played around with the tool, so I know it's possible to use an SDL string instead of the introspection query to render the schema. But I can't figure out how to do it (my knowledge of JS is limited).
Are they minified? I am lost. Assuming I have const schema = ... how do I convert it to a JSON object representing the result of the introspection query?
Thanks a lot.
The text was updated successfully, but these errors were encountered:
zleonov
changed the title
How to use a schema string instead of an introspection query in index.html?
How to use a schema instead of an introspection query in index.html?
Aug 17, 2023
Your logic is correct, but the function introspectionFromSchema is not a Voyager function. It's a function provided by the GraphQL library, so you need to have it ready too. Maybe you could try from https://www.jsdelivr.com/package/npm/graphql
Hi. I'm sorry if I'm hijacking this issue, but I'm having the exact same problematic. It's not for a build process specifically, but I'm trying to use Voyager on a static HTML page, using an SDL string as the input.
To gain access to the introspectionFromSchema and buildSchema functions, I'm importing them from a local file that itself imports them from the 'graphql' library and sets them to window.
But when launching the page, I just have an infinitely loading screen. No errors are logged in the console, and I'm a bit at a loss as to what I'm doing wrong or how to go about debugging this.
This may not be the optimal way to go about doing it, but right now I'm just trying to get something working. I'm not able to send an introspection query, all I have access to is an SDL string just like the OP.
Hi Team, first let me say what a great tool. Sorry if this belongs in the Discussions, but I didn't see any conversations there, so I am not sure if Discussions are being used.
What I am trying to do is create static documentation for our GraphQL API as part of our build and deployment process. I am using the SpectaQL tool and so far it's working great. I would also love to add an option to visualize our schema with GraphQL Voyager.
So let's make this simple. As proof of concept, I modified the index.html example in the following manner:
Where
data
is the result of executing an introspection query against our schema.Works great! But during our build process I can't execute an introspection query. The only thing I have access to is our schema file.
I read some older issues and I see this seems to be a common question. I enabled
allowToChangeSchema
and played around with the tool, so I know it's possible to use an SDL string instead of the introspection query to render the schema. But I can't figure out how to do it (my knowledge of JS is limited).I am trying to do something like this: const data = introspectionFromSchema(buildSchema(sdlText)) but it doesn't seem that
buildSchema
andintrospectionFromSchema
functions are available invoyager.standalone.js
.Are they minified? I am lost. Assuming I have
const schema = ...
how do I convert it to a JSON object representing the result of the introspection query?Thanks a lot.
The text was updated successfully, but these errors were encountered: