[Bug] Missing type in generated file
Closed this issue · 5 comments
-
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project -
Summary
First of all, thanks for creating this plugin. I've been looking for something like this for some time now and this works incredibly well. I did find a potential bug where an enum that was used by an operation wasn't being added to the file:
mutation MyMutation(
$id: ID!
$foo: FooType!
$bar: [BarInput]
$count: Int
) {
updateFoo(
id: $id
input: { count: $count, fooType: $foo, barInput: $bar }
) {
id
}
}
In the mutation above, the FooType
enum wasn't being added to the generated file but BarInput
was. Where FooType
is an enum and BarInput
is a Union. I was able to work around it by doing the following instead:
mutation MyMutation(
$id: ID!
$input: FooInput!
) {
updateFoo(
id: $id
input: $input
) {
id
}
}
Which then included FooType
in the generated file.
Do you have an exmaple of the schema that this operation is part of so that I can write a test and reproduce?
BarInput is a Union.
As far as I remember graphql input unions are not in the graphql spec yet. I'd be curious how your schema is setup to support this.
That was my mistake, its not an input union. Here is an example schema:
type Mutation @extends {
updateFoo(input: FooInput!, id: ID!): Foo
}
type Foo {
id: ID!
}
enum FooType {
FOO_A
FOO_B
FOO_C
}
enum BarType {
BAR_A
BAR_B
BAR_C
}
input FooInput {
fooType: FooType!
barInput: [BarInput]
count: Int
}
input BarInput {
bazInput: BazInput
barType: BarType!
}
input BazInput {
a: String
b: Int
}
Excellent, thank you. I'll take a look into this and see if I can find a solution.
Fixed in 1.1.4. I overlooked that enums can also be variable types.
Thanks for the bug ticket and extensive information :)
Just tested and it works great! Thanks for the super quick fix 😄