MCPcopy Create free account
hub / github.com/goadesign/goa / TestMapTypes

Function TestMapTypes

http/codegen/openapi/v3/types_test.go:272–401  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

270}
271
272func 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 },

Callers

nothing calls this directly

Calls 12

MapIntKeyBodyDSLFunction · 0.92
MapIntKeyObjectBodyDSLFunction · 0.92
MapIntKeyStringBodyDSLFunction · 0.92
MapStringKeyIntBodyDSLFunction · 0.92
RunDSLFunction · 0.92
buildBodyTypesFunction · 0.85
nameFromRefFunction · 0.85
matchesSchemaFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected