NatLibFi / Annif

Annif is a multi-algorithm automated subject indexing tool for libraries, archives and museums.
https://annif.org
Other
195 stars 41 forks source link

Upgrade REST API spec to OpenAPI 3 #649

Closed osma closed 1 year ago

osma commented 1 year ago

We currently specify the REST API using Swagger 2.0. This has long ago been superseded by OpenAPI 3.0, which is nowadays also well supported by the Connexion framework.

This PR updates the REST API spec for OpenAPI 3.0 and renames the directory it is stored in from swagger to openapi. I used the Swagger Editor for an initial conversion, but I had to make several fixes until I got it working. Also there are minor changes to the implementation code in rest.py that were necessary to make the new spec work.

Fixes #644

codecov[bot] commented 1 year ago

Codecov Report

Base: 99.54% // Head: 99.55% // Increases project coverage by +0.00% :tada:

Coverage data is based on head (b8f6b8c) compared to base (02e60ed). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #649 +/- ## ======================================= Coverage 99.54% 99.55% ======================================= Files 87 87 Lines 5968 6006 +38 ======================================= + Hits 5941 5979 +38 Misses 27 27 ``` | [Impacted Files](https://codecov.io/gh/NatLibFi/Annif/pull/649?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi) | Coverage Δ | | |---|---|---| | [tests/test\_rest.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-dGVzdHMvdGVzdF9yZXN0LnB5) | `100.00% <ø> (ø)` | | | [annif/\_\_init\_\_.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvX19pbml0X18ucHk=) | `88.46% <100.00%> (ø)` | | | [annif/rest.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvcmVzdC5weQ==) | `96.36% <100.00%> (+0.13%)` | :arrow_up: | | [annif/parallel.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvcGFyYWxsZWwucHk=) | `100.00% <0.00%> (ø)` | | | [annif/registry.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvcmVnaXN0cnkucHk=) | `100.00% <0.00%> (ø)` | | | [tests/test\_cli.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-dGVzdHMvdGVzdF9jbGkucHk=) | `100.00% <0.00%> (ø)` | | | [annif/backend/http.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvYmFja2VuZC9odHRwLnB5) | `100.00% <0.00%> (ø)` | | | [tests/test\_parallel.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-dGVzdHMvdGVzdF9wYXJhbGxlbC5weQ==) | `100.00% <0.00%> (ø)` | | | [tests/test\_backend\_http.py](https://codecov.io/gh/NatLibFi/Annif/pull/649/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-dGVzdHMvdGVzdF9iYWNrZW5kX2h0dHAucHk=) | `100.00% <0.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

osma commented 1 year ago

There are still problems with parameter handling

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication