@@ -14,11 +14,13 @@ import (
14
14
)
15
15
16
16
func TestComparingMappings (t * testing.T ) {
17
+ defaultSpecVersion := "3.3.0"
17
18
cases := []struct {
18
19
title string
19
20
preview map [string ]any
20
21
actual map [string ]any
21
22
schema []FieldDefinition
23
+ spec string
22
24
expectedErrors []string
23
25
}{
24
26
{
@@ -502,6 +504,7 @@ func TestComparingMappings(t *testing.T) {
502
504
External : "ecs" ,
503
505
},
504
506
},
507
+ spec : "1.0.0" ,
505
508
expectedErrors : []string {
506
509
`field "error.field" is undefined: missing definition for path` ,
507
510
// should status.field return error ? or should it be ignored?
@@ -593,12 +596,38 @@ func TestComparingMappings(t *testing.T) {
593
596
},
594
597
expectedErrors : []string {},
595
598
},
599
+ {
600
+ title : "skip nested types before spec 3.0.1" ,
601
+ preview : map [string ]any {
602
+ "foo" : map [string ]any {
603
+ "type" : "nested" ,
604
+ },
605
+ },
606
+ actual : map [string ]any {
607
+ "foo" : map [string ]any {
608
+ "type" : "nested" ,
609
+ "properties" : map [string ]any {
610
+ "bar" : map [string ]any {
611
+ "type" : "long" ,
612
+ },
613
+ },
614
+ },
615
+ },
616
+ spec : "3.0.0" ,
617
+ schema : []FieldDefinition {},
618
+ expectedErrors : []string {},
619
+ },
596
620
}
597
621
598
622
for _ , c := range cases {
599
623
t .Run (c .title , func (t * testing.T ) {
600
624
logger .EnableDebugMode ()
625
+ specVersion := defaultSpecVersion
626
+ if c .spec != "" {
627
+ specVersion = c .spec
628
+ }
601
629
v , err := CreateValidatorForMappings ("" , nil ,
630
+ WithMappingValidatorSpecVersion (specVersion ),
602
631
WithMappingValidatorFallbackSchema (c .schema ),
603
632
WithMappingValidatorDisabledDependencyManagement (),
604
633
)
0 commit comments