Skip to content

enumPrefix = false applying to non-enum types #7562

@bmarker

Description

@bmarker

Describe the bug
The enumPrefix = false config setting is stripping the prefix from non-enum types in IResolversTypes and IResolversParentTypes.

To Reproduce
Steps to reproduce the behavior:
https://codesandbox.io/s/quirky-proskuriakova-vmpz0v?file=/types.ts

  1. My GraphQL schema:
type Query {
    user: User!
}

type User {
    name: String!
}
  1. My GraphQL operations:

None

  1. My codegen.yml config file:
schema: schema.graphql
generates:
  types.ts:
    plugins:
      - typescript
      - typescript-resolvers
    config:
      typesPrefix: I
      enumPrefix: false

Expected behavior
Only skip the type prefix for enum types. The type for User should match the generated type IUser.

export type IResolversParentTypes = {
  Boolean: Scalars['Boolean'];
  Query: {};
  String: Scalars['String'];
  User: IUser;
};

Instead of:

export type IResolversParentTypes = {
  Boolean: Scalars['Boolean'];
  Query: {};
  String: Scalars['String'];
  User: User;
};

Environment:
https://codesandbox.io/s/quirky-proskuriakova-vmpz0v?file=/types.ts

    "@graphql-codegen/add": "^3.1.1",
    "@graphql-codegen/cli": "^2.4.0",
    "@graphql-codegen/typescript": "2.4.5",
    "@graphql-codegen/typescript-resolvers": "2.5.2",
    "graphql": "^16.2.0"

Additional context
Also happens with typesSuffix set and using {T} in defaultMapper.

Metadata

Metadata

Assignees

Labels

stage/4-pull-requestA pull request has been opened that aims to solve the issuestage/5-alpha-release-testingThe pull request is merged, an alpha release is available, to be tested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions