@@ -18,13 +18,13 @@ data class Variables(
18
18
/* *
19
19
* map and return object of requested class
20
20
*/
21
- fun <T : Any > get (kClass : KClass <T >, kType : KType , key : String , transform : (value: String ) -> Any? ): T ? {
21
+ fun <T : Any > get (kClass : KClass <T >, kType : KType , typeName : String? , key : String , transform : (value: String ) -> Any? ): T ? {
22
22
val variable = variables?.find { key == it.name }
23
23
? : throw IllegalArgumentException (" Variable '$key ' was not declared for this operation" )
24
24
25
25
val isIterable = kClass.isIterable()
26
26
27
- validateVariable(typeDefinitionProvider.typeReference(kType), variable)
27
+ validateVariable(typeDefinitionProvider.typeReference(kType), typeName, variable)
28
28
29
29
var value = variablesJson.get(kClass, kType, key.substring(1 ))
30
30
if (value == null && variable.defaultValue != null ){
@@ -57,9 +57,9 @@ data class Variables(
57
57
}
58
58
}
59
59
60
- fun validateVariable (expectedType : TypeReference , variable : OperationVariable ){
60
+ fun validateVariable (expectedType : TypeReference , expectedTypeName : String? , variable : OperationVariable ){
61
61
val variableType = variable.type
62
- val invalidName = expectedType.name != variableType.name
62
+ val invalidName = (expectedTypeName ? : expectedType.name) != variableType.name
63
63
val invalidIsList = expectedType.isList != variableType.isList
64
64
val invalidNullability = ! expectedType.isNullable && variableType.isNullable && variable.defaultValue == null
65
65
val invalidElementNullability = ! expectedType.isElementNullable && variableType.isElementNullable
0 commit comments