是否有可能在 Errors[] 数组中引发多个错误,就像 hotchocolate 在您尝试使用未知属性时所做的那样?
如果是,我该怎么做?
我的用例是在使用 Validator.TryValidateObject 验证对象时返回错误集合
请参阅下面当字段未知时 hotchocolate 返回的内容。我想做同样的事情: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
}