From 0a8511739662cf664f3a31434205232010e54c62 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Sun, 30 Sep 2018 02:55:18 -0500 Subject: [PATCH] get openapi working --- custom/animal_case/convert.py | 4 +++- custom/renderers.py | 4 +++- tasks.py | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/custom/animal_case/convert.py b/custom/animal_case/convert.py index 2d161f6..bda73c2 100755 --- a/custom/animal_case/convert.py +++ b/custom/animal_case/convert.py @@ -43,7 +43,9 @@ def keys_to_camel_case(content): :param content: dict :return: dict """ - return {to_camel_case(key): value for key, value in _unpack(dict(content))} + return { + to_camel_case(key): value for key, value in _unpack(dict(content)) + } def parse_keys(data=None, types='snake'): diff --git a/custom/renderers.py b/custom/renderers.py index c429183..e0a3dcc 100644 --- a/custom/renderers.py +++ b/custom/renderers.py @@ -23,7 +23,9 @@ def render(self, status: str, response_data: Any) -> Response: response_data = dump_schema(response_data) except TypeError: pass - response_data = parse_keys(response_data, types='camel') + # TODO - fix hack to prevent camel casing openAPI data + if not response_data.get('openapi'): + response_data = parse_keys(response_data, types='camel') content = json.dumps(response_data, default=self.default) return Response(status, content=content, headers={ "content-type": "application/json; charset=utf-8", diff --git a/tasks.py b/tasks.py index dd57851..9485c36 100644 --- a/tasks.py +++ b/tasks.py @@ -13,6 +13,9 @@ def test(c, cov=False, verbose=False): @task -def start(c): +def start(c, log_level='info'): c.run("export ENVIRONMENT=common") - c.run('gunicorn --reload app:app') + gunicorn_command = 'gunicorn --reload app:app' + gunicorn_command += ' --log-level={}'.format(log_level) + print(gunicorn_command) + c.run(gunicorn_command)