dotansimha/graphql-code-generator

set typesPrefix with enumPrefix doesn't work with typescript-resolvers

Open

#4.249 aberto em 17 de jun. de 2020

Ver no GitHub
 (2 comments) (4 reactions) (0 assignees)TypeScript (1.295 forks)batch import
corehelp wantedpluginsstage/1-reproduction

Métricas do repositório

Stars
 (10.341 stars)
Métricas de merge de PR
 (Mesclagem média 46d 1h) (11 fundiu PRs em 30d)

Description

Describe the bug

When enumPrefix is set to false typescript-resolver doesn't use prefixed type name even if typesPrefix is set to T.

To Reproduce Steps to reproduce the behavior:

  1. set enumPrefix to false
  2. set typesPrefix to T
  3. graphql-codegen

Here is codesandbox.

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

  1. My GraphQL schema:
# Put your schema here
type Query {
    user(id: ID!): User!
}

type User {
    id: ID!
    username: String!
    email: String!
}
  1. My GraphQL operations: (Not related to this issue)
query user {
    user(id: 1) {
        id
        username
        email
    }
}
# Put your operations here
  1. My codegen.yml config file:
schema: schema.graphql
documents: document.graphql
generates:
  types.ts:
    config:
      typesPrefix: T
      enumPrefix: false
    plugins:
      - typescript
      - typescript-operations
      - typescript-resolvers

# Put your YML here

Expected behavior

generated resolver type should use prefixed type.

Environment:

  • OS: macOS 10.15.4 catalina
  • "@graphql-codegen/cli": "^1.15.3",
  • "@graphql-codegen/typescript": "^1.15.3",
  • "@graphql-codegen/typescript-resolvers": "^1.15.3"
  • NodeJS: v10.20.1

Additional context

Guia do colaborador