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

Method PathParams

expr/http_endpoint.go:145–163  ·  view source on GitHub ↗

PathParams computes a mapped attribute containing the subset of e.Params that describe path parameters.

()

Source from the content-addressed store, hash-verified

143// PathParams computes a mapped attribute containing the subset of e.Params that
144// describe path parameters.
145func (e *HTTPEndpointExpr) PathParams() *MappedAttributeExpr {
146 obj := Object{}
147 v := &ValidationExpr{}
148 pat := e.Params.Attribute() // need "attribute:name" style keys
149 for _, r := range e.Routes {
150 for _, p := range r.Params() {
151 att := pat.Find(p)
152 if att == nil {
153 continue
154 }
155 obj.Set(p, att)
156 if e.Params.IsRequired(p) {
157 v.AddRequired(p)
158 }
159 }
160 }
161 at := &AttributeExpr{Type: &obj, Validation: v}
162 return NewMappedAttributeExpr(at)
163}
164
165// QueryParams computes a mapped attribute containing the subset of e.Params
166// that describe query parameters.

Callers 4

validateParamsMethod · 0.95
PrepareMethod · 0.80
analyzeMethod · 0.80
buildPayloadDataMethod · 0.80

Calls 7

SetMethod · 0.95
AddRequiredMethod · 0.95
NewMappedAttributeExprFunction · 0.85
FindMethod · 0.80
IsRequiredMethod · 0.80
AttributeMethod · 0.65
ParamsMethod · 0.45

Tested by

no test coverage detected