Is it possible to raise multiple errors in Errors[] array, like hotchocolate does when you try to use unknow properties ?
If yes, how can I do this ?
My use case is to return errors collection when validating an object with Validator.TryValidateObject
See below what hotchocolate returns when fields are unknow. I would like to do the same : multiple elements in Errors[] array.
{
"Label": null,
"Path": null,
"Data": null,
"Errors": [
{
"Message": "The field `date` does not exist on the type `EcritureConnection`.",
"Code": null,
"Path": {
"Parent": null,
"Depth": 0,
"Name": "ecritures"
},
"Locations": [
{
"Line": 1,
"Column": 75
}
],
"Extensions": {
"type": "EcritureConnection",
"field": "date",
"responseName": "date",
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Field-Selections-on-Objects-Interfaces-and-Unions-Types"
},
"Exception": null
},
{
"Message": "The field `intitule` does not exist on the type `EcritureConnection`.",
"Code": null,
"Path": {
"Parent": null,
"Depth": 0,
"Name": "ecritures"
},
"Locations": [
{
"Line": 1,
"Column": 80
}
],
"Extensions": {
"type": "EcritureConnection",
"field": "intitule",
"responseName": "intitule",
"specifiedBy": "http://spec.graphql.org/June2018/#sec-Field-Selections-on-Objects-Interfaces-and-Unions-Types"
},
"Exception": null
}
],
"Extensions": null,
"ContextData": {
"HotChocolate.Execution.ValidationErrors": true
},
"HasNext": null
}