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

Function paramFor

http/codegen/openapi/v2/builder.go:312–330  ·  view source on GitHub ↗
(at *expr.AttributeExpr, name, in string, required bool)

Source from the content-addressed store, hash-verified

310}
311
312func paramFor(at *expr.AttributeExpr, name, in string, required bool) *Parameter {
313 alias := at
314 at = resolvedAliasAttribute(at)
315 p := &Parameter{
316 In: in,
317 Name: name,
318 Default: openapi.ToStringMap(at.DefaultValue),
319 Description: at.Description,
320 Required: required,
321 }
322 p.Type, p.Format = openAPITypeFormat(at)
323 if expr.IsArray(at.Type) {
324 p.Items = itemsFromExpr(expr.AsArray(at.Type).ElemType)
325 p.CollectionFormat = "multi"
326 }
327 p.Extensions = openapi.ExtensionsFromExpr(at.Meta)
328 initAttributeValidations(alias, p)
329 return p
330}
331
332func itemsFromExpr(at *expr.AttributeExpr) *Items {
333 itemType, itemFormat := openAPITypeFormat(at)

Callers 2

paramsFromExprFunction · 0.70
paramsFromHeadersFunction · 0.70

Calls 8

ToStringMapFunction · 0.92
IsArrayFunction · 0.92
AsArrayFunction · 0.92
ExtensionsFromExprFunction · 0.92
resolvedAliasAttributeFunction · 0.85
openAPITypeFormatFunction · 0.85
itemsFromExprFunction · 0.85
initAttributeValidationsFunction · 0.85

Tested by

no test coverage detected