-
Notifications
You must be signed in to change notification settings - Fork 7
/
types.go
77 lines (67 loc) · 2.08 KB
/
types.go
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package docsgenerator
/*
Example of usage:
name: Type Document
type: TypeDoc
description: TypeDoc represents the types of documentation in a file
node: A note to be displayed at the end of the doc
example:
type: json
name: JSON usage
value: { "Name": "name", "Type": "type", "Description": "description" }
*/
type TypeDoc struct {
// Name represents struct name or field name.
Name string
// Type represents struct name or field type.
Type string
// Description represents the full description for the item.
Description string
// Note is rendered as a note for the example in markdown file.
Note string
// Fields contains fields documentation if related item is a struct.
Fields []FieldDoc
// Example values for the type.
Example Example
}
// Doc represents a struct documentation rendered from comments by docgen.
type FieldDoc struct {
// Name represents struct name or field name.
Name string
// Type represents struct name or field type.
Type string
// Description represents the full description for the item.
Description string
// Note is rendered as a note for the example in markdown file.
Note string
Optional bool
OptionalIf string
RequiredIf string
Default string
// Examples: List of example values for the item.
Examples []Example
// Values is only used to render valid values listed in the documentation.
Values []string
// Options renders extra options for this field.
Options []string
// lookupKey is for internal usage only.
// It is the field type stripped of pointer and array symbols (*, [])
lookupKey string
}
type Example struct {
Name string `yaml:"name"`
Value string `yaml:"value"`
Type string `yaml:"type"`
}
type Comment struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Note string `yaml:"note"`
Default string `yaml:"default"`
Examples []Example `yaml:"examples"`
Example Example `yaml:"example"`
Values []string `yaml:"values"`
// Makes item param if specified param is defined
OptionalIf string `yaml:"optional_if"`
RequiredlIf string `yaml:"required_if"`
}