File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
rust-workspace/crates/ntc-data-packages/tests/data_packages Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,27 @@ fn validate_example_person_schema() {
7777 json_dataset. validate ( ) . expect ( "validate should succeed" ) ;
7878}
7979
80+ #[ test]
81+ fn validate_example_person_schema_age_missing ( ) {
82+ let json_dataset = JsonDataset {
83+ schema : example_person_schema ( ) ,
84+ data : json ! ( {
85+ "firstName" : "Jane" ,
86+ "lastName" : "Doe" ,
87+ } ) ,
88+ } ;
89+ let err = json_dataset. validate ( ) . unwrap_err ( ) ;
90+ k9:: snapshot!(
91+ format_err( err) ,
92+ r#"
93+ data validation failed
94+
95+ Caused by:
96+ validation errors: "age" is a required property (path= schema=/required)
97+ "#
98+ ) ;
99+ }
100+
80101#[ test]
81102fn validate_example_person_schema_invalid ( ) {
82103 let json_dataset = JsonDataset {
@@ -120,7 +141,8 @@ fn example_person_schema() -> Value {
120141 "type" : "integer" ,
121142 "minimum" : 0
122143 }
123- }
144+ } ,
145+ "required" : [ "firstName" , "lastName" , "age" ] ,
124146 } )
125147}
126148
You can’t perform that action at this time.
0 commit comments