You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Nullable _-> Ok <| KeyValuePair(varDef.Name,null)
705
705
| Named typeDef -> Error [{
706
-
Message = $"Variable '$%s{varDef.Name}' of type '%s{typeDef.Name}!' is not nullable but neither value was provided, nor a default value was specified."
706
+
Message = $"A variable '$%s{varDef.Name}' of type '%s{typeDef.Name}!' is not nullable but neither value was provided, nor a default value was specified."
Copy file name to clipboardExpand all lines: src/FSharp.Data.GraphQL.Shared/Validation.fs
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -909,8 +909,8 @@ module Ast =
909
909
match def.Name with
910
910
|_when count <2-> Success
911
911
| Some operationName ->
912
-
AstError.AsResult $"Variable '$%s{var.VariableName}' in operation '%s{operationName}' is declared %i{count} times. Variables must be unique in their operations."
913
-
| None -> AstError.AsResult $"Variable '$%s{var.VariableName}' is declared %i{count} times in the operation. Variables must be unique in their operations.")
912
+
AstError.AsResult $"A variable '$%s{var.VariableName}' in operation '%s{operationName}' is declared %i{count} times. Variables must be unique in their operations."
913
+
| None -> AstError.AsResult $"A variable '$%s{var.VariableName}' is declared %i{count} times in the operation. Variables must be unique in their operations.")
match def.Name, ctx.Schema.TryGetInputType(var.Type)with
923
923
| Some operationName, None ->
924
-
AstError.AsResult($"Variable '$%s{var.VariableName}' in operation '%s{operationName}' has a type that is not an input type defined by the schema (%s{var.Type.ToString ()}).")
924
+
AstError.AsResult($"A variable '$%s{var.VariableName}' in operation '%s{operationName}' has a type that is not an input type defined by the schema (%s{var.Type.ToString ()}).")
925
925
| None, None ->
926
-
AstError.AsResult($"Variable '$%s{var.VariableName}' has a type is not an input type defined by the schema (%s{var.Type.ToString ()}).")
926
+
AstError.AsResult($"A variable '$%s{var.VariableName}' has a type is not an input type defined by the schema (%s{var.Type.ToString ()}).")
927
927
|_-> Success)
928
928
|_-> Success)
929
929
@@ -934,7 +934,7 @@ module Ast =
934
934
| VariableName varName ->
935
935
if variableDefinitions |> Set.contains varName
936
936
then Success
937
-
else AstError.AsResult($"Variable '%s{varName}' is referenced in an argument '%s{arg.Name}' of directive '%s{directive.Name}' of field with alias or name '%O{path.Head}', but that variable is not defined in the operation.", path)
937
+
else AstError.AsResult($"A variable '%s{varName}' is referenced in an argument '%s{arg.Name}' of directive '%s{directive.Name}' of field with alias or name '%O{path.Head}', but that variable is not defined in the operation.", path)
938
938
|_-> Success)
939
939
940
940
let recprivatecheckVariablesDefinedInSelection(fragmentDefinitions :FragmentDefinition list)(variableDefinitions :Set<string>)(path :FieldPath)=
@@ -948,7 +948,7 @@ module Ast =
948
948
| VariableName varName ->
949
949
if variableDefinitions |> Set.contains varName
950
950
then Success
951
-
else AstError.AsResult($"Variable '$%s{varName}' is referenced in argument '%s{arg.Name}' of field with alias or name '%s{field.AliasOrName}', but that variable is not defined in the operation.")
951
+
else AstError.AsResult($"A variable '$%s{varName}' is referenced in argument '%s{arg.Name}' of field with alias or name '%s{field.AliasOrName}', but that variable is not defined in the operation.")
| Some operationName,_-> AstError.AsResult $"Variable '$%s{varDef.VariableName}' is not used in operation '%s{operationName}'. Every variable must be used."
1017
-
| None,_-> AstError.AsResult $"Variable '$%s{varDef.VariableName}' is not used in operation. Every variable must be used.")
1016
+
| Some operationName,_-> AstError.AsResult $"A variable '$%s{varDef.VariableName}' is not used in operation '%s{operationName}'. Every variable must be used."
1017
+
| None,_-> AstError.AsResult $"A variable '$%s{varDef.VariableName}' is not used in operation. Every variable must be used.")
1018
1018
|_-> Success)
1019
1019
1020
1020
let recprivateareTypesCompatible(variableTypeRef :IntrospectionTypeRef)(locationTypeRef :IntrospectionTypeRef)=
@@ -1041,7 +1041,7 @@ module Ast =
1041
1041
| VariableName varName ->
1042
1042
match varNamesAndTypeRefs.TryFind(varName)with
1043
1043
| Some (varDef, variableTypeRef)->
1044
-
leterr= AstError.AsResult($"Variable '$%s{varName}' can not be used in its reference. The type of the variable definition is not compatible with the type of its reference.", path)
1044
+
leterr= AstError.AsResult($"A variable '$%s{varName}' can not be used in its reference. The type of the variable definition is not compatible with the type of its reference.", path)
1045
1045
match inputs |> Array.tryFind (fun x -> x.Name = arg.Name)with
"Variable '$cat' in operation 'takesCat' has a type that is not an input type defined by the schema (Cat)."
1211
+
"A variable '$cat' in operation 'takesCat' has a type that is not an input type defined by the schema (Cat)."
1212
1212
GQLProblemDetails.CreateValidation
1213
-
"Variable '$dog' in operation 'takesDogBang' has a type that is not an input type defined by the schema (Dog!)."
1213
+
"A variable '$dog' in operation 'takesDogBang' has a type that is not an input type defined by the schema (Dog!)."
1214
1214
GQLProblemDetails.CreateValidation
1215
-
"Variable '$pets' in operation 'takesListOfPet' has a type that is not an input type defined by the schema ([Pet])."
1215
+
"A variable '$pets' in operation 'takesListOfPet' has a type that is not an input type defined by the schema ([Pet])."
1216
1216
GQLProblemDetails.CreateValidation
1217
-
"Variable '$catOrDog' in operation 'takesCatOrDog' has a type that is not an input type defined by the schema (CatOrDog)."
1217
+
"A variable '$catOrDog' in operation 'takesCatOrDog' has a type that is not an input type defined by the schema (CatOrDog)."
1218
1218
]
1219
1219
letshouldFail=
1220
1220
getContext query1
@@ -1256,7 +1256,7 @@ let ``Validation should grant that all referenced variables are defined variable
1256
1256
|> equals (
1257
1257
ValidationError [
1258
1258
GQLProblemDetails.CreateValidation
1259
-
"Variable '$atOtherHomes' is referenced in argument 'atOtherHomes' of field with alias or name 'isHousetrained', but that variable is not defined in the operation."
1259
+
"A variable '$atOtherHomes' is referenced in argument 'atOtherHomes' of field with alias or name 'isHousetrained', but that variable is not defined in the operation."
1260
1260
]
1261
1261
)
1262
1262
letquery2=
@@ -1320,10 +1320,10 @@ fragment isHouseTrainedCyclic on Dog {
1320
1320
}"""
1321
1321
letexpectedFailureResult=
1322
1322
ValidationError [
1323
-
GQLProblemDetails.CreateValidation "Variable '$atOtherHomes' is not used in operation 'variableUnused'. Every variable must be used."
1324
-
GQLProblemDetails.CreateValidation "Variable '$atOtherHomes' is not used in operation 'variableNotUsedWithinFragment'. Every variable must be used."
1325
-
GQLProblemDetails.CreateValidation "Variable '$extra' is not used in operation 'queryWithExtraVar'. Every variable must be used."
1326
-
GQLProblemDetails.CreateValidation "Variable '$extra' is not used in operation 'unusedCyclic'. Every variable must be used."
1323
+
GQLProblemDetails.CreateValidation "A variable '$atOtherHomes' is not used in operation 'variableUnused'. Every variable must be used."
1324
+
GQLProblemDetails.CreateValidation "A variable '$atOtherHomes' is not used in operation 'variableNotUsedWithinFragment'. Every variable must be used."
1325
+
GQLProblemDetails.CreateValidation "A variable '$extra' is not used in operation 'queryWithExtraVar'. Every variable must be used."
1326
+
GQLProblemDetails.CreateValidation "A variable '$extra' is not used in operation 'unusedCyclic'. Every variable must be used."
0 commit comments