Graphql-code-generator: [Flow] Wrong optional parameter on Arg with default value

Created on 28 Dec 2018  路  4Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Schema

schema {
  query: Query
}

type Query {
  foo(field: Int = 10): Int
}

config

schema:
  - /tmp/demo.gql
generates:
  /tmp/demo.js:
    plugins:
      - flow

output

/* @flow */

export type Query = {
  foo: ?number
};

export type QueryFooArgs = {
  field?: ?number
};

Expected behavior
field on QueryFooArgs will not have an optional sign, since there will be always this field due to default value

field: number

Am I correct in my expectations?

bug plugins waiting-for-release

Most helpful comment

No worry, I'll have a fork with fixes, will submit a PR soon :)

All 4 comments

Thanks for reporting it @xanf !
It's definitely a bug :) I'll fix it soon

No worry, I'll have a fork with fixes, will submit a PR soon :)

Awesome!! Thanks @xanf !!

Available in 0.16.0

Was this page helpful?
0 / 5 - 0 ratings