-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathroot.go
More file actions
53 lines (43 loc) · 1.66 KB
/
root.go
File metadata and controls
53 lines (43 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package expr
import (
"goa.design/goa/v3/eval"
"goa.design/goa/v3/expr"
)
// Root is the design root expression for the docs plugin.
var Root = &RootExpr{}
type (
// RootExpr keeps track of docs plugin configuration toggles.
RootExpr struct {
// UseJSONTags instructs the docs generator to use JSON struct tags
// specified via Meta ("struct:tag:json") as field names.
UseJSONTags bool
// InlineRefs instructs the docs generator to inline $ref schemas by
// replacing them with copies of their referenced definitions where
// possible. Cycles are preserved by leaving $ref in place when needed.
InlineRefs bool
// IncludedTypes are the user types to force-emit into definitions.
IncludedTypes []expr.UserType
}
)
// Register design root with eval engine.
func init() {
_ = eval.Register(Root)
}
// EvalName returns the name used in error messages.
func (r *RootExpr) EvalName() string { return "Docs plugin" }
// WalkSets implements eval.Root. No-op; configuration is global.
func (*RootExpr) WalkSets(eval.SetWalker) {}
// DependsOn tells the eval engine to run the goa DSL first.
func (*RootExpr) DependsOn() []eval.Root { return []eval.Root{expr.Root} }
// Packages returns the import path to the Go packages that make up the DSL.
// This is used to skip frames that point to files in these packages when
// computing the location of errors.
func (*RootExpr) Packages() []string { return []string{"goa.design/plugins/v3/docs/dsl"} }
// IncludeTypes registers the given user types for forced definition emission.
func (r *RootExpr) IncludeTypes(ts ...expr.UserType) {
for _, t := range ts {
if t != nil {
r.IncludedTypes = append(r.IncludedTypes, t)
}
}
}