diff --git a/royalnet/backpack/stars/__init__.py b/royalnet/backpack/stars/__init__.py index 18b13dec..81d5a6c6 100644 --- a/royalnet/backpack/stars/__init__.py +++ b/royalnet/backpack/stars/__init__.py @@ -4,7 +4,6 @@ from .api_login_royalnet import ApiLoginRoyalnetStar from .api_token_info import ApiTokenInfoStar from .api_token_passwd import ApiTokenPasswdStar from .api_token_create import ApiTokenCreateStar -from .api_docs import ApiDocsStar from .docs import DocsStar # Enter the PageStars of your Pack here! @@ -14,7 +13,6 @@ available_page_stars = [ ApiTokenInfoStar, ApiTokenPasswdStar, ApiTokenCreateStar, - ApiDocsStar, DocsStar, ] diff --git a/royalnet/backpack/stars/api_docs.py b/royalnet/backpack/stars/api_docs.py deleted file mode 100644 index e306b234..00000000 --- a/royalnet/backpack/stars/api_docs.py +++ /dev/null @@ -1,12 +0,0 @@ -import royalnet.utils as ru -from royalnet.constellation.api import * -from royalnet.version import semantic - - -class ApiDocsStar(ApiStar): - path = "/api/docs" - - summary = "Get the swagger.json file used to generate this documentation." - - async def api(self, data: ApiData) -> ru.JSON: - return diff --git a/royalnet/backpack/stars/api_token_create.py b/royalnet/backpack/stars/api_token_create.py index 9efcba1c..3af69016 100644 --- a/royalnet/backpack/stars/api_token_create.py +++ b/royalnet/backpack/stars/api_token_create.py @@ -13,7 +13,6 @@ class ApiTokenCreateStar(ApiStar): summary = "Create a new login token of any duration." parameters = { - "token": "Your current login token.", "duration": "The duration in seconds of the new token." } diff --git a/royalnet/backpack/stars/api_token_info.py b/royalnet/backpack/stars/api_token_info.py index 9ed0a012..6b9be17f 100644 --- a/royalnet/backpack/stars/api_token_info.py +++ b/royalnet/backpack/stars/api_token_info.py @@ -5,11 +5,7 @@ from royalnet.constellation.api import * class ApiTokenInfoStar(ApiStar): path = "/api/token/info/v1" - summary = "Get info about a login token." - - parameters = { - "token": "The login token to get info about.", - } + summary = "Get info the current login token." async def api(self, data: ApiData) -> ru.JSON: token = await data.token() diff --git a/royalnet/backpack/stars/api_token_passwd.py b/royalnet/backpack/stars/api_token_passwd.py index 0450fe39..62dcf8e5 100644 --- a/royalnet/backpack/stars/api_token_passwd.py +++ b/royalnet/backpack/stars/api_token_passwd.py @@ -14,7 +14,6 @@ class ApiTokenPasswdStar(ApiStar): summary = "Change Royalnet password for an user." parameters = { - "token": "Your current login token.", "new_password": "The password you want to set." } diff --git a/royalnet/backpack/stars/docs.py b/royalnet/backpack/stars/docs.py index 97494f2d..4fb23645 100644 --- a/royalnet/backpack/stars/docs.py +++ b/royalnet/backpack/stars/docs.py @@ -19,13 +19,25 @@ class DocsStar(PageStar): paths[star.path] = star.swagger() spec = json.dumps({ - "swagger": "2.0", + "openapi": "3.0.0", "info": { "description": "Autogenerated Royalnet API documentation", "title": "Royalnet", "version": f"{semantic}", }, - "paths": paths + "paths": paths, + "components": { + "securitySchemes": { + "LoginTokenAuth": { + "type": "apiKey", + "in": "query", + "name": "token", + } + } + }, + "security": [ + {"LoginTokenAuth": []} + ] }) return HTMLResponse( diff --git a/royalnet/constellation/api/apistar.py b/royalnet/constellation/api/apistar.py index c5c6007d..67c7b9bb 100644 --- a/royalnet/constellation/api/apistar.py +++ b/royalnet/constellation/api/apistar.py @@ -56,7 +56,6 @@ class ApiStar(PageStar, ABC): "operationId": cls.__name__, "summary": cls.summary, "description": cls.description, - "produces": ["application/json"], "responses": { "200": {"description": "Success"}, "400": {"description": "Bad request"},