-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.go
73 lines (62 loc) · 2.28 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
package main
type Document struct {
Version string `json:"swagger"`
Host string `json:"host"`
BasePath string `json:"basePath"`
Schemes []string `json:"schemes"`
Consumes []string `json:"consumes"`
Produces []string `json:"produces"`
Information Info `json:"info"`
Methods map[string]Path `json:"paths"`
Schemas map[string]*Schema `json:"definitions"`
Tags []Tag `json:"tags"`
}
type Info struct {
Title string `json:"title"`
Version string `json:"version"`
}
type Path map[string]Operation
type Operation struct {
Parameters []Parameter `json:"parameters"`
Tags []string `json:"tags"`
Summary string `json:"summary"`
Description string `json:"description"`
ID string `json:"operationId"`
Results map[string]Response `json:"responses"`
}
type Response struct {
Description string `json:"description,omitempty"`
Schema Schema `json:"schema,omitempty"`
}
type Position string
const (
QueryPos Position = "query"
HeaderPos Position = "header"
PathPos Position = "path"
FormDataPos Position = "formData"
BodyPos Position = "body"
)
type Parameter struct {
Name string `json:"name"`
In Position `json:"in"`
Description string `json:"description"`
Required bool `json:"required"`
Type string `json:"type"`
Format string `json:"format"`
EnumValues []string `json:"enum,omitempty"`
}
type Schema struct {
Format string `json:"format,omitempty"`
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
Properties map[string]*Schema `json:"properties,omitempty"`
AdditionalProperties *Schema `json:"additionalProperties,omitempty"`
Ref string `json:"$ref,omitempty"`
Description string `json:"description,omitempty"`
Items *Schema `json:"items,omitempty"`
EnumValues []string `json:"enum,omitempty"`
}
type Tag struct {
Name string `json:"name"`
Description string `json:"description"`
}