question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`client-preset` doesn't take into account `namingConvention`

See original GitHub issue

Describe the bug

When using the client-preset, if I add namingConvention config it won’t be taken into account in the “types”. It is however applied to the “documents”.

Your Example Website or App

Not public

Steps to Reproduce the Bug or Issue

  1. Use the following config: Config used to reproduce
import type { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
  overwrite: true,
  schema: 'http://localhost:8080/api/graphql',
  documents: ['src/**/*.{ts,tsx}', '!src/gql/**/*'],
  generates: {
    'src/gql': {
      preset: 'client',
      plugins: [],
    },
  },
  config: { namingConvention: 'change-case-all#upperCase' },
};

export default config;

  1. Run the codegen
  2. Types case doesn’t match the config in src/gql/graphql

Expected behavior

namingConvention should be taken into account

Screenshots or Videos

No response

Platform

Codegen Config File

{
  overwrite: true,
  schema: 'http://localhost:8080/api/graphql',
  documents: ['src/**/*.{ts,tsx}', '!src/gql/**/*'],
  generates: {
    'src/gql': {
      preset: 'client',
      plugins: [],
    },
  },
  config: { namingConvention: 'change-case-all#upperCase' },
}

Additional context

It seems to be because options.config isn’t passed down here: https://github.com/dotansimha/graphql-code-generator/blob/f3c5b7a0044a0618898676ee6ee06f2494ac0b7c/packages/presets/client/src/index.ts#L177

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
charlypolycommented, Oct 6, 2022

@Hugodby, good catch, fixed in @graphql-codegen/client-preset@1.0.5 📦

0reactions
Hugodbycommented, Oct 6, 2022

You are so fast thank you! I just tested and it works now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enforce group naming policy in Azure Active Directory
To enforce consistent naming conventions for Microsoft 365 groups created or edited by your users, set up a group naming policy for your ......
Read more >
Naming Conventions: Best Practices for Documentation - IT Glue
In this blog, we'll explore the significance of structured naming convention and how to use it to organize and retrieve documents ...
Read more >
Service naming rules | Dynatrace Docs
In the Dynatrace menu, go to Settings > Server-side service monitoring > Service naming rules and scroll to the Built-in rules section.
Read more >
Client printers policy settings - Citrix Product Documentation
Client printer names​​ This setting selects the naming convention for auto-created client printers. By default, standard printer names are used. ...
Read more >
Change Server Settings in Mail on Mac - Apple Support
Use Server Settings settings in Mail to change options for an account's incoming and outgoing (SMTP) mail servers. To change these settings in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found