forked from zeromicro/go-zero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec.go
118 lines (100 loc) · 1.88 KB
/
spec.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package spec
type (
Doc []string
Annotation struct {
Properties map[string]string
}
ApiSyntax struct {
Version string
}
ApiSpec struct {
Info Info
Syntax ApiSyntax
Imports []Import
Types []Type
Service Service
}
Import struct {
Value string
}
Group struct {
Annotation Annotation
Routes []Route
}
Info struct {
// Deprecated: use Properties instead
Title string
// Deprecated: use Properties instead
Desc string
// Deprecated: use Properties instead
Version string
// Deprecated: use Properties instead
Author string
// Deprecated: use Properties instead
Email string
Properties map[string]string
}
Member struct {
Name string
// 数据类型字面值,如:string、map[int]string、[]int64、[]*User
Type Type
Tag string
Comment string
// 成员头顶注释说明
Docs Doc
IsInline bool
}
Route struct {
Annotation Annotation
Method string
Path string
RequestType Type
ResponseType Type
Docs Doc
Handler string
AtDoc AtDoc
}
Service struct {
Name string
Groups []Group
}
Type interface {
Name() string
}
DefineStruct struct {
RawName string
Members []Member
Docs Doc
}
// 系统预设基本数据类型 bool int32 int64 float32
PrimitiveType struct {
RawName string
}
MapType struct {
RawName string
// only support the PrimitiveType
Key string
// it can be asserted as PrimitiveType: int、bool、
// PointerType: *string、*User、
// MapType: map[${PrimitiveType}]interface、
// ArrayType:[]int、[]User、[]*User
// InterfaceType: interface{}
// Type
Value Type
}
ArrayType struct {
RawName string
Value Type
}
InterfaceType struct {
RawName string
}
PointerType struct {
RawName string
Type Type
}
AtDoc struct {
Properties map[string]string
Text string
}
)