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.

inconsistent naming for enums

See original GitHub issue

Describe the bug with version 0.16 the uppercase issue with enums is fixed. but there is something with the name of the enum itself that isn’t consistent anymore.

this gets generated for the enum:

export enum CIState {
  NONE = "NONE",
  IN_DEVELOPMENT = "IN_DEVELOPMENT",
  IN_USE = "IN_USE",
  IN_REMOVAL = "IN_REMOVAL",
  REMOVED = "REMOVED"
}

and this is the type which references the enum. you’ll notice that the enum CIState has a lowercase I in here. this breaks the reference as it is case sensitive. the actual graphql schema has an uppercase I (CIState as in the enum definition)

 export type Desired = {
    ...
    state: Maybe<CiState>;
  };

To Reproduce don’t really have a repro available as the source is cloud source.

Expected behavior use the name of the graphql schema for naming in all cases.

Schema/Documents can’t porovide the schema

Environment:

  • OS: WIndows 10
  • Codegen: 0.16.0
  • Node: 8.9.1

Additional context 0.15.x used CiState (lower case I) in all places

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
gaberudycommented, Jan 23, 2019

@SoyYoRafa you can ask for no naming changes like this:

generates:
  ./src/types/types.ts:
    plugins:
      - typescript-common
      - typescript-server
    config:
      avoidOptionals: true
      namingConvention:
        enumValues: keep
1reaction
OneCyruscommented, Jan 23, 2019

yes, that works now. thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inconsistent Enum Casting Results in C# - Stack Overflow
The documentation for Enum.ToString() explicitly states: If multiple enumeration members have the same underlying value and you attempt to ...
Read more >
Inconsistent enumeration declaration (name mismatch)
An inconsistent data declaration was found. In this case, the same name was declared as an enumeration in two compilation units, but the...
Read more >
Official Naming Convention for Enums - Google Groups
Enums are types, so they should be named using UpperCamelCase like classes. The enum values are constants, so they should be named using...
Read more >
Naming style | ReSharper Documentation - JetBrains
Press Alt+Enter on a highlighted symbol with inconsistent naming, then choose Inspection 'Inconsistent Naming ' | Change settings for naming rule ...
Read more >
Epic C++ Coding Standard for Unreal Engine
For example, FSkin is a type name, and Skin is an instance of a FSkin . ... Enum classes should always be used...
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