• Docs
  • Transforms
  • Prefix

Prefix Transform

The prefix transform allows you to prefix GraphQL types and GraphQL root operations (under Query/Mutation).

You can use it to easily "namespace" APIs in your unified API and avoid conflicts.

yarn add @graphql-mesh/transform-prefix

How to use?

Add the following configuration to your Mesh config file:

  - prefix:
      mode: bare | wrap
      value: MyApi_

For information about "bare" and "wrap" modes, please read the dedicated section. You can check out our example that uses schema stitching with a PostgreSQL data source and prefix transform. Click here to open the example on GitHub.

Config API Reference

  • mode (type: String (bare | wrap)) - Specify to apply prefix transform to bare schema or by wrapping original schema
  • value (type: String) - The prefix to apply to the schema types. By default it's the API name.
  • ignore (type: Array of String, required) - List of ignored types
  • includeRootOperations (type: Boolean) - Changes root types and changes the field names (default: false)
  • includeTypes (type: Boolean) - Changes types (default: true)
Last updated on July 27, 2022