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

Function API

dsl/api.go:44–55  ·  view source on GitHub ↗

API defines a network service API. It provides the API name, description and other global properties. There may only be one API declaration in a given design package. API is a top level DSL. API takes two arguments: the name of the API and the defining DSL. The API properties are leveraged by the

(name string, fn func())

Source from the content-addressed store, hash-verified

42// })
43// }
44func API(name string, fn func()) *expr.APIExpr {
45 if name == "" {
46 eval.ReportError("API first argument cannot be empty")
47 return nil
48 }
49 if _, ok := eval.Current().(eval.TopExpr); !ok {
50 eval.IncompatibleDSL()
51 return nil
52 }
53 expr.Root.API = expr.NewAPIExpr(name, fn)
54 return expr.Root.API
55}
56
57// Title sets the API title. It is used by the generated OpenAPI specification.
58//

Calls 4

ReportErrorFunction · 0.92
CurrentFunction · 0.92
IncompatibleDSLFunction · 0.92
NewAPIExprFunction · 0.92