ScilifelabDataCentre / dds_web

A cloud-based system for the delivery of data from SciLifeLab Facilities to their users (e.g. research group).
Other
8 stars 8 forks source link

Documentation generation using swagger #1495

Closed rv0lt closed 9 months ago

rv0lt commented 11 months ago

Read this before submitting the PR

  1. Always create a Draft PR first
  2. Go through sections 1-5 below, fill them in and check all the boxes
  3. Make sure that the branch is updated; if there's an "Update branch" button at the bottom of the PR, rebase or update branch.
  4. When all boxes are checked, information is filled in, and the branch is updated: mark as Ready For Review and tag reviewers (top right)
  5. Once there is a submitted review, implement the suggestions (if reasonable, otherwise discuss) and request an new review.

If there is a field which you are unsure about, enter the edit mode of this description or go to the PR template; There are invisible comments providing descriptions which may be of help.

1. Description / Summary

Added Swagger documentation generation, and documented endpoints for authentication and files operations.

The documentation is accessible in the same URL that hosts the dds, in the /documentation uri.

During this, some endpoints were discovered to be not up-to-date with the open API standard. Get and Delete methods cannot have data in the request body.

For now, they are marked as deprecated, it will be worked in the future to implement new versions of them correctly used. And be eventually replaced.

--

In this PR the "/user/second_factor" is fixed by providing an implementation that uses POST to submit the request of the token - The method already provides is a GET

No tests are implemented, as it could be reused the existing ones. Replacing the endpoint in them as the old one is eventually removed.

--

2. Jira task / GitHub issue

Link to the github issue or add the Jira task ID here.

3. Type of change

What type of change(s) does the PR contain?

Check the relevant boxes below. For an explanation of the different sections, enter edit mode of this PR description template.

4. Additional information

5. Actions / Scans

Check the boxes when the specified checks have passed.

For information on what the different checks do and how to fix it if they're failing, enter edit mode of this description or go to the PR template.

codecov[bot] commented 11 months ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (a31996e) 91.50% compared to head (e3da447) 91.48%.

Files Patch % Lines
dds_web/api/user.py 71.42% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #1495 +/- ## ========================================== - Coverage 91.50% 91.48% -0.03% ========================================== Files 29 29 Lines 4625 4637 +12 ========================================== + Hits 4232 4242 +10 - Misses 393 395 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rv0lt commented 9 months ago

I have updated all the description of the "bad" methods to the proposed one

i-oden commented 2 months ago

Nice! You wrote

The documentation is accessible in the same URL that hosts the dds, in the /documentation uri.

Not sure I'm understanding where to look?

rv0lt commented 2 months ago

Nice! You wrote

The documentation is accessible in the same URL that hosts the dds, in the /documentation uri.

Not sure I'm understanding where to look?

In a further PR, we changed it again. To have them under similar syntax within the two version of the endpoints:

https://testing.delivery.scilifelab.se/api/documentation/v3/

i-oden commented 2 months ago

Nice! You wrote

The documentation is accessible in the same URL that hosts the dds, in the /documentation uri.

Not sure I'm understanding where to look?

In a further PR, we changed it again. To have them under similar syntax within the two version of the endpoints:

https://testing.delivery.scilifelab.se/api/documentation/v3/

Thanks! It looks great!