Bumping k8s dependencies to 1.13
This commit is contained in:
39
vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go
generated
vendored
39
vendor/k8s.io/kube-openapi/pkg/aggregator/aggregator.go
generated
vendored
@@ -61,6 +61,10 @@ func (s *referenceWalker) walkRef(ref spec.Ref) spec.Ref {
|
||||
k := refStr[len(definitionPrefix):]
|
||||
def := s.root.Definitions[k]
|
||||
s.walkSchema(&def)
|
||||
// Make sure we don't assign to nil map
|
||||
if s.root.Definitions == nil {
|
||||
s.root.Definitions = spec.Definitions{}
|
||||
}
|
||||
s.root.Definitions[k] = def
|
||||
}
|
||||
return s.walkRefCallback(ref)
|
||||
@@ -83,13 +87,13 @@ func (s *referenceWalker) walkSchema(schema *spec.Schema) {
|
||||
s.walkSchema(&v)
|
||||
schema.PatternProperties[k] = v
|
||||
}
|
||||
for i, _ := range schema.AllOf {
|
||||
for i := range schema.AllOf {
|
||||
s.walkSchema(&schema.AllOf[i])
|
||||
}
|
||||
for i, _ := range schema.AnyOf {
|
||||
for i := range schema.AnyOf {
|
||||
s.walkSchema(&schema.AnyOf[i])
|
||||
}
|
||||
for i, _ := range schema.OneOf {
|
||||
for i := range schema.OneOf {
|
||||
s.walkSchema(&schema.OneOf[i])
|
||||
}
|
||||
if schema.Not != nil {
|
||||
@@ -105,7 +109,7 @@ func (s *referenceWalker) walkSchema(schema *spec.Schema) {
|
||||
if schema.Items.Schema != nil {
|
||||
s.walkSchema(schema.Items.Schema)
|
||||
}
|
||||
for i, _ := range schema.Items.Schemas {
|
||||
for i := range schema.Items.Schemas {
|
||||
s.walkSchema(&schema.Items.Schemas[i])
|
||||
}
|
||||
}
|
||||
@@ -147,6 +151,9 @@ func (s *referenceWalker) walkOperation(op *spec.Operation) {
|
||||
}
|
||||
|
||||
func (s *referenceWalker) Start() {
|
||||
if s.root.Paths == nil {
|
||||
return
|
||||
}
|
||||
for _, pathItem := range s.root.Paths.Paths {
|
||||
s.walkParams(pathItem.Parameters)
|
||||
s.walkOperation(pathItem.Delete)
|
||||
@@ -159,7 +166,7 @@ func (s *referenceWalker) Start() {
|
||||
}
|
||||
}
|
||||
|
||||
// usedDefinitionForSpec returns a map with all used definition in the provided spec as keys and true as values.
|
||||
// usedDefinitionForSpec returns a map with all used definitions in the provided spec as keys and true as values.
|
||||
func usedDefinitionForSpec(sp *spec.Swagger) map[string]bool {
|
||||
usedDefinitions := map[string]bool{}
|
||||
walkOnAllReferences(func(ref spec.Ref) spec.Ref {
|
||||
@@ -172,7 +179,7 @@ func usedDefinitionForSpec(sp *spec.Swagger) map[string]bool {
|
||||
}
|
||||
|
||||
// FilterSpecByPaths removes unnecessary paths and definitions used by those paths.
|
||||
// i.e. if a Path removed by this function, all definition used by it and not used
|
||||
// i.e. if a Path removed by this function, all definitions used by it and not used
|
||||
// anywhere else will also be removed.
|
||||
func FilterSpecByPaths(sp *spec.Swagger, keepPathPrefixes []string) {
|
||||
// Walk all references to find all used definitions. This function
|
||||
@@ -220,6 +227,10 @@ func renameDefinition(s *spec.Swagger, old, new string) {
|
||||
}
|
||||
return ref
|
||||
}, s)
|
||||
// Make sure we don't assign to nil map
|
||||
if s.Definitions == nil {
|
||||
s.Definitions = spec.Definitions{}
|
||||
}
|
||||
s.Definitions[new] = s.Definitions[old]
|
||||
delete(s.Definitions, old)
|
||||
}
|
||||
@@ -244,6 +255,15 @@ func MergeSpecs(dest, source *spec.Swagger) error {
|
||||
|
||||
func mergeSpecs(dest, source *spec.Swagger, renameModelConflicts, ignorePathConflicts bool) (err error) {
|
||||
specCloned := false
|
||||
// Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
|
||||
if source.Paths == nil {
|
||||
// When a source spec does not have any path, that means none of the definitions
|
||||
// are used thus we should not do anything
|
||||
return nil
|
||||
}
|
||||
if dest.Paths == nil {
|
||||
dest.Paths = &spec.Paths{}
|
||||
}
|
||||
if ignorePathConflicts {
|
||||
keepPaths := []string{}
|
||||
hasConflictingPath := false
|
||||
@@ -335,6 +355,9 @@ func mergeSpecs(dest, source *spec.Swagger, renameModelConflicts, ignorePathConf
|
||||
}
|
||||
for k, v := range source.Definitions {
|
||||
if _, found := dest.Definitions[k]; !found {
|
||||
if dest.Definitions == nil {
|
||||
dest.Definitions = spec.Definitions{}
|
||||
}
|
||||
dest.Definitions[k] = v
|
||||
}
|
||||
}
|
||||
@@ -343,6 +366,10 @@ func mergeSpecs(dest, source *spec.Swagger, renameModelConflicts, ignorePathConf
|
||||
if _, found := dest.Paths.Paths[k]; found {
|
||||
return fmt.Errorf("unable to merge: duplicated path %s", k)
|
||||
}
|
||||
// PathItem may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
|
||||
if dest.Paths.Paths == nil {
|
||||
dest.Paths.Paths = map[string]spec.PathItem{}
|
||||
}
|
||||
dest.Paths.Paths[k] = v
|
||||
}
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user