@@ -148,58 +148,76 @@ func TestGetUnrecognizedFormats(t *testing.T) {
148148 }{
149149 {
150150 name : "empty format" ,
151- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "" }},
151+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "" , Type : [] string { "string" } }},
152152 compatibilityVersion : version .MajorMinor (1 , 0 ),
153153 expectedFormats : []string {},
154154 },
155155 {
156156 name : "recognized format at version 1.0" ,
157- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "email" }},
157+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "email" , Type : [] string { "string" } }},
158158 compatibilityVersion : version .MajorMinor (1 , 0 ),
159159 expectedFormats : []string {},
160160 },
161161 {
162162 name : "unrecognized format at version 1.0" ,
163- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "unknown-format" }},
163+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "unknown-format" , Type : [] string { "string" } }},
164164 compatibilityVersion : version .MajorMinor (1 , 0 ),
165165 expectedFormats : []string {"unknown-format" },
166166 },
167167 {
168168 name : "recognized format with normalization" ,
169- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8s-short-name" }},
169+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8s-short-name" , Type : [] string { "string" } }},
170170 compatibilityVersion : version .MajorMinor (1 , 34 ),
171171 expectedFormats : []string {},
172172 },
173173 {
174174 name : "unrecognized format with normalization" ,
175- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8s-long-name" }},
175+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8s-long-name" , Type : [] string { "string" } }},
176176 compatibilityVersion : version .MajorMinor (1 , 33 ),
177177 expectedFormats : []string {"k8s-long-name" },
178178 },
179179 {
180180 name : "format introduced in later version" ,
181- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8s-short-name" }},
181+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8s-short-name" , Type : [] string { "string" } }},
182182 compatibilityVersion : version .MajorMinor (1 , 0 ),
183183 expectedFormats : []string {"k8s-short-name" },
184184 },
185185 {
186186 name : "format with dash normalization" ,
187- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8sshortname" }},
187+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "k8sshortname" , Type : [] string { "string" } }},
188188 compatibilityVersion : version .MajorMinor (1 , 34 ),
189189 expectedFormats : []string {},
190190 },
191191 {
192192 name : "recognized format at exact version" ,
193- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "uuid" }},
193+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "uuid" , Type : [] string { "string" } }},
194194 compatibilityVersion : version .MajorMinor (1 , 0 ),
195195 expectedFormats : []string {},
196196 },
197197 {
198198 name : "recognized format at higher version" ,
199- schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "email" }},
199+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "email" , Type : [] string { "string" } }},
200200 compatibilityVersion : version .MajorMinor (1 , 35 ),
201201 expectedFormats : []string {},
202202 },
203+ {
204+ name : "unrecognized format for integer type is not reported" ,
205+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "unknown-format" , Type : []string {"integer" }}},
206+ compatibilityVersion : version .MajorMinor (1 , 0 ),
207+ expectedFormats : []string {},
208+ },
209+ {
210+ name : "unrecognized format for string,null type is not reported" ,
211+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "unknown-format" , Type : []string {"string" , "null" }}},
212+ compatibilityVersion : version .MajorMinor (1 , 0 ),
213+ expectedFormats : []string {},
214+ },
215+ {
216+ name : "unrecognized format for no type is not reported" ,
217+ schema : & spec.Schema {SchemaProps : spec.SchemaProps {Format : "unknown-format" }},
218+ compatibilityVersion : version .MajorMinor (1 , 0 ),
219+ expectedFormats : []string {},
220+ },
203221 }
204222
205223 for _ , tc := range testCases {
0 commit comments