Skip to content

Commit

Permalink
Fixed outputting input object mismatch fields list within error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
xperiandri committed Dec 7, 2024
1 parent ff6221b commit 20646ca
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/FSharp.Data.GraphQL.Server/Values.fs
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,20 @@ let rec internal compileByType

let exceptions : exn list = [
if missingParameters.Any () then
InvalidInputTypeException (
$"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",
missingParameters.ToImmutableHashSet ()
)
let message =
let ``params`` = String.Join ("', '", missingParameters)
$"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"
InvalidInputTypeException (message, missingParameters.ToImmutableHashSet ())
if nullableMismatchParameters.Any () then
InvalidInputTypeException (
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but optional fields '%A{missingParameters}' are not optional parameters of the constructor",
nullableMismatchParameters.ToImmutableHashSet ()
)
let message =
let ``params`` = String.Join ("', '", nullableMismatchParameters)
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but constructor parameters for optional GraphQL fields '%s{``params``}' are not optional"
InvalidInputTypeException (message, nullableMismatchParameters.ToImmutableHashSet ())
if typeMismatchParameters.Any () then
InvalidInputTypeException (
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but fields '%A{typeMismatchParameters}' have different types than constructor parameters",
typeMismatchParameters.ToImmutableHashSet ()
)
let message =
let ``params`` = String.Join ("', '", typeMismatchParameters)
$"Input object %s{objDef.Name} refers to type '%O{objtype}', but GraphQL fields '%s{``params``}' have different types than constructor parameters"
InvalidInputTypeException (message, typeMismatchParameters.ToImmutableHashSet ())
]
match exceptions with
| [] -> ()
Expand Down

0 comments on commit 20646ca

Please sign in to comment.