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

Function paramFor

http/codegen/openapi/v3/parameters.go:61–73  ·  view source on GitHub ↗

paramFor converts the given attribute into a OpenAPI spec parameter.

(att *expr.AttributeExpr, name, in string, required bool, rand *expr.ExampleGenerator)

Source from the content-addressed store, hash-verified

59
60// paramFor converts the given attribute into a OpenAPI spec parameter.
61func paramFor(att *expr.AttributeExpr, name, in string, required bool, rand *expr.ExampleGenerator) *Parameter {
62 param := &Parameter{
63 Name: name,
64 In: in,
65 Description: att.Description,
66 AllowEmptyValue: in != "path",
67 Required: required,
68 Schema: newSchemafier(rand).schemafy(att),
69 Extensions: openapi.ExtensionsFromExpr(att.Meta),
70 }
71 initExamples(param, att, rand)
72 return param
73}

Callers 2

paramsFromPathFunction · 0.70

Calls 4

ExtensionsFromExprFunction · 0.92
newSchemafierFunction · 0.85
initExamplesFunction · 0.85
schemafyMethod · 0.80

Tested by

no test coverage detected