Можно ли вызвать множественные ошибки в массиве Errors [], как это делает hotchocolate, когда вы пытаетесь использовать неизвестные свойства?
Если да, то как я могу это сделать?
Мой вариант использования - вернуть коллекцию ошибок при проверке объекта с помощью Validator.TryValidateObject
См. Ниже, что возвращается горячий шоколад, когда поля неизвестны. Я хочу сделать то же самое: несколько элементов в массиве Errors [].
{
"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
}