(t *testing.T)
| 270 | } |
| 271 | |
| 272 | func TestMapTypes(t *testing.T) { |
| 273 | svcName := "test-service" |
| 274 | |
| 275 | testCases := []struct { |
| 276 | Name string |
| 277 | DSL func() |
| 278 | Expected typ |
| 279 | }{ |
| 280 | { |
| 281 | Name: "map_int_array_string", |
| 282 | DSL: dsls.MapIntKeyBodyDSL(svcName, "map_int_array_string"), |
| 283 | Expected: typ{ |
| 284 | Type: "object", |
| 285 | Props: []attr{{Name: "intmap", Val: typ{ |
| 286 | Type: "object", |
| 287 | AdditionalProperties: &additionalPropsType{ |
| 288 | Type: "array", |
| 289 | Items: &additionalPropsType{Type: "string"}, |
| 290 | }, |
| 291 | }}}, |
| 292 | }, |
| 293 | }, |
| 294 | { |
| 295 | Name: "map_int_array_object", |
| 296 | DSL: dsls.MapIntKeyObjectBodyDSL(svcName, "map_int_array_object"), |
| 297 | Expected: typ{ |
| 298 | Type: "object", |
| 299 | Props: []attr{{Name: "intmap", Val: typ{ |
| 300 | Type: "object", |
| 301 | AdditionalProperties: &additionalPropsType{ |
| 302 | Type: "array", |
| 303 | Items: &additionalPropsType{Ref: "#/components/schemas/MapData"}, |
| 304 | }, |
| 305 | }}}, |
| 306 | }, |
| 307 | }, |
| 308 | { |
| 309 | Name: "map_int_string", |
| 310 | DSL: dsls.MapIntKeyStringBodyDSL(svcName, "map_int_string"), |
| 311 | Expected: typ{ |
| 312 | Type: "object", |
| 313 | Props: []attr{{Name: "intmap", Val: typ{ |
| 314 | Type: "object", |
| 315 | AdditionalProperties: &additionalPropsType{Type: "string"}, |
| 316 | }}}, |
| 317 | }, |
| 318 | }, |
| 319 | { |
| 320 | Name: "map_int_object_direct", |
| 321 | DSL: dsls.MapIntKeyObjectDirectBodyDSL(svcName, "map_int_object_direct"), |
| 322 | Expected: typ{ |
| 323 | Type: "object", |
| 324 | Props: []attr{{Name: "intmap", Val: typ{ |
| 325 | Type: "object", |
| 326 | AdditionalProperties: &additionalPropsType{Ref: "#/components/schemas/MapData"}, |
| 327 | }}}, |
| 328 | }, |
| 329 | }, |
nothing calls this directly
no test coverage detected