Skip to content

Commit

Permalink
get openapi working
Browse files Browse the repository at this point in the history
  • Loading branch information
dternyak committed Sep 30, 2018
1 parent 4a33a79 commit 0a85117
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion custom/animal_case/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down
4 changes: 3 additions & 1 deletion custom/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 0a85117

Please sign in to comment.