Merge pull request #47 from jwetzell/fix/module-id-required

add check to prevent empty module Id
This commit is contained in:
Joel Wetzell
2026-02-02 13:00:36 -06:00
committed by GitHub

View File

@@ -34,6 +34,18 @@ func NewRouter(config config.Config) (*Router, []module.ModuleError, []route.Rou
for moduleIndex, moduleDecl := range config.Modules {
if moduleDecl.Id == "" {
if moduleErrors == nil {
moduleErrors = []module.ModuleError{}
}
moduleErrors = append(moduleErrors, module.ModuleError{
Index: moduleIndex,
Config: moduleDecl,
Error: errors.New("module id cannot be empty"),
})
continue
}
moduleInfo, ok := module.ModuleRegistry[moduleDecl.Type]
if !ok {
if moduleErrors == nil {