1
0
mirror of https://github.com/rancher/types.git synced 2025-09-01 05:09:10 +00:00

Update norman dependency

This commit is contained in:
Craig Jellick
2017-12-11 20:29:05 -07:00
committed by Darren Shepherd
parent 14ea6247f0
commit 33f2e1ebdb
5 changed files with 20 additions and 10 deletions

View File

@@ -81,7 +81,13 @@ func (l *{{.schema.ID}}Lister) List(namespace string, selector labels.Selector)
}
func (l *{{.schema.ID}}Lister) Get(namespace, name string) (*{{.prefix}}{{.schema.CodeName}}, error) {
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(namespace + "/" + name)
var key string
if namespace != "" {
key = namespace + "/" + name
} else {
key = name
}
obj, exists, err := l.controller.Informer().GetIndexer().GetByKey(key)
if err != nil {
return nil, err
}

View File

@@ -32,7 +32,11 @@ func SubType(fieldType string) string {
}
func GetType(data map[string]interface{}) string {
parts := strings.Split(GetFullType(data), "/")
return GetShortTypeFromFull(GetFullType(data))
}
func GetShortTypeFromFull(fullType string) string {
parts := strings.Split(fullType, "/")
return parts[len(parts)-1]
}

View File

@@ -176,9 +176,9 @@ func (s *Schemas) importType(version *APIVersion, t reflect.Type, overrides ...r
s.setupFilters(schema)
schema.Mapper = mapper
s.AddSchema(schema)
s.AddSchema(*schema)
return schema, s.Err()
return s.Schema(&schema.Version, schema.ID), s.Err()
}
func jsonName(f reflect.StructField) string {

View File

@@ -54,12 +54,12 @@ func (s *Schemas) SubContextSchemas() map[string]*Schema {
func (s *Schemas) AddSchemas(schema *Schemas) *Schemas {
for _, schema := range schema.Schemas() {
s.AddSchema(schema)
s.AddSchema(*schema)
}
return s
}
func (s *Schemas) AddSchema(schema *Schema) *Schemas {
func (s *Schemas) AddSchema(schema Schema) *Schemas {
schema.Type = "/meta/schemas/schema"
if schema.ID == "" {
s.errors = append(s.errors, fmt.Errorf("ID is not set on schema: %v", schema))
@@ -90,12 +90,12 @@ func (s *Schemas) AddSchema(schema *Schema) *Schemas {
}
if _, ok := schemas[schema.ID]; !ok {
schemas[schema.ID] = schema
s.schemas = append(s.schemas, schema)
schemas[schema.ID] = &schema
s.schemas = append(s.schemas, &schema)
}
if schema.SubContext != "" {
s.schemasBySubContext[schema.SubContext] = schema
s.schemasBySubContext[schema.SubContext] = &schema
}
return s