@@ -353,6 +353,7 @@ type NodeTypeDefinitionBasic struct {
353353 Label string `yaml:"label,omitempty" json:"label,omitempty" bson:"label,omitempty"`
354354 Compact bool `yaml:"compact,omitempty" json:"compact,omitempty" bson:"compact,omitempty"`
355355 GhMeta GhMetadata `yaml:"gh_meta" json:"gh_meta" bson:"gh_meta"`
356+ Aliases []string `yaml:"aliases,omitempty" json:"aliases,omitempty" bson:"aliases,omitempty"`
356357
357358 // Used by the gateway to indicate errors when being retreived
358359 Error string `yaml:"error,omitempty" json:"error,omitempty" bson:"error,omitempty"`
@@ -561,6 +562,17 @@ func RegisterNodeFactory(nodeDefStr string, fn nodeFactoryFunc) error {
561562 nodeDef .FactoryFn = fn
562563 registries [id ] = nodeDef
563564
565+ for _ , alias := range nodeDef .Aliases {
566+ if strings .Contains (alias , "_" ) {
567+ return CreateErr (nil , nil , "alias '%v' must not contain underscores" , alias )
568+ }
569+ aliasId := fmt .Sprintf ("%v@v%v" , alias , nodeDef .Version )
570+ if _ , exists := registries [aliasId ]; exists {
571+ return CreateErr (nil , nil , "alias '%v' already registered" , aliasId )
572+ }
573+ registries [aliasId ] = nodeDef
574+ }
575+
564576 return nil
565577}
566578
0 commit comments