forked from baskbuddy/zhangshun
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
675 B
25 lines
675 B
import json
|
|
from pathlib import Path
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
OPENAPI_FILE = PROJECT_ROOT / 'docs' / 'openapi-rc.json'
|
|
|
|
with open(OPENAPI_FILE, 'rb') as f:
|
|
raw = f.read()
|
|
if raw[:3] == b'\xef\xbb\xbf':
|
|
raw = raw[3:]
|
|
with open(OPENAPI_FILE, 'wb') as f:
|
|
f.write(raw)
|
|
print('BOM removed')
|
|
else:
|
|
print('No BOM found')
|
|
|
|
with open(OPENAPI_FILE, encoding='utf-8') as f:
|
|
d = json.load(f)
|
|
paths = d.get('paths', {})
|
|
print(f'Paths: {len(paths)}')
|
|
verif_paths = [p for p in paths.keys() if 'verification' in p.lower()]
|
|
print(f'Verification paths: {len(verif_paths)}')
|
|
for p in verif_paths:
|
|
print(f' {p}')
|
|
print('JSON OK')
|
|
|