mgr/dashboard: Fix doc endpoints
UiApi endpoints were broken because the same base URL was used for
both UiApi and Api endpoints.
There were two issues with this:
- The paths dict keys were based off a string split of path that
used base URL length. This caused the wrong keys to be created and the
duplicate apiapi seen in the cURL requests generated by OpenAPI.
- Fixing the above issue was not enough, as then both Api and UiApi
endpoints would have the same base URL. This causes conflicts with doc
generation that result in only UiApi endpoints to be generated.
Passing only / as the base URL argument for api_json and
api_all_json and using the full path as the paths keys solves this
issue.
Other changes:
* base_url variable was removed from controllers/docs.py:_gen_paths
and tests/test_docs.py because it was unused after my change.
* Added type hints for dicts in controllers/docs.py and
controllers/pool.py because they were not passing mypy checks.
* test_docs.py unit test added to verify change
* Add message which explains that UiApi endpoints are not part of the
public api
Fixes: https://tracker.ceph.com/issues/45957
Signed-off-by: Fabrizio D'Angelo <fdangelo@redhat.com>
(cherry picked from commit
d1a5300a6e778d8fca5befbc2023df0f5c3ead03)