1
0
mirror of https://github.com/rancher/norman.git synced 2025-10-20 08:11:27 +00:00

when embedding optional element if schema isn't found ignore

This commit is contained in:
Darren Shepherd
2018-06-19 11:23:57 -07:00
parent f8f079c3b9
commit 0d782dfe15

View File

@@ -62,6 +62,9 @@ func (e *Embed) ModifySchema(schema *types.Schema, schemas *types.Schemas) error
embeddedSchemaID := schema.ResourceFields[e.Field].Type
embeddedSchema := schemas.Schema(&schema.Version, embeddedSchemaID)
if embeddedSchema == nil {
if e.Optional {
return nil
}
return fmt.Errorf("failed to find schema %s for embedding", embeddedSchemaID)
}