[routing] Fix api representation (remove duplicates and fct).

This commit is contained in:
Joël Maïzi 2020-09-29 13:35:58 +02:00
parent e223c0791c
commit 0a94f71dad
2 changed files with 7 additions and 9 deletions

View File

@ -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

View File

@ -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):