Schema
makeExtendSchemaPlugin
Allows us to extend the graphql schema that is generated by Postgraphile
- It does this by allowing us to define additional Graphql Types and Resolvers and merge them into our schema.
- To accomplish this, the callback we pass to
makeExtendSchemaPlugin
should return thetypeDefs
(schema definition) and theresolvers
function
typeDefs
This allows us to specify how our Graphql schema will be extended.
- ex. Will we be adding a new subscription on it? A new InputType?
build
The build
argument to the makeExtendSchemaPlugin
contains information and helpers defined by various plugins in the Postgraphile ecosystem
- most importantly, it includes:
- introspection results (
build.pgIntrospectionResultsByKind
) - inflection functions (
build.inflection
) - an SQL helper (
build.pgSql
, an instance ofpg-sql2
- introspection results (
selectGraphQLResultFromTable
This helper populates data that is returned from our resolver
- It should not be used to retrieve data for our resolver to process.
- Instead use
context.pgClient
directly.
- Instead use
This helper should not be called more than once per resolver (which wouldn't make sense anyway)
Children