]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/dashboard: Fix doc endpoints 35564/head
authorfabrizio8 <fabrizio_dangelo@student.uml.edu>
Wed, 10 Jun 2020 17:06:06 +0000 (13:06 -0400)
committerFabrizio D'Angelo <fdangelo@redhat.com>
Fri, 26 Jun 2020 13:21:19 +0000 (09:21 -0400)
commitd1a5300a6e778d8fca5befbc2023df0f5c3ead03
tree5bb76e805a4fa49f6fa4f9bfefa071c4e234b7ed
parentb3c9465f9fba819586b8303ed8cde1e18a062323
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>
src/pybind/mgr/dashboard/controllers/cephfs.py
src/pybind/mgr/dashboard/controllers/crush_rule.py
src/pybind/mgr/dashboard/controllers/docs.py
src/pybind/mgr/dashboard/controllers/erasure_code_profile.py
src/pybind/mgr/dashboard/controllers/pool.py
src/pybind/mgr/dashboard/tests/test_docs.py