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

Function ToStringMap

http/codegen/openapi/json_schema.go:432–449  ·  view source on GitHub ↗

ToStringMap converts map[any]any to a map[string]any when possible.

(val any)

Source from the content-addressed store, hash-verified

430// ToStringMap converts map[any]any to a map[string]any
431// when possible.
432func ToStringMap(val any) any {
433 switch actual := val.(type) {
434 case map[any]any:
435 m := make(map[string]any)
436 for k, v := range actual {
437 m[ToString(k)] = ToStringMap(v)
438 }
439 return m
440 case []any:
441 mapSlice := make([]any, len(actual))
442 for i, e := range actual {
443 mapSlice[i] = ToStringMap(e)
444 }
445 return mapSlice
446 default:
447 return actual
448 }
449}
450
451// MarshalJSON returns the JSON encoding of s.
452func (s *Schema) MarshalJSON() ([]byte, error) {

Callers 2

paramForFunction · 0.92
buildAttributeSchemaFunction · 0.85

Calls 1

ToStringFunction · 0.85

Tested by

no test coverage detected