This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
fixture_test.go
152 lines (132 loc) · 3.13 KB
/
fixture_test.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package iglo
var dummyMarkdown = `
FORMAT: 1A
HOST: https://api.example.com/v1
# Hello API
A simple API demo
# Group People
This section describes about the People
## Person [/people/{id}]
Represent particular Person
+ Parameters
+ id (required, string, ` + "`123`" + `) ... The id of the Person.
+ Model (application/json)
` + "```" + `
{"name":"Gesang","birthdate":"01-09-1917"}
` + "```" + `
### Retrieve Person [GET]
Return the information for the Person
+ Request (application/json)
+ Headers
` + "```" + `
Authorization: Basic AbcdeFg=
` + "```" + `
+ Response 200
[Person][]
`
var dummyAPI = &API{
Version: "2.2",
AST: AST{
Version: "4.0",
Name: "Hello API",
Description: "A simple API demo\n\n",
Metadata: []Metadata{
Metadata{
Name: "FORMAT",
Value: "1A",
},
Metadata{
Name: "HOST",
Value: "https://api.example.com/v1",
},
},
ResourceGroups: []ResourceGroup{
ResourceGroup{
Name: "People",
Description: "This section describes about the People\n\n",
Resources: []Resource{
Resource{
Name: "Person",
Description: "Represent particular Person\n\n",
UriTemplate: "/people/{id}",
Model: Model{
Name: "Person",
Description: "",
Headers: []Header{
Header{
Name: "Content-Type",
Value: "application/json",
},
},
Body: "{\"name\":\"Gesang\",\"birthdate\":\"01-09-1917\"}\n",
Schema: "",
},
Parameters: []Parameter{
Parameter{
Name: "id",
Description: "The id of the Person.",
Type: "string",
Required: true,
Default: "",
Example: "123",
Values: []Value{},
},
},
Actions: []Action{
Action{
Name: "Retrieve Person",
Description: "Return the information for the Person\n\n",
Method: "GET",
Parameters: []Parameter{},
Examples: []Example{
Example{
Name: "",
Description: "",
Requests: []Request{
Request{
Name: "",
Description: "",
Headers: []Header{
Header{
Name: "Content-Type",
Value: "application/json",
},
Header{
Name: "Authorization",
Value: "Basic AbcdeFg=",
},
},
Body: "",
Schema: "",
},
},
Responses: []Response{
Response{
Name: "200",
Description: "",
Headers: []Header{
Header{
Name: "Content-Type",
Value: "application/json",
},
},
Body: "{\"name\":\"Gesang\",\"birthdate\":\"01-09-1917\"}\n",
Schema: "",
},
},
},
},
},
},
},
},
},
},
},
Error: Error{
Code: 0,
Message: "",
Location: make([]string, 0),
},
Warnings: []Warning{},
}