Graphql-code-generator: Enum and wrong naming convention

Created on 26 Mar 2019  路  3Comments  路  Source: dotansimha/graphql-code-generator

To Reproduce
Steps to reproduce the behavior:

  1. My GraphQL schema:
enum FeedbackPollShowOption {
  ALWAYS
  HIDE_AFTER_SUBMIT
}
  1. My codegen.yml config file:
documents: ./src/**/*.graphql
overwrite: true
generates:
  ./src/queries.tsx:
    plugins:
      - add: // tslint:disable
      - typescript
      - typescript-operations
      - typescript-react-apollo
    config:
      noNamespaces: true
      avoidOptionals: false
      scalars:
        UUID4: string
        DateTime: string
        Json: string
        Decimal: string
        Date: string

Current behavior

export enum FeedbackPollShowOption {
  Always = "ALWAYS",
  Hide_After_Submit = "HIDE_AFTER_SUBMIT"
}

Expect Behaviour

export enum FeedbackPollShowOption {
  Always = "ALWAYS",
  HideAfterSubmit = "HIDE_AFTER_SUBMIT"
}

As it was before.

Environment:

  • @graphql-codegen/...: 1.0.4
bug plugins waiting-for-release

All 3 comments

1.0.0 has the same behavior 馃

Caused by the fact that we would like to keep the underscore _ when you defined it (for example, in type name, or operation name), and apply the naming conventing without effecting the underscores.
We had an issue in the past with names like user_name and username that were both transformed to Username.

@kamilkisiela @ardatan what do you think?

Fixed in 1.0.5.

Was this page helpful?
0 / 5 - 0 ratings