loadModulesFromRegularMap loads modules from val, where val is a map[string]json.RawMessage. Map keys are NOT interpreted as module names, so module names are still expected to appear inline with the objects.
(namespace, inlineModuleKey string, val reflect.Value)
| 316 | // Map keys are NOT interpreted as module names, so module names are still expected to appear |
| 317 | // inline with the objects. |
| 318 | func (ctx Context) loadModulesFromRegularMap(namespace, inlineModuleKey string, val reflect.Value) (map[string]any, error) { |
| 319 | mods := make(map[string]any) |
| 320 | iter := val.MapRange() |
| 321 | for iter.Next() { |
| 322 | k := iter.Key() |
| 323 | v := iter.Value() |
| 324 | mod, err := ctx.loadModuleInline(inlineModuleKey, namespace, v.Interface().(json.RawMessage)) |
| 325 | if err != nil { |
| 326 | return nil, fmt.Errorf("key %s: %v", k, err) |
| 327 | } |
| 328 | mods[k.String()] = mod |
| 329 | } |
| 330 | return mods, nil |
| 331 | } |
| 332 | |
| 333 | // loadModuleMap loads modules from a ModuleMap, i.e. map[string]any, where the key is the |
| 334 | // module name. With a module map, module names do not need to be defined inline with their values. |
no test coverage detected