Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client-preset doesn't take into account namingConvention #8435

Closed
Hugodby opened this issue Oct 4, 2022 · 5 comments
Closed

client-preset doesn't take into account namingConvention #8435

Hugodby opened this issue Oct 4, 2022 · 5 comments
Assignees
Labels
core Related to codegen core/cli kind/docs Improvements or additions to documentation presets Related to Codegen presets

Comments

@Hugodby
Copy link

Hugodby commented Oct 4, 2022

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

  • OS: all
  • NodeJS: v14
  • graphql version: 16.6.0
  • "@graphql-codegen/cli": "2.13.2",
  • "@graphql-codegen/client-preset": "1.0.2",

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:

@charlypoly
Copy link
Contributor

Answered on the proposed PR:
#8436 (comment)

@charlypoly charlypoly self-assigned this Oct 5, 2022
@charlypoly charlypoly added core Related to codegen core/cli presets Related to Codegen presets kind/docs Improvements or additions to documentation labels Oct 5, 2022
@charlypoly
Copy link
Contributor

Hi @Hugodby,

it has been fixed in @graphql-codegen/client-preset@1.0.4 📦

@Hugodby
Copy link
Author

Hugodby commented Oct 6, 2022

Hi @charlypoly , thank you very much for working on this!

There is a small issue with the PR you wrote so this isn't completely fixed (see comment).

@charlypoly
Copy link
Contributor

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

@Hugodby
Copy link
Author

Hugodby commented Oct 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to codegen core/cli kind/docs Improvements or additions to documentation presets Related to Codegen presets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants