-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsweep.py
33 lines (25 loc) · 1005 Bytes
/
sweep.py
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
YAML_FILE = "swagger/openapi_public.yaml"
if __name__ == '__main__':
"""
You don't return anything if HTTP 204! Blank object {} is not appropriate here as the respective backing model; SDK
generation will throw exception on non-nullable properties. So definition-wise, we simply need not to say anything.
So sweep these definitions if found.
See https://github.com/OpenAPITools/openapi-generator/issues/476
"""
pattern = "application/vnd.illumina.v3+json: {}"
pattern2 = "content:"
with open(YAML_FILE, "r") as f:
lines = f.readlines()
total = 0
mod_lines = []
for i, line in enumerate(lines):
if pattern in line:
print("Found on line %s: %s" % (i + 1, line))
if pattern2 in mod_lines[-1]:
del mod_lines[-1]
total += 1
continue
mod_lines.append(line)
with open(YAML_FILE, "w") as f:
f.writelines(mod_lines)
print("Total found: %s" % total)