Graphql-code-generator: If Query operation not has non nullable variable, generated code with typescript-vue-apollo has a compile error

Created on 11 Nov 2020  路  1Comment  路  Source: dotansimha/graphql-code-generator

Describe the bug
If query operation not has non nullable variable, parameter variables has question mark. it cause, generated code by typescript-vue-apollo has a compile error.

To Reproduce
Steps to reproduce the behavior:
Reproduce here: https://codesandbox.io/s/typescript-vue-apollo-repro-q7t1d?file=/document.graphql

yarn install
yarn generate
yarn build
  1. My GraphQL schema:
type Query {
    user(id: ID!): User!
    allUsers(limit: Int): [User]
}

type User {
    id: ID!
    username: String!
    email: String!
}
  1. My GraphQL operations:
query allUsers($limit: Int) {
  allUsers(limit: $limit) {
    id
    username
  }
}
  1. My codegen.yml config file:
schema: schema.graphql
documents: document.graphql
generates:
  src/types.ts:
    plugins:
      - typescript
      - typescript-operations
      - typescript-vue-apollo
    config:
      vueCompositionApiImportFrom: vue

Expected behavior
Completion to compilation with no error.

Environment:

  • OS: macOS
  • @graphql-codegen/typescript-vue-apollo: 2.2.0
  • NodeJS: v14.9.0

Additional context

bug plugins waiting-for-release

Most helpful comment

Fixed in @graphql-codegen/[email protected].

>All comments

Fixed in @graphql-codegen/[email protected].

Was this page helpful?
0 / 5 - 0 ratings