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

Function hasTagPrefix

expr/method.go:336–353  ·  view source on GitHub ↗

hasTag is a helper function that traverses the given attribute and all its bases recursively looking for an attribute with the given tag meta prefix. This recursion is only needed for attributes that have not been finalized yet.

(p *AttributeExpr, prefix string)

Source from the content-addressed store, hash-verified

334// bases recursively looking for an attribute with the given tag meta prefix. This
335// recursion is only needed for attributes that have not been finalized yet.
336func hasTagPrefix(p *AttributeExpr, prefix string) bool {
337 if p.HasTagPrefix(prefix) {
338 return true
339 }
340 for _, base := range p.Bases {
341 ut, ok := base.(UserType)
342 if !ok {
343 continue
344 }
345 if hasTagPrefix(ut.Attribute(), prefix) {
346 return true
347 }
348 }
349 if ut, ok := p.Type.(UserType); ok {
350 return hasTagPrefix(ut.Attribute(), prefix)
351 }
352 return false
353}
354
355// Finalize makes sure the method payload and result types are set. It also
356// projects the result if it is a result type and a view is explicitly set in

Callers 1

validateRequirementsMethod · 0.85

Calls 2

HasTagPrefixMethod · 0.80
AttributeMethod · 0.65

Tested by

no test coverage detected