YouROK / TorrServer

Torrent stream server
GNU General Public License v3.0
1.51k stars 192 forks source link

Add openapi API documentation #294

Closed cocool97 closed 10 months ago

cocool97 commented 11 months ago

The goal of this PR is to add an OpenAPI documentation to the project.

This would allow us to have the documentation available at /swagger/index.html and not in the README.md file.

The only thing contributors have to do is keep API endpoint documentation accurate, and everything will be build to provide this new endpoint.

We could even automatically generate a JS + Kotlin API client if we want.

Endpoints to check :

API

MSX

PAGES

Related to #49

cocool97 commented 11 months ago

Ready for review ! @tsynik

tsynik commented 11 months ago

ready for review ! @tsynik

added fname handle to stream and playlist functions. also some comments above

tsynik commented 11 months ago

Tried this a little: download api docs produces wrong url request

download

It must be as /download/10 etc. size is not a query key but url param

Also, there is no valid action values example for functions like /settings ("get"|"set") etc

cocool97 commented 11 months ago

I'll double check all endpoints for issues like this one !

For the "get/set" params, as they are strings, I do not think that there is a way to specify variants. Either we set a comment for these actions, or we make one endpoint by action (this is more Rest-ful, but will introduce breaking changes...).

shadeov commented 11 months ago

@cocool97 also look at my PR https://github.com/cocool97/TorrServer/pull/1

cocool97 commented 11 months ago

I'll check this for every endpoint 👍🏻

Endpoint checked on PR's first comment can be testes @tsynik. If you find issue(s) let me know this'll be an error.