-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
556af9d
commit b5e8574
Showing
6 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Graph.ArgumentValidator; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Shared | ||
{ | ||
[Validatable] | ||
public class Student | ||
{ | ||
[Required(AllowEmptyStrings = false)] | ||
public string FirstName { get; set; } | ||
[Required] | ||
public ScoreCardInfo ScoreCard { get; set; } | ||
|
||
public class ScoreCardInfo | ||
{ | ||
[Required] | ||
public int TotalScore { get; set; } | ||
|
||
[Required(AllowEmptyStrings = false)] | ||
public string School { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
test/__snapshots__/ValidationTests.Ensure_Validation_Works_On_StudentWithOutScoreCard.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"message": "\u0060scoreCard\u0060 is a required field and cannot be null.", | ||
"locations": [ | ||
{ | ||
"line": 1, | ||
"column": 26 | ||
} | ||
], | ||
"path": [ | ||
"checkPass" | ||
], | ||
"extensions": { | ||
"field": "scoreCard", | ||
"specifiedBy": "http://spec.graphql.org/October2021/#sec-Input-Object-Required-Fields" | ||
} | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
test/__snapshots__/ValidationTests.Ensure_Validation_Works_On_StudentWithScoreCard.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"data": { | ||
"checkPass": "Varun at Gayatri is passed" | ||
} | ||
} |