Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Deprecate all fields that reference a named output type in Graphile Engine
import type { Plugin } from "graphile-build";
const makeDeprecateTypePlugin = (typeName: string, deprecationReason: string): Plugin => builder => {
builder.hook('GraphQLObjectType:fields:field', (field, { graphql }) => {
if (graphql.getNamedType(field.type).name !== typeName) {
return field;
return {
// Usage:
// appendPlugins: [makeDeprecateTypePlugin('TypeToDeprecate', 'Use OtherType instead')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment