Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit a67ad74

Browse files
committed
added deprecated processing, now shows version
1 parent 47c7a3b commit a67ad74

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

CloudFlare/api_decode_from_openapi.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
match_identifier = re.compile('\{[A-Za-z0-9_]*\}')
1111

12-
def do_path(cmd, info):
12+
def do_path(cmd, values):
1313
""" do_path() """
1414

1515
cmds = []
@@ -23,14 +23,18 @@ def do_path(cmd, info):
2323
if cmd[-4:] == '/:id':
2424
cmd = cmd[:-4]
2525

26-
for action in info:
27-
action = action.upper()
28-
if action == '' or action not in API_TYPES:
26+
for action in values:
27+
if action == '' or action.upper() not in API_TYPES:
2928
continue
30-
deprecated = False
31-
deprecated_date = ''
32-
deprecated_already = False
33-
v = {'action': action, 'cmd': cmd, 'deprecated': deprecated, 'deprecated_date': deprecated_date, 'deprecated_already': deprecated_already}
29+
if 'deprecated' in values[action] and values[action]['deprecated']:
30+
deprecated = True
31+
deprecated_date = datetime.datetime.now().strftime('%Y-%m-%d')
32+
deprecated_already = True
33+
else:
34+
deprecated = False
35+
deprecated_date = ''
36+
deprecated_already = False
37+
v = {'action': action.upper(), 'cmd': cmd, 'deprecated': deprecated, 'deprecated_date': deprecated_date, 'deprecated_already': deprecated_already}
3438
cmds.append(v)
3539
return cmds
3640

@@ -53,6 +57,8 @@ def api_decode_from_openapi(content):
5357
sys.stderr.write("OpenAPI json format structure: %s\n" % (e))
5458
return None
5559

60+
sys.stderr.write("OpenAPI %s json file - version: %s\n" % (openapi, info['version']))
61+
5662
all_cmds = []
5763
for path in paths:
5864
if path[0] != '/':

0 commit comments

Comments
 (0)