Skip to content

Commit 20646ca

Browse files
committed
Fixed outputting input object mismatch fields list within error messages
1 parent ff6221b commit 20646ca

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/FSharp.Data.GraphQL.Server/Values.fs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ let rec internal compileByType
147147

148148
let exceptions : exn list = [
149149
if missingParameters.Any () then
150-
InvalidInputTypeException (
151-
$"Input object '%s{objDef.Name}' refers to type '%O{objtype}', but mandatory constructor parameters '%A{missingParameters}' don't match any of the defined input fields",
152-
missingParameters.ToImmutableHashSet ()
153-
)
150+
let message =
151+
let ``params`` = String.Join ("', '", missingParameters)
152+
$"Input object '%s{objDef.Name}' refers to type '%O{objtype}', but mandatory constructor parameters '%s{``params``}' don't match any of the defined GraphQL input fields"
153+
InvalidInputTypeException (message, missingParameters.ToImmutableHashSet ())
154154
if nullableMismatchParameters.Any () then
155-
InvalidInputTypeException (
156-
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but optional fields '%A{missingParameters}' are not optional parameters of the constructor",
157-
nullableMismatchParameters.ToImmutableHashSet ()
158-
)
155+
let message =
156+
let ``params`` = String.Join ("', '", nullableMismatchParameters)
157+
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but constructor parameters for optional GraphQL fields '%s{``params``}' are not optional"
158+
InvalidInputTypeException (message, nullableMismatchParameters.ToImmutableHashSet ())
159159
if typeMismatchParameters.Any () then
160-
InvalidInputTypeException (
161-
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but fields '%A{typeMismatchParameters}' have different types than constructor parameters",
162-
typeMismatchParameters.ToImmutableHashSet ()
163-
)
160+
let message =
161+
let ``params`` = String.Join ("', '", typeMismatchParameters)
162+
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but GraphQL fields '%s{``params``}' have different types than constructor parameters"
163+
InvalidInputTypeException (message, typeMismatchParameters.ToImmutableHashSet ())
164164
]
165165
match exceptions with
166166
| [] -> ()

0 commit comments

Comments
 (0)