Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: rest gateway script #1856

Merged
merged 2 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion jina/peapods/runtimes/asyncio/rest/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def handle_route(msg: 'Message') -> 'Request':
if self.client_encoding == 'bytes':
await websocket.send_bytes(response.SerializeToString())
else:
await websocket.send_json(response.to_json())
await websocket.send_json(response.json())
self.num_responses += 1
except Exception as e:
logger.error(f'Got an exception in handle_send: {e!r}')
Expand Down
13 changes: 13 additions & 0 deletions scripts/get-gateway-openapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import json

from jina.parsers import set_gateway_parser
from jina.logging import JinaLogger
from jina.peapods.runtimes.asyncio.rest.app import get_fastapi_app

args = set_gateway_parser().parse_args([])
logger = JinaLogger('')

app = get_fastapi_app(args, logger)
schema = app.openapi()
with open('gateway.json', 'w') as f:
json.dump(schema, f)