-
-
Notifications
You must be signed in to change notification settings - Fork 599
Description
I'm submitting a ...
- bug report
- feature request
- question
PostGraphQL version:
ANY
My database is accessed by lambda and in order to keep the execution time down I want to package the schema.
This is costly per endpoint of course because it introspects on each call - I'm using the query within node with pg context passed in:
const schema = await createPostGraphQLSchema(conn, this.schemaName);
const result = await withPostGraphQLContext({ pgPool }, async context =>
graphql(schema, query, null, { ...context }, variables, operationName)
);
I'd like to pre-build the schema and somehow load and type cast map it to a schema:
// const schema = await createPostGraphQLSchema(conn, this.schemaName);
const schema = await loadExternalSchema('./schema.json');
const result = await withPostGraphQLContext({ pgPool }, async context =>
graphql(schema, query, null, { ...context }, variables, operationName)
);
I've tried the cli
output of introspectionQuery
in gql and was able to combine it with buildSchema
from the graphql
package, but it doesn't recognize the query commands 'Cannot read property...'.
The new graphile-build
is a bit over my head. I've been looking through the tests, but I don't see any load schema from previous introspected saved output file and type cast it to a GraphQLSchema, only introspect with inflections on an actual database.
Is there an easy way to save and load the schema then type casting it from a file?