@@ -13,8 +13,10 @@ func TestDictCompile(t *testing.T) {
1313 {
1414 Name : "{KeysValidator:String,ValuesValidator:String}" ,
1515 Compiler : & schema.Dict {
16- KeysValidator : & schema.String {},
17- ValuesValidator : & schema.String {},
16+ KeysValidator : & schema.String {},
17+ Values : schema.Field {
18+ Validator : & schema.String {},
19+ },
1820 },
1921 ReferenceChecker : fakeReferenceChecker {},
2022 },
@@ -25,19 +27,19 @@ func TestDictCompile(t *testing.T) {
2527 Error : "invalid regexp: error parsing regexp: missing closing ]: `[invalid re`" ,
2628 },
2729 {
28- Name : "{ValuesValidator :String{Regexp:invalid}}" ,
29- Compiler : & schema.Dict {ValuesValidator : & schema.String {Regexp : "[invalid re" }},
30+ Name : "{Values.Validator :String{Regexp:invalid}}" ,
31+ Compiler : & schema.Dict {Values : schema. Field { Validator : & schema.String {Regexp : "[invalid re" } }},
3032 ReferenceChecker : fakeReferenceChecker {},
3133 Error : "invalid regexp: error parsing regexp: missing closing ]: `[invalid re`" ,
3234 },
3335 {
34- Name : "{ValuesValidator :Reference{Path:valid}}" ,
35- Compiler : & schema.Dict {ValuesValidator : & schema.Reference {Path : "foo" }},
36+ Name : "{Values.Validator :Reference{Path:valid}}" ,
37+ Compiler : & schema.Dict {Values : schema. Field { Validator : & schema.Reference {Path : "foo" } }},
3638 ReferenceChecker : fakeReferenceChecker {"foo" : {}},
3739 },
3840 {
39- Name : "{ValuesValidator :Reference{Path:invalid}}" ,
40- Compiler : & schema.Dict {ValuesValidator : & schema.Reference {Path : "bar" }},
41+ Name : "{Values.Validator :Reference{Path:invalid}}" ,
42+ Compiler : & schema.Dict {Values : schema. Field { Validator : & schema.Reference {Path : "bar" } }},
4143 ReferenceChecker : fakeReferenceChecker {"foo" : {}},
4244 Error : "can't find resource 'bar'" ,
4345 },
@@ -68,20 +70,20 @@ func TestDictValidate(t *testing.T) {
6870 Error : "invalid key `ba': is shorter than 3" ,
6971 },
7072 {
71- Name : `{ValuesValidator :Bool}.Validate(valid)` ,
72- Validator : & schema.Dict {ValuesValidator : & schema.Bool {}},
73+ Name : `{Values.Validator :Bool}.Validate(valid)` ,
74+ Validator : & schema.Dict {Values : schema. Field { Validator : & schema.Bool {} }},
7375 Input : map [string ]interface {}{"foo" : true , "bar" : false },
7476 Expect : map [string ]interface {}{"foo" : true , "bar" : false },
7577 },
7678 {
77- Name : `{ValuesValidator :Bool}.Validate({"foo":true,"bar":"value"})` ,
78- Validator : & schema.Dict {ValuesValidator : & schema.Bool {}},
79+ Name : `{Values.Validator :Bool}.Validate({"foo":true,"bar":"value"})` ,
80+ Validator : & schema.Dict {Values : schema. Field { Validator : & schema.Bool {} }},
7981 Input : map [string ]interface {}{"foo" : true , "bar" : "value" },
8082 Error : "invalid value for key `bar': not a Boolean" ,
8183 },
8284 {
83- Name : `{ValuesValidator :String}.Validate("")` ,
84- Validator : & schema.Dict {ValuesValidator : & schema.String {}},
85+ Name : `{Values.Validator :String}.Validate("")` ,
86+ Validator : & schema.Dict {Values : schema. Field { Validator : & schema.String {} }},
8587 Input : "" ,
8688 Error : "not a dict" ,
8789 },
0 commit comments