Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/GraphQL.FluentValidation/ValidationMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ static ExecutionError ToExecutionError(ValidationFailure failure)
{
return new($"{failure.PropertyName}: {failure.ErrorMessage}")
{
Path = new List<string> {failure.PropertyName}
Path = new List<string> {failure.PropertyName},
Code = failure.ErrorCode
};
}
}
16 changes: 14 additions & 2 deletions src/Tests/IntegrationTests.AsyncComplexInvalid.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@
"message": "Inner: Inner async test failed msg.",
"path": [
"Inner"
]
],
"extensions": {
"code": "AsyncPredicateValidator",
"codes": [
"AsyncPredicateValidator"
]
}
},
{
"message": "Inner.Content: 'Content' must not be empty.",
"path": [
"Inner.Content"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
}
],
"data": {
Expand Down
8 changes: 7 additions & 1 deletion src/Tests/IntegrationTests.AsyncInvalid.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
"message": "Content: The specified condition was not met for 'Content'.",
"path": [
"Content"
]
],
"extensions": {
"code": "AsyncPredicateValidator",
"codes": [
"AsyncPredicateValidator"
]
}
}
],
"data": {
Expand Down
16 changes: 14 additions & 2 deletions src/Tests/IntegrationTests.ComplexInvalid.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@
"message": "Inner.Content: 'Content' must not be empty.",
"path": [
"Inner.Content"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
},
{
"message": "Items: 'Items' must not be empty.",
"path": [
"Items"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
}
],
"data": {
Expand Down
16 changes: 14 additions & 2 deletions src/Tests/IntegrationTests.ComplexInvalid2.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@
"message": "Inner: 'Inner' must not be empty.",
"path": [
"Inner"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
},
{
"message": "Items: 'Items' must not be empty.",
"path": [
"Items"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
}
],
"data": {
Expand Down
16 changes: 14 additions & 2 deletions src/Tests/IntegrationTests.DerivedComplexInvalid.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,25 @@
"message": "Inner.Content: 'Content' must not be empty.",
"path": [
"Inner.Content"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
},
{
"message": "Items: 'Items' must not be empty.",
"path": [
"Items"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
}
],
"data": {
Expand Down
8 changes: 7 additions & 1 deletion src/Tests/IntegrationTests.Invalid.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
"message": "Content: 'Content' must not be empty.",
"path": [
"Content"
]
],
"extensions": {
"code": "NotEmptyValidator",
"codes": [
"NotEmptyValidator"
]
}
}
],
"data": {
Expand Down