Fix `dump-swagger.py` for PyYAML 6.0. (#3443)

PyYAML 6.0 was released yesterday, and it finally drops support for `yaml.load`
without a `loader` argument, which has been deprecated since 2017.

We don't use any fancy yaml objects, so `safe_load` should be fine.
pull/977/head
Richard van der Hoff 3 years ago committed by GitHub
parent 6062e5052d
commit 265ebef584
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -93,7 +93,7 @@ output = {
cs_api_dir = os.path.join(api_dir, 'client-server') cs_api_dir = os.path.join(api_dir, 'client-server')
with open(os.path.join(cs_api_dir, 'definitions', with open(os.path.join(cs_api_dir, 'definitions',
'security.yaml')) as f: 'security.yaml')) as f:
output['securityDefinitions'] = yaml.load(f) output['securityDefinitions'] = yaml.safe_load(f)
for filename in os.listdir(cs_api_dir): for filename in os.listdir(cs_api_dir):
if not filename.endswith(".yaml"): if not filename.endswith(".yaml"):
@ -102,7 +102,7 @@ for filename in os.listdir(cs_api_dir):
print("Reading swagger API: %s" % filepath) print("Reading swagger API: %s" % filepath)
with open(filepath, "r") as f: with open(filepath, "r") as f:
api = yaml.load(f.read()) api = yaml.safe_load(f.read())
api = units.resolve_references(filepath, api) api = units.resolve_references(filepath, api)
basePath = api['basePath'] basePath = api['basePath']

Loading…
Cancel
Save