1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-01 23:36:58 +00:00

Fix code generator

This commit is contained in:
Darren Shepherd
2017-11-21 16:16:45 -07:00
parent d30c9c30f6
commit 59d2d58c3e
3 changed files with 10 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ type GenericController interface {
Informer() cache.SharedIndexInformer
AddHandler(handler HandlerFunc)
Enqueue(namespace, name string)
Start(threadiness int, ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type genericController struct {

View File

@@ -43,7 +43,7 @@ type {{.schema.CodeName}}Controller interface {
Informer() cache.SharedIndexInformer
AddHandler(handler {{.schema.CodeName}}HandlerFunc)
Enqueue(namespace, name string)
Start(threadiness int, ctx context.Context) error
Start(ctx context.Context, threadiness int) error
}
type {{.schema.CodeName}}Interface interface {

View File

@@ -33,6 +33,14 @@ func (r *RenameReference) ModifySchema(schema *types.Schema, schemas *types.Sche
return err
}
mappers = append(mappers, move)
} else if definition.IsArrayType(field.Type) && definition.IsReferenceType(definition.SubType(field.Type)) && strings.HasSuffix(name, "Names") {
newName := strings.TrimSuffix(name, "Names") + "Ids"
move := Move{From: name, To: newName}
if err := move.ModifySchema(schema, schemas); err != nil {
return err
}
mappers = append(mappers, move)
}
}