How to programatically load a schema from a gql endpoint using @graphql-inspector/core #2845
Replies: 1 comment
-
Tried going a bit further, got close but not seeing the same result as with the const loadRemoteSchema = () => {
const loaderRegistry = new LoadersRegistry()
loaderRegistry.register(new UrlLoader())
return loaderRegistry.loadSchema("<my_graphql_endpoint>", {}, false, false)
} When running the schema produced by the above function through the programmatic Strangely, if I write these ASTs to files via the |
Beta Was this translation helpful? Give feedback.
-
The CLI tool
@graphql-inspector
provides adiff
command that allows simply passing a gql endpoint string from which it will load the schema. I would like to use the programmatic interface of@graphql-inspector/core
, but I don't see a way to have thediff
function it exports perform the same type of schema loading.I have looked into the source code for the
diff
command in the hopes that the answer would be trivially found, but it looks like I'll need to replicate more of the internals than I'd prefer. At this point I'd rather execute the CLI tool via a child process in my node script and manually parse its stdout/stderr.Beta Was this translation helpful? Give feedback.
All reactions