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

Fix/131 #142

Merged
merged 2 commits into from
Mar 8, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deepaas/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
async def get_app(
swagger=True,
enable_doc=True,
doc="/ui",
doc="/api",
prefix="",
static_path="/static/swagger",
base_path="",
Expand Down
6 changes: 6 additions & 0 deletions deepaas/api/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ async def get(self):
return web.json_response(response)


@routes.get("/ui")
async def redirect_ui(request):
doc_url = request.app.router.named_resources().get("swagger.docs").url_for()
return web.HTTPFound(doc_url)


def register_version(version, func):
# NOTE(aloga): we could use a @classmethod on Versions, but it fails
# with a TypeError: 'classmethod' object is not callable since the function
Expand Down
2 changes: 1 addition & 1 deletion deepaas/cmd/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def main():

base = "http://{}:{}".format(CONF.listen_ip, CONF.listen_port)
spec = "{}/swagger.json".format(base)
docs = "{}/ui".format(base)
docs = "{}/api".format(base)
v2 = "{}/v2".format(base)

print(INTRO)
Expand Down
2 changes: 1 addition & 1 deletion deepaas/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
default=True,
help="""
Enable documentation endpoint. If set we will provide the documentation
through the "/ui" endpoint. Default is to provide this information.
through the "/api" endpoint. Default is to provide this information.
""",
),
cfg.IntOpt(
Expand Down
6 changes: 3 additions & 3 deletions deepaas/tests/fake_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
v2_version,
],
"links": [
{"rel": "help", "type": "text/html", "href": "/ui"},
{"rel": "help", "type": "text/html", "href": "/api"},
{"rel": "describedby", "type": "application/json", "href": "/swagger.json"},
],
}
Expand All @@ -59,15 +59,15 @@
v2_version,
],
"links": [
{"rel": "help", "type": "text/html", "href": "/ui"},
{"rel": "help", "type": "text/html", "href": "/api"},
{"rel": "describedby", "type": "application/json", "href": "/swagger.json"},
],
}

empty_versions = {
"versions": [],
"links": [
{"rel": "help", "type": "text/html", "href": "/ui"},
{"rel": "help", "type": "text/html", "href": "/api"},
{"rel": "describedby", "type": "application/json", "href": "/swagger.json"},
],
}
Expand Down
2 changes: 1 addition & 1 deletion deepaas/tests/test_v2_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def assert_ok(self, response):
self.assertIn(response.status, [200, 201])

async def test_not_found(self):
ret = await self.client.get("/ui")
ret = await self.client.get("/api")
self.assertEqual(404, ret.status)


Expand Down
2 changes: 1 addition & 1 deletion deepaas/tests/test_versions_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def get_application(self):
versions.Versions.versions = {}

aiohttp_apispec.setup_aiohttp_apispec(
app=app, url="/swagger.json", swagger_path="/ui"
app=app, url="/swagger.json", swagger_path="/api"
)

return app
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
min_version = 4.3.3
envlist =
py3{8, 9, 10}
py3{8, 9, 10, 11, 12}
flake8
black
bandit
Expand Down
Loading