-
Notifications
You must be signed in to change notification settings - Fork 1
/
swagger.yaml
200 lines (200 loc) · 5.18 KB
/
swagger.yaml
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
swagger: "2.0"
info:
description: "Deterministic or pseudo-random data generator"
version: "1.0.0"
title: "Pseudo Service"
contact:
name: "https://github.com/bgadrian"
license:
name: "AGPL 2.0"
host: "localhost"
basePath: "/"
schemes:
- "http"
#- "https"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
count:
name: "count"
in: "path"
description: "How many results to generate."
required: true
type: integer
format: "int32"
maximum: 500
minimum: 1
seed:
name: "seed"
format: "int64"
in: "query"
description: "The seed for the pseudo-random generator. For each unique value the same results will be given. If no seed is provided a pseudo-random one will be generated (rand.Int63)."
required: false
type: "integer"
paths:
/health:
get:
description: "Get the health of the service"
responses:
200:
description: "Everything is fine"
default:
description: "Service is not available"
/custom/{count}:
get:
description: "Generate results based on a pattern/template."
parameters:
- $ref: "#/parameters/count"
- $ref: "#/parameters/seed"
- in: query
name: "template"
type: "string"
description: "The template used to generate the results, eg: 'My name is ~name~'"
required: true
minLength: 1
maxLength: 1024
responses:
200:
description: "The results were successfully generated"
schema:
$ref: "#/definitions/CustomResponseModel"
default:
description: "Error occurred"
schema:
$ref: "#/definitions/ErrorModel"
security:
- apikey: []
/users/{count}:
get:
description: "Get a random user"
parameters:
- $ref: "#/parameters/count"
- $ref: "#/parameters/seed"
responses:
200:
description: "The users were successfully generated"
schema:
$ref: "#/definitions/UserResponseModel"
default:
description: "Error occurred"
schema:
$ref: "#/definitions/ErrorModel"
securityDefinitions:
apikey:
type: "apiKey"
name: "token"
in: "query"
security: #apply the apikey to all endpoints
- apikey: []
definitions:
User:
type: "object"
required:
- "id"
- "name"
properties:
id:
type: "string"
format: "uuid"
example: "356b1896-ee58-4fd8-931d-4cfaee21158e"
description: "UUID for this user"
age:
type: "number"
format: "int32"
minimum: 0
maximum: 255
name:
type: "string"
example: "John Doe"
description: "First and Last name"
Company:
type: "string"
example: "De-engineered niches Group"
position:
type: "string"
example: "Central Branding Producer"
email:
type: "string"
example: "john@mambo.dot"
country:
type: "string"
example: "Romania"
friends:
type: "array"
example:
- "356b1896-ee58-4fd8-931d-4cfaee21158e"
- "3d813194-e9ed-4b09-a1ae-301b83bfdd9d"
description: "Random list of UUIDs from the same response. To increase the chance of having friends request for bigger batches."
items:
type: "string"
example: "356b1896-ee58-4fd8-931d-4cfaee21158e"
description: "UUID for this friend"
example:
id: "356b1896-ee58-4fd8-931d-4cfaee21158e"
age: 33
name: "John Doe"
company: "De-engineered niches Group"
position: "Central Branding Producer"
email: "john@mambo.dot"
country: "Romania"
friends:
- "3d813194-e9ed-4b09-a1ae-301b83bfdd9d"
- "356b1896-ee58-4fd8-931d-4cfaee21158e"
UserResponseModel:
type: "object"
properties:
seed:
type: "integer"
format: "int64"
description: "Number that was used to generate these users"
nextseed:
type: "integer"
format: "int64"
description: "Use this to get the next users from the deterministic series"
users:
type: "array"
items:
$ref: "#/definitions/User"
example:
nextseed: 6
seed: 0
users:
- id: "356b1896-ee58-4fd8-931d-4cfaee21158e"
age: 33
name: "John Doe"
company: "De-engineered niches Group"
position: "Central Branding Producer"
email: "john@mambo.dot"
country: "Romania"
friends:
- "3d813194-e9ed-4b09-a1ae-301b83bfdd9d"
- "356b1896-ee58-4fd8-931d-4cfaee21158e"
ErrorModel:
type: "object"
required:
- "code"
- "message"
properties:
code:
type: "integer"
format: "int32"
message:
type: "string"
example:
code: 42
message: "Something went wrong"
CustomResponseModel:
type: "object"
properties:
seed:
type: "integer"
format: "int64"
description: "Number that was used to generate these results"
results:
type: array
items:
type: string
description: "One result is one template with random data"