From 652ecfedf79fbfb29db144b5383907ae6e39a2ab Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Mon, 13 Sep 2021 14:26:05 -0400 Subject: [PATCH] fix OpenAPI JSON file rendering (#775) --- pygeoapi/api.py | 2 +- pygeoapi/flask_app.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pygeoapi/api.py b/pygeoapi/api.py index 82471b8..4afca1d 100644 --- a/pygeoapi/api.py +++ b/pygeoapi/api.py @@ -690,7 +690,7 @@ class API: if isinstance(openapi, dict): return headers, 200, to_json(openapi, self.pretty_print) else: - return headers, 200, openapi.read() + return headers, 200, openapi @pre_process def conformance(self, diff --git a/pygeoapi/flask_app.py b/pygeoapi/flask_app.py index 31a5084..c008be9 100644 --- a/pygeoapi/flask_app.py +++ b/pygeoapi/flask_app.py @@ -134,8 +134,8 @@ def openapi(): with open(os.environ.get('PYGEOAPI_OPENAPI'), encoding='utf8') as ff: if os.environ.get('PYGEOAPI_OPENAPI').endswith(('.yaml', '.yml')): openapi_ = yaml_load(ff) - else: # JSON file, do not transform - openapi_ = ff + else: # JSON string, do not transform + openapi_ = ff.read() return get_response(api_.openapi(request, openapi_))