-
I'm using PostGraphile, and it defines a If I use import { getIntrospectionQuery } from "graphql";
import fetch from "node-fetch";
import * as fs from "fs";
import { getIntrospectedSchema, minifyIntrospectionQuery } from '@urql/introspection';
fetch("http://localhost:5000/graphql", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
variables: {},
query: getIntrospectionQuery(),
}),
})
.then((result) => result.json())
.then(({ data }) => {
//const minified = minifyIntrospectionQuery(getIntrospectedSchema(data));
const minified = getIntrospectedSchema(data);
fs.writeFile("./schema.json", JSON.stringify(minified), (err) => {
if (err) {
console.error("Writing failed:", err);
return;
}
console.log("Schema written!");
});
}); |
Beta Was this translation helpful? Give feedback.
Answered by
kitten
Apr 27, 2021
Replies: 1 comment 3 replies
-
To be very precise here, the schema that |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
kitten
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be very precise here, the schema that
minifyIntrospectionQuery
outputs is for use withurql
/ Graphcache only, meaning it's only meant to provide enough information for the client-side, but not any other tool as it strips out any information that Graphcache doesn't require.