prefix transforms allow you to add prefixes to existing GraphQL types and root operations
prefix is similar to
rename in that it
allows you to modify names to avoid conflicts, simplify complicated names, and change the appearance
of your query. In contrast with
prefix is simpler and only allows you to append a
prefix to the existing name.
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:
transforms: - 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 (opens in a new tab).
Config API Reference
String (bare | wrap)) - Specify to apply prefix transform to bare schema or by wrapping original schema
String) - The prefix to apply to the schema types. By default it's the API name.
Array of String, required) - List of ignored types
Boolean) - Changes root types and changes the field names (default: false)
Boolean) - Changes types (default: true)