MCPcopy Create free account
hub / github.com/goadesign/goa / initAttrFromDesign

Function initAttrFromDesign

expr/http_endpoint.go:1137–1160  ·  view source on GitHub ↗

initAttrFromDesign overrides the type of att with the one of patt and initializes other non-initialized fields of att with the one of patt except Meta.

(att, patt *AttributeExpr)

Source from the content-addressed store, hash-verified

1135// initializes other non-initialized fields of att with the one of patt except
1136// Meta.
1137func initAttrFromDesign(att, patt *AttributeExpr) {
1138 if patt == nil || patt.Type == Empty {
1139 return
1140 }
1141 att.Type = patt.Type
1142 if att.Description == "" {
1143 att.Description = patt.Description
1144 }
1145 if att.Docs == nil {
1146 att.Docs = patt.Docs
1147 }
1148 if att.Validation == nil {
1149 att.Validation = patt.Validation
1150 }
1151 if att.DefaultValue == nil {
1152 att.DefaultValue = patt.DefaultValue
1153 }
1154 if att.UserExamples == nil {
1155 att.UserExamples = patt.UserExamples
1156 }
1157 if att.Meta == nil {
1158 att.Meta = patt.Meta
1159 }
1160}
1161
1162// isEmpty returns true if an attribute is Empty type and it has no bases and
1163// references, or if an attribute is an empty object.

Callers 4

FinalizeMethod · 0.85
FinalizeMethod · 0.85
FinalizeMethod · 0.85
initAttrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected