def openshift_main():
import sys
import json
import codecs
import urllib3
from collections import OrderedDict
pool = urllib3.PoolManager()
reader = codecs.getreader('utf-8')
spec_url = 'https://raw.githubusercontent.com/openshift/origin/' \
'%s/api/swagger-spec/openshift-openapi-spec.json' % sys.argv[1]
output_path = sys.argv[2]
print("writing to {}".format(output_path))
with pool.request('GET', spec_url, preload_content=False) as response:
if response.status != 200:
print("Error downloading spec file. Reason: %s" % response.reason)
return 1
in_spec = json.load(reader(response), object_pairs_hook=OrderedDict)
out_spec = process_swagger(process_openshift_swagger(in_spec, output_path))
update_codegen_ignore(out_spec, output_path)
with open(output_path, 'w') as out:
json.dump(out_spec, out, sort_keys=True, indent=2,
separators=(',', ': '), ensure_ascii=True)
return 0
preprocess_spec.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录