v1
Transforms
Naming Convention

Naming Convention Transform

The naming convention transforms allow you to apply casing and other conventions to your response.

How to use?

You can import createNamingConventionTransform to create an instance of the transform. Each parameter of the transform factory takes a function that takes a string, and returns another string. So you can use your own convention functions, or use the provided ones like pascalCase, upperCase, camelCase, etc.

mesh.config.ts
import {
  camelCase,
  createNamingConventionTransform,
  defineConfig,
  loadGraphQLHTTPSubgraph,
  pascalCase,
  upperCase
} from '@graphql-mesh/compose-cli'
 
export const composeConfig = defineConfig({
  subgraphs: [
    {
      sourceHandler: loadGraphQLHTTPSubgraph('Countries', {
        endpoint: 'https://countries.trevorblades.com'
      }),
      transforms: [
        createNamingConventionTransform({
          typeNames: pascalCase,
          enumValues: upperCase,
          fieldNames: camelCase,
          fieldArgumentNames: camelCase
        })
      ]
    }
  ]
})