Skip to content

Commit 0802f3e

Browse files
authored
Merge pull request #248 from almyy/master
Add arguments in correct order when building Object
2 parents 3242872 + bae3778 commit 0802f3e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/main/kotlin/com/coxautodev/graphql/tools/SchemaParser.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ class SchemaParser internal constructor(scanResult: ScannedSchemaObjects, privat
158158

159159
val wiredField = directiveGenerator.onField(field.build(), DirectiveBehavior.Params(runtimeWiring))
160160
GraphQLFieldDefinition.Builder(wiredField)
161+
.clearArguments()
162+
.argument(wiredField.arguments)
161163
}
162164
}
163165

src/test/groovy/com/coxautodev/graphql/tools/SuperclassResolverSpec.groovy

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ class SuperclassResolverSpec extends Specification {
1212
bar: Bar!
1313
}
1414
15-
type Bar {
15+
type Bar implements Foo{
1616
value: String
17+
getValueWithSeveralParameters(arg1: Boolean!, arg2: String): String!
18+
}
19+
20+
interface Foo {
21+
getValueWithSeveralParameters(arg1: Boolean!, arg2: String): String!
1722
}
1823
''')
1924
.resolvers(new QueryResolver(), new BarResolver())
@@ -37,6 +42,14 @@ class SuperclassResolverSpec extends Specification {
3742
String getValue(T foo) {
3843
return "value"
3944
}
45+
46+
String getValueWithSeveralParameters(T foo, boolean arg1, String arg2) {
47+
if (arg1) {
48+
return "value"
49+
} else {
50+
return arg2
51+
}
52+
}
4053
}
4154

4255
class BarResolver extends FooResolver<Bar> {

0 commit comments

Comments
 (0)