@@ -44,7 +44,13 @@ class OptionalInputTest {
4444 Arguments .of(" { inputWithOptionalScalarValues(input: { required: \" ABC\" optional: 1 }) }" , " argument scalar value: 1" ),
4545 Arguments .of(" { inputWithOptionalValues(input: { required: \" ABC\" }) }" , " argument with optional object was not specified" ),
4646 Arguments .of(" { inputWithOptionalValues(input: { required: \" ABC\" optional: null }) }" , " argument object value: null" ),
47- Arguments .of(" { inputWithOptionalValues(input: { required: \" ABC\" optional: { id: 1, name: \" XYZ\" } }) }" , " argument object value: SimpleArgument(id=1, name=XYZ)" )
47+ Arguments .of(" { inputWithOptionalValues(input: { required: \" ABC\" optional: { id: 1, name: \" XYZ\" } }) }" , " argument object value: SimpleArgument(id=1, name=XYZ)" ),
48+ /* ktlint-disable */
49+ Arguments .of(
50+ " { inputWithNestedOptionalValues(input: { optional: { nestedOptionalScalar: \" ABC\" , nestedOptionalInt: null } } )}" ,
51+ " HasNestedOptionalArguments(optional=Defined(value=DeeplyNestedArguments(nestedOptional=UNDEFINED, nestedOptionalScalar=Defined(value=ABC), nestedOptionalInt=Defined(value=null))), optionalScalar=UNDEFINED)"
52+ )
53+ /* ktlint-enable */
4854 )
4955 }
5056}
@@ -64,6 +70,17 @@ data class HasOptionalArguments(
6470 val optional : OptionalInput <SimpleArgument >
6571)
6672
73+ data class HasNestedOptionalArguments (
74+ val optional : OptionalInput <DeeplyNestedArguments > = OptionalInput .Undefined ,
75+ val optionalScalar : OptionalInput <Int > = OptionalInput .Undefined
76+ )
77+
78+ data class DeeplyNestedArguments (
79+ val nestedOptional : OptionalInput <SimpleArgument > = OptionalInput .Undefined ,
80+ val nestedOptionalScalar : OptionalInput <String > = OptionalInput .Undefined ,
81+ val nestedOptionalInt : OptionalInput <Int > = OptionalInput .Undefined
82+ )
83+
6784class OptionalInputQuery {
6885 fun optionalScalarInput (input : OptionalInput <String >): String = when (input) {
6986 is OptionalInput .Undefined -> " input scalar was not specified"
@@ -84,4 +101,6 @@ class OptionalInputQuery {
84101 is OptionalInput .Undefined -> " argument with optional object was not specified"
85102 is OptionalInput .Defined <SimpleArgument > -> " argument object value: ${input.optional.value} "
86103 }
104+
105+ fun inputWithNestedOptionalValues (input : HasNestedOptionalArguments ): String = input.toString()
87106}
0 commit comments