Props naming convention #8363
-
Hello! Example: query forums {
forum {
created_at // <- This
id
title
}
}
But I would like to have a Example: query forums {
forum {
createdAt // <- This
id
title
}
}
Is it possible to do something to change props naming? I was playing with My current const schemaUrl = process.env.NEXT_PUBLIC_GRAPHQL_HOST;
const config: CodegenConfig = {
overwrite: true,
schema: schemaUrl,
documents: ['./api/**/*.graphql'],
config: {
avoidOptionals: {
field: true,
},
namingConvention: { // I tried everything here, but it doesn't help
transformUnderscore: true,
},
},
generates: {
'./api/_graphql/graphql.tsx': {
plugins: [
{
typescript: {
namingConvention: {
transformUnderscore: true,
},
},
},
'typescript-operations',
'typescript-react-apollo',
],
},
'./graphql.schema.json': {
plugins: ['introspection'],
},
},
}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Those naming conventions are done on the generated types. Codegen doesn't transform your schema; |
Beta Was this translation helpful? Give feedback.
Those naming conventions are done on the generated types. Codegen doesn't transform your schema;
You have to use something like GraphQL Mesh + Naming Convention transform;
https://www.the-guild.dev/graphql/mesh/docs/transforms/naming-convention
Or GraphQL Tools transforms;
https://www.graphql-tools.com/docs/schema-wrapping#renaming