On this page

Prune Transform

Easily remove unused and empty types in your GraphQL schema with the prune transform. Learn how to use it and its configuration API reference here.

The prune transform allows you removing unused and empty types.

How to use?

mesh-config.ts
import {
  createPruneTransform,
  defineConfig,
  loadGraphQLHTTPSubgraph
} from '@graphql-mesh/compose-cli'

export const composeConfig = defineConfig({
  subgraphs: [
    {
      sourceHandler: loadGraphQLHTTPSubgraph('Users', {
        endpoint: 'http://localhost:4001/users'
      }),
      transforms: [
        createPruneTransform({
          // Skip pruning for specific types
          skipPruning: ['MyPrecioiusType']
        })
      ]
    }
  ]
})