From 265ebef58489ebc60dedc0c404837add4900fd27 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Thu, 14 Oct 2021 21:25:03 +0200 Subject: [PATCH] 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. --- scripts/dump-swagger.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dump-swagger.py b/scripts/dump-swagger.py index 9e6ce156..784eb644 100755 --- a/scripts/dump-swagger.py +++ b/scripts/dump-swagger.py @@ -93,7 +93,7 @@ output = { cs_api_dir = os.path.join(api_dir, 'client-server') with open(os.path.join(cs_api_dir, 'definitions', 'security.yaml')) as f: - output['securityDefinitions'] = yaml.load(f) + output['securityDefinitions'] = yaml.safe_load(f) for filename in os.listdir(cs_api_dir): if not filename.endswith(".yaml"): @@ -102,7 +102,7 @@ for filename in os.listdir(cs_api_dir): print("Reading swagger API: %s" % filepath) with open(filepath, "r") as f: - api = yaml.load(f.read()) + api = yaml.safe_load(f.read()) api = units.resolve_references(filepath, api) basePath = api['basePath']