From 0a94f71dadeaf5c5d8b4facfc6fc52ac6ac7d6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Ma=C3=AFzi?= Date: Tue, 29 Sep 2020 13:35:58 +0200 Subject: [PATCH] [routing] Fix api representation (remove duplicates and fct). --- halfapi/lib/routes.py | 8 +++----- halfapi/lib/schemas.py | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/halfapi/lib/routes.py b/halfapi/lib/routes.py index ec56602..d3f0b0b 100644 --- a/halfapi/lib/routes.py +++ b/halfapi/lib/routes.py @@ -121,10 +121,8 @@ def api_routes(m_dom: ModuleType) -> Generator: for verb in VERBS: if verb not in d_route.keys(): continue - d_res[path][verb] = { - 'params': str_acl(d_route[verb]['params']), - 'fct': d_route[verb]['fct'].__name__ - } + d_res[path][verb] = str_acl(d_route[verb]['params']) - yield path, d_res + print(d_res) + return d_res diff --git a/halfapi/lib/schemas.py b/halfapi/lib/schemas.py index c2ee907..909bd01 100644 --- a/halfapi/lib/schemas.py +++ b/halfapi/lib/schemas.py @@ -38,10 +38,10 @@ async def get_api_routes(request, *args, **kwargs): } """ #TODO: LADOC - return ORJSONResponse({ - domain: { path: route for path, route in api_routes(m_domain) } - for domain, m_domain in DOMAINSDICT.items() - }) + d_api = {} + for domain, m_domain in DOMAINSDICT.items(): + d_api[domain] = api_routes(m_domain) + return ORJSONResponse(d_api) async def schema_json(request, *args, **kwargs):