Inherit merges the properties of existing target type attributes with the argument's. The algorithm is recursive so that child attributes are also merged.
(parent *AttributeExpr)
| 417 | // argument's. The algorithm is recursive so that child attributes are also |
| 418 | // merged. |
| 419 | func (a *AttributeExpr) Inherit(parent *AttributeExpr) { |
| 420 | if !a.shouldInherit(parent) { |
| 421 | return |
| 422 | } |
| 423 | pobj := AsObject(parent.Type) |
| 424 | if a.Type == Empty && len(*pobj) > 0 { |
| 425 | a.Type = &Object{} |
| 426 | } |
| 427 | a.inheritValidations(parent) |
| 428 | a.inheritRecursive(parent, make(map[*AttributeExpr]struct{})) |
| 429 | } |
| 430 | |
| 431 | // AllRequired returns the list of all required fields from the underlying |
| 432 | // object. This method recurses if the type is itself an attribute (i.e. a |
no test coverage detected