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
/// Given an error e, call ParseError in the given context's Schema to convert it into
272
-
/// a list of one or more <see herf="IGQLErrors">IGQLErrors</see>, then convert those to a list of <see href="GQLProblemDetails">GQLProblemDetails</see>.
273
-
letprivateresolverError path ctx e = ctx.Schema.ParseError path e |> List.map (GQLProblemDetails.OfFieldError (path |> List.rev))
272
+
/// a list of one or more <see href="IGQLErrors">IGQLErrors</see>, then convert those
273
+
/// to a list of <see href="GQLProblemDetails">GQLProblemDetails</see>.
274
+
letprivateresolverError path ctx e = ctx.Schema.ParseError path e |> List.map (GQLProblemDetails.OfFieldExecutionError (path |> List.rev))
274
275
// Helper functions for generating more specific <see href="GQLProblemDetails">GQLProblemDetails</see>.
275
276
letprivatenullResolverError name path ctx = resolverError path ctx (GraphQLException <| sprintf "Non-Null field %s resolved as a null!" name)
276
277
letprivatecoercionError value tyName path ctx = resolverError path ctx (GraphQLException <| sprintf "Value '%O' could not be coerced to scalar %s" value tyName)
@@ -642,9 +643,9 @@ let private executeSubscription (resultSet: (string * ExecutionInfo) []) (ctx: E
| Nullable _-> Ok <| KeyValuePair(vardef.Name,null)
702
-
| Named typeDef -> Error [{new IGQLError withmember_.Message= $"Variable '$%s{vardef.Name}' of required type '%s{typeDef.Name}!' was not provided."}]
703
-
|_-> System.Diagnostics.Debug.Fail $"{vardef.TypeDef.GetType().Name} is not Named"; failwith "Impossible case"
703
+
match varDef.TypeDef with
704
+
| Nullable _-> Ok <| KeyValuePair(varDef.Name,null)
705
+
| Named typeDef -> Error [{
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."
707
+
ErrorKind = InputCoercion
708
+
InputSource = Variable varDef
709
+
Path =[]
710
+
FieldErrorDetails = ValueNone
711
+
}:> IGQLError ]
712
+
|_-> System.Diagnostics.Debug.Fail $"{varDef.TypeDef.GetType().Name} is not Named"; failwith "Impossible case"
@@ -142,11 +143,17 @@ type Executor<'Root>(schema: ISchema<'Root>, middlewares : IExecutorMiddleware s
142
143
| Mutation ->
143
144
match schema.Mutation with
144
145
| Some m -> Ok m
145
-
| None -> Error <|[ GQLProblemDetails.Create "Operation to be executed is of type mutation, but no mutation root object was defined in current schema"]
"Operation to be executed is of type mutation, but no mutation root object was defined in current schema",
148
+
ErrorKind.Validation
149
+
)]
146
150
| Subscription ->
147
151
match schema.Subscription with
148
152
| Some s -> Ok <|upcast s
149
-
| None -> Error <|[ GQLProblemDetails.Create "Operation to be executed is of type subscription, but no subscription root object was defined in the current schema"]
0 commit comments