Docs provides external documentation URLs. It is used by the generated OpenAPI specification. Docs must appear in an API, Service, Method or Attribute expr. Docs takes a single argument which is the defining DSL. Example: var _ = API("cellar", func() { Docs(func() { Description("A
(fn func())
| 201 | // }) |
| 202 | // }) |
| 203 | func Docs(fn func()) { |
| 204 | docs := new(expr.DocsExpr) |
| 205 | if !eval.Execute(fn, docs) { |
| 206 | return |
| 207 | } |
| 208 | switch e := eval.Current().(type) { |
| 209 | case *expr.APIExpr: |
| 210 | e.Docs = docs |
| 211 | case *expr.ServiceExpr: |
| 212 | e.Docs = docs |
| 213 | case *expr.MethodExpr: |
| 214 | e.Docs = docs |
| 215 | case *expr.AttributeExpr: |
| 216 | e.Docs = docs |
| 217 | case *expr.HTTPFileServerExpr: |
| 218 | e.Docs = docs |
| 219 | default: |
| 220 | eval.IncompatibleDSL() |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | // TermsOfService describes the API terms of services or links to them. |
| 225 | // |