mirror of
https://github.com/rancher/norman.git
synced 2025-09-20 02:32:46 +00:00
Fix schema pruning
This commit is contained in:
@@ -72,15 +72,11 @@ func addSchema(schema *types.Schema, schemaMap map[string]*types.Schema, schemas
|
|||||||
|
|
||||||
func traverseAndAdd(schema *types.Schema, schemaMap map[string]*types.Schema, schemas []*types.Schema, included map[string]bool) []*types.Schema {
|
func traverseAndAdd(schema *types.Schema, schemaMap map[string]*types.Schema, schemas []*types.Schema, included map[string]bool) []*types.Schema {
|
||||||
for _, field := range schema.ResourceFields {
|
for _, field := range schema.ResourceFields {
|
||||||
t := field.Type
|
t := ""
|
||||||
if definition.HasReferenceType(t) {
|
subType := field.Type
|
||||||
for !definition.IsReferenceType(t) {
|
for subType != t {
|
||||||
newT := definition.SubType(t)
|
t = subType
|
||||||
if newT == t {
|
subType = definition.SubType(t)
|
||||||
break
|
|
||||||
}
|
|
||||||
t = newT
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if refSchema, ok := schemaMap[t]; ok && !included[t] {
|
if refSchema, ok := schemaMap[t]; ok && !included[t] {
|
||||||
|
Reference in New Issue
Block a user