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:
committed by
Darren Shepherd
parent
14ea6247f0
commit
33f2e1ebdb
8
vendor/github.com/rancher/norman/generator/controller_template.go
generated
vendored
8
vendor/github.com/rancher/norman/generator/controller_template.go
generated
vendored
@@ -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
|
||||
}
|
||||
|
6
vendor/github.com/rancher/norman/types/definition/definition.go
generated
vendored
6
vendor/github.com/rancher/norman/types/definition/definition.go
generated
vendored
@@ -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]
|
||||
}
|
||||
|
||||
|
4
vendor/github.com/rancher/norman/types/reflection.go
generated
vendored
4
vendor/github.com/rancher/norman/types/reflection.go
generated
vendored
@@ -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 {
|
||||
|
10
vendor/github.com/rancher/norman/types/schemas.go
generated
vendored
10
vendor/github.com/rancher/norman/types/schemas.go
generated
vendored
@@ -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
|
||||
|
Reference in New Issue
Block a user