@@ -17,7 +17,7 @@ local function checkVariableValue(variableName, value, variableType)
17
17
if isNonNull then
18
18
variableType = types .nullable (variableType )
19
19
if value == nil then
20
- error ((' Variable "%s" expected to be non-null' ):format (variableName ))
20
+ error ((' Variable %q expected to be non-null' ):format (variableName ))
21
21
end
22
22
end
23
23
@@ -32,11 +32,11 @@ local function checkVariableValue(variableName, value, variableType)
32
32
33
33
if isList then
34
34
if type (value ) ~= ' table' then
35
- error ((' Variable "%s" for a List must be a Lua ' ..
35
+ error ((' Variable %q for a List must be a Lua ' ..
36
36
' table, got %s' ):format (variableName , type (value )))
37
37
end
38
38
if not util .is_array (value ) then
39
- error ((' Variable "%s" for a List must be an array, ' ..
39
+ error ((' Variable %q for a List must be an array, ' ..
40
40
' got map' ):format (variableName ))
41
41
end
42
42
assert (variableType .ofType ~= nil , ' variableType.ofType must not be nil' )
@@ -49,7 +49,7 @@ local function checkVariableValue(variableName, value, variableType)
49
49
50
50
if isInputObject then
51
51
if type (value ) ~= ' table' then
52
- error ((' Variable "%s" for the InputObject "%s" must ' ..
52
+ error ((' Variable %q for the InputObject %q must ' ..
53
53
' be a Lua table, got %s' ):format (variableName , variableType .name ,
54
54
type (value )))
55
55
end
@@ -66,13 +66,13 @@ local function checkVariableValue(variableName, value, variableType)
66
66
for fieldName , _ in pairs (fieldNameSet ) do
67
67
local fieldValue = value [fieldName ]
68
68
if type (fieldName ) ~= ' string' then
69
- error ((' Field key of the variable "%s" for the ' ..
70
- ' InputObject "%s" must be a string, got %s' ):format (variableName ,
69
+ error ((' Field key of the variable %q for the ' ..
70
+ ' InputObject %q must be a string, got %s' ):format (variableName ,
71
71
variableType .name , type (fieldName )))
72
72
end
73
73
if type (variableType .fields [fieldName ]) == ' nil' then
74
- error ((' Unknown field "%s" of the variable "%s" ' ..
75
- ' for the InputObject "%s" ' ):format (fieldName , variableName ,
74
+ error ((' Unknown field %q of the variable %q ' ..
75
+ ' for the InputObject %q ' ):format (fieldName , variableName ,
76
76
variableType .name ))
77
77
end
78
78
@@ -90,27 +90,27 @@ local function checkVariableValue(variableName, value, variableType)
90
90
return
91
91
end
92
92
end
93
- error ((' Wrong variable "%s" for the Enum "%s" with value %s ' ):format (
93
+ error ((' Wrong variable %q for the Enum "%s" with value %q ' ):format (
94
94
variableName , variableType .name , value ))
95
95
end
96
96
97
97
if isScalar then
98
98
check (variableType .isValueOfTheType , ' isValueOfTheType' , ' function' )
99
99
if not variableType .isValueOfTheType (value ) then
100
- error ((' Wrong variable "%s" for the Scalar "%s" ' ):format (
100
+ error ((' Wrong variable %q for the Scalar %q ' ):format (
101
101
variableName , variableType .name ))
102
102
end
103
103
return
104
104
end
105
105
106
- error ((' Unknown type of the variable "%s" ' ):format (variableName ))
106
+ error ((' Unknown type of the variable %q ' ):format (variableName ))
107
107
end
108
108
109
109
local function validate_variables (context )
110
110
-- check that all variable values have corresponding variable declaration
111
111
for variableName , _ in pairs (context .variables or {}) do
112
112
if context .variableTypes [variableName ] == nil then
113
- error ((' There is no declaration for the variable "%s" ' )
113
+ error ((' There is no declaration for the variable %q ' )
114
114
:format (variableName ))
115
115
end
116
116
end
0 commit comments