⚠️
This is the documentation for the old GraphQL Mesh version v0. We recommend upgrading to the latest GraphQL Mesh version v1.
Migrate to GraphQL Mesh v1
Migrate to GraphQL Mesh v1
Naming Convention Transform
The naming-convention
transforms allow you to apply casing and other conventions to your response.
Installation
npm i @graphql-mesh/transform-naming-convention
How to use?
💡
In this example, enumValues fields are converted to uppercase, while fieldNames are converted to camel case to enforce consistency.
Add the following configuration to your Mesh config file:
.meshrc.yaml
transforms:
- namingConvention:
mode: bare | wrap
typeNames: pascalCase
enumValues: upperCase
fieldNames: camelCase
fieldArgumentNames: camelCase
💡
For information about “bare” and “wrap” modes, please read the dedicated section.
💡
You can see our gRPC example that uses this transform to see its application. Click here to open the example on GitHub.
Config API Reference
mode
(type:String (bare | wrap)
) - Specify to apply naming-convention transforms to bare schema or by wrapping original schematypeNames
(type:String (camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase | upperCase | lowerCase)
)fieldNames
(type:String (camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase | upperCase | lowerCase)
)enumValues
(type:String (camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase | upperCase | lowerCase)
)fieldArgumentNames
(type:String (camelCase | capitalCase | constantCase | dotCase | headerCase | noCase | paramCase | pascalCase | pathCase | sentenceCase | snakeCase | upperCase | lowerCase)
)