-
Notifications
You must be signed in to change notification settings - Fork 0
/
struct.go
58 lines (42 loc) · 1.02 KB
/
struct.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
package structure
import "fmt"
// target object
type S struct {
Name string `json:"name"` // name of object
// age of object
Age int `json:"age"`
}
type PositiveInt int64
type PInt PositiveInt
// target object
type S2 struct {
Name string `json:"name"` // name of object
// age of object
Age PInt `json:"age" required:"false"`
Nickname string `json:"nickname,omitempty"`
Friends []string `json:"friends"`
Items map[string]int `json:"items"`
Ignored string `json:"-"`
Greeting fmt.Stringer
Any any `jsonschema-override:"{'required': false, 'deprecated': true}"`
}
type S3 struct {
Named Sub2 `json:"named,omitempty"`
Unnamed struct {
Name Name `json:"name"`
} `json:"unnamed,omitempty"`
// Children []S3 `json:"children"`
}
// named sub-struct
type Sub2 struct {
Name Name `json:"name"`
}
// name of something
type Name string
type S4 struct {
Named Sub2 `json:"named,omitempty"`
Unnamed struct {
Name Name `json:"name"`
} `json:"unnamed,omitempty"`
Children []S4 `json:"children"`
}