-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjunk
34 lines (30 loc) · 775 Bytes
/
junk
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
path_ = '/'
parts = path.split('/')
for part in parts:
if part == '':
continue
if ':' in part:
var = part[1:] # omit the :
validation = 'str'
if '|' in part:
var, validation = part.split('|')
path_ += '{'+var+'}/'
if auto_path_parameters:
path_parameters += [{
"name": var,
"reqired": True,
"type": validation,
"in": "path"
}]
else:
path_ += part + '/'
self.paths[path_]={}
self.paths[path_][method.lower()] = {
"tags": tags,
"summary": summary,
"consumes": consumes,
"produces": produces,
"parameters": path_parameters,
"responses": responses,
"security": security
}