From d9c90ee41da222210487e6e51fc296ac5f1f02e5 Mon Sep 17 00:00:00 2001 From: ramiroaisen <52116153+ramiroaisen@users.noreply.github.com> Date: Sun, 14 Jan 2024 19:31:05 -0300 Subject: [PATCH] feat: improve openapi docs --- defs/api/accounts/GET/Query.schema.json | 2 +- defs/api/admins/GET/Query.schema.json | 2 +- defs/api/invitations/GET/Query.schema.json | 2 +- defs/api/me/api-keys/GET/Query.schema.json | 2 +- defs/api/me/devices/GET/Query.schema.json | 2 +- .../api/payment-methods/GET/Query.schema.json | 2 +- defs/api/plans/GET/Query.schema.json | 2 +- defs/api/stations/GET/Query.schema.json | 2 +- .../[station]/files/GET/Query.schema.json | 2 +- .../stream-connections/GET/Query.schema.json | 2 +- defs/api/users/GET/Query.schema.json | 2 +- defs/error/PublicErrorPayload.schema.json | 85 ++ openapi-generator.js | 28 +- openapi.json | 1187 ++++++++++++++++- openapi/redoc.html | 9 +- rs/packages/api/src/error/public.rs | 12 +- rs/packages/api/src/qs/mod.rs | 4 +- 17 files changed, 1314 insertions(+), 33 deletions(-) create mode 100644 defs/error/PublicErrorPayload.schema.json diff --git a/defs/api/accounts/GET/Query.schema.json b/defs/api/accounts/GET/Query.schema.json index c1384b2e..5ea5a360 100644 --- a/defs/api/accounts/GET/Query.schema.json +++ b/defs/api/accounts/GET/Query.schema.json @@ -12,7 +12,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/admins/GET/Query.schema.json b/defs/api/admins/GET/Query.schema.json index 705cf495..1ae3bfdf 100644 --- a/defs/api/admins/GET/Query.schema.json +++ b/defs/api/admins/GET/Query.schema.json @@ -8,7 +8,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/invitations/GET/Query.schema.json b/defs/api/invitations/GET/Query.schema.json index af80c581..8cc4ea79 100644 --- a/defs/api/invitations/GET/Query.schema.json +++ b/defs/api/invitations/GET/Query.schema.json @@ -24,7 +24,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/me/api-keys/GET/Query.schema.json b/defs/api/me/api-keys/GET/Query.schema.json index 246a2799..df631bd9 100644 --- a/defs/api/me/api-keys/GET/Query.schema.json +++ b/defs/api/me/api-keys/GET/Query.schema.json @@ -16,7 +16,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/me/devices/GET/Query.schema.json b/defs/api/me/devices/GET/Query.schema.json index 246a2799..df631bd9 100644 --- a/defs/api/me/devices/GET/Query.schema.json +++ b/defs/api/me/devices/GET/Query.schema.json @@ -16,7 +16,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/payment-methods/GET/Query.schema.json b/defs/api/payment-methods/GET/Query.schema.json index c1384b2e..5ea5a360 100644 --- a/defs/api/payment-methods/GET/Query.schema.json +++ b/defs/api/payment-methods/GET/Query.schema.json @@ -12,7 +12,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/plans/GET/Query.schema.json b/defs/api/plans/GET/Query.schema.json index b7293415..e2ee62b8 100644 --- a/defs/api/plans/GET/Query.schema.json +++ b/defs/api/plans/GET/Query.schema.json @@ -9,7 +9,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/stations/GET/Query.schema.json b/defs/api/stations/GET/Query.schema.json index 20146c01..f2e8f6ce 100644 --- a/defs/api/stations/GET/Query.schema.json +++ b/defs/api/stations/GET/Query.schema.json @@ -12,7 +12,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/api/stations/[station]/files/GET/Query.schema.json b/defs/api/stations/[station]/files/GET/Query.schema.json index 9c76aecb..9e19e3dd 100644 --- a/defs/api/stations/[station]/files/GET/Query.schema.json +++ b/defs/api/stations/[station]/files/GET/Query.schema.json @@ -8,7 +8,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" } diff --git a/defs/api/stream-connections/GET/Query.schema.json b/defs/api/stream-connections/GET/Query.schema.json index 0b760bc3..8ed0c466 100644 --- a/defs/api/stream-connections/GET/Query.schema.json +++ b/defs/api/stream-connections/GET/Query.schema.json @@ -32,7 +32,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" } diff --git a/defs/api/users/GET/Query.schema.json b/defs/api/users/GET/Query.schema.json index 705cf495..1ae3bfdf 100644 --- a/defs/api/users/GET/Query.schema.json +++ b/defs/api/users/GET/Query.schema.json @@ -8,7 +8,7 @@ "minimum": 0.0 }, "limit": { - "default": 60, + "default": 0, "type": "integer", "format": "int64" }, diff --git a/defs/error/PublicErrorPayload.schema.json b/defs/error/PublicErrorPayload.schema.json new file mode 100644 index 00000000..e27be0d7 --- /dev/null +++ b/defs/error/PublicErrorPayload.schema.json @@ -0,0 +1,85 @@ +{ + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "message", + "status" + ], + "properties": { + "status": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "message": { + "type": "string" + }, + "code": { + "type": "string", + "enum": [ + "INTERNAL", + "RESOURCE_NOT_FOUND", + "TOO_MANY_REQUESTS", + "BAD_REQUEST", + "INTERNAL_DB", + "INTERNAL_SERIALIZE", + "IO_REQUEST", + "TOKEN_MISSING", + "TOKEN_MALFORMED", + "TOKEN_NOT_FOUND", + "TOKEN_USER_NOT_FOUND", + "TOKEN_STATION_NOT_FOUND", + "TOKEN_ADMIN_NOT_FOUND", + "TOKEN_OUT_OF_SCOPE", + "TOKEN_USER_ACCOUNT_NOT_OWNER", + "STATION_NOT_FOUND", + "ADMIN_NOT_FOUND", + "USER_NOT_FOUND", + "ACCOUNT_NOT_FOUND", + "AUDIO_FILE_NOT_FOUND", + "DEVICE_NOT_FOUND", + "API_KEY_NOT_FOUND", + "PLAN_NOT_FOUND", + "PAYMENT_METHOD_NOT_FOUND", + "INVITATION_NOT_FOUND", + "QUERY_STRING_INVALID", + "PAYLOAD_IO", + "PAYLOAD_JSON", + "PAYLOAD_TOO_LARGE", + "PAYLOAD_INVALID", + "USER_AUTH_FAILED", + "ADMIN_AUTH_FAILED", + "USER_EMAIL_EXISTS", + "ADMIN_EMAIL_EXISTS", + "UPLOAD_EMPTY", + "UPLOAD_QUOTA_EXCEEDED", + "UPLOAD_INTERNAL_SPAWN", + "UPLOAD_INTENRAL_IO", + "UPLOAD_EXIT", + "RANGE_INVALID", + "RANGE_NO_OVERLAP", + "PATCH_EMPTY", + "PATCH_INVALID", + "PATCH_OUT_OF_SCOPE", + "CONTENT_LENGTH_REQUIRED", + "UNRESOLVABLE_ADMIN_ME", + "UNRESOLVABLE_USER_ME", + "PLAYLIST_START_IS_LIVE", + "PLAYLIST_START_IS_EXTERNAL_RELAY", + "PLAYLIST_START_NO_FILES", + "RENDER_MAIL", + "SEND_MAIL", + "CREATE_STATION_ACCOUNT_LIMIT", + "PAYMENTS_PERFORM" + ] + } + } + } + } +} \ No newline at end of file diff --git a/openapi-generator.js b/openapi-generator.js index 29e9b9c7..de8f8268 100644 --- a/openapi-generator.js +++ b/openapi-generator.js @@ -30,6 +30,8 @@ const security = [ const paths = {}; +const public_error_payload = JSON.parse(fs.readFileSync(`${__dirname}/defs/error/PublicErrorPayload.schema.json`)); + const process_dir = (target) => { const full_target = `${basedir}${target == null ? "" : `/${target}`}`; const filenames = fs.readdirSync(full_target).sort(); @@ -97,12 +99,22 @@ const process_dir = (target) => { responses: { 200: { + description: "A successful response", content: { "application/json": { schema: output, }, }, }, + + default: { + description: "An error response with status, code and message fields", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/Error" }, + } + } + } }, }; } @@ -150,12 +162,12 @@ const document = { info: { title: "Openstream Media Server API", - termsOfService: "https://openstream.fm/api-terms/", + // termsOfService: "https://openstream.fm/api-terms/", - license: { - name: "Apache 2.0", - url: "https://www.apache.org/licenses/LICENSE-2.0.html" - }, + // license: { + // name: "Apache 2.0", + // url: "https://www.apache.org/licenses/LICENSE-2.0.html" + // }, version: "0.1.0", }, @@ -170,7 +182,11 @@ const document = { paths, components: { - securitySchemes, + securitySchemes, + + schemas: { + Error: public_error_payload, + } } } diff --git a/openapi.json b/openapi.json index dd8a2265..b5043e06 100644 --- a/openapi.json +++ b/openapi.json @@ -2,11 +2,6 @@ "openapi": "3.0.0", "info": { "title": "Openstream Media Server API", - "termsOfService": "https://openstream.fm/api-terms/", - "license": { - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html" - }, "version": "0.1.0" }, "servers": [ @@ -83,6 +78,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -386,6 +382,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -434,6 +440,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -717,6 +724,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -735,6 +752,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1010,6 +1028,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -1026,6 +1054,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1313,6 +1342,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -1362,6 +1401,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1637,6 +1677,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -1655,6 +1705,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1701,6 +1752,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -1727,6 +1788,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1734,6 +1796,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -1782,6 +1854,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1789,6 +1862,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -1807,6 +1890,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1910,6 +1994,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -1944,6 +2038,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -1976,6 +2071,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2010,6 +2115,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2027,6 +2133,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2045,6 +2161,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2077,6 +2194,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2095,6 +2222,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2112,6 +2240,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2130,6 +2268,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2150,6 +2289,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2204,6 +2353,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2279,6 +2429,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -2322,6 +2482,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2377,6 +2538,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2395,6 +2566,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2450,6 +2622,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -2492,6 +2674,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2539,6 +2722,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2579,6 +2772,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -2586,6 +2780,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -2999,6 +3203,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -3800,6 +4005,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -4200,6 +4415,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -4957,6 +5173,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -4993,6 +5219,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5069,6 +5296,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5105,6 +5342,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5168,6 +5406,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5177,6 +5425,7 @@ "parameters": [], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5184,6 +5433,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5212,6 +5471,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5219,6 +5479,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5237,6 +5507,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5252,6 +5523,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5288,6 +5569,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5359,6 +5641,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5368,6 +5660,7 @@ "parameters": [], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5375,6 +5668,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5403,6 +5706,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5410,6 +5714,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5428,6 +5742,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5488,6 +5803,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5524,6 +5849,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -5543,6 +5869,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -5635,6 +5971,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -6038,6 +6375,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -6140,6 +6487,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -6356,6 +6704,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -6385,6 +6743,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -6581,6 +6940,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -6599,6 +6968,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -6606,6 +6976,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -6622,6 +7002,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -6818,6 +7199,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -6876,6 +7267,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7010,9 +7402,19 @@ } } } - } - } - } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } }, "/invitations/get-by-token/{token}": { "get": { @@ -7028,6 +7430,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7249,6 +7652,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -7291,6 +7704,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7369,6 +7783,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -7378,6 +7802,7 @@ "parameters": [], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7584,6 +8009,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -7662,6 +8097,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7731,6 +8167,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -7760,6 +8206,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7817,6 +8264,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -7835,6 +8292,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7842,6 +8300,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -7874,6 +8342,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -7881,6 +8350,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -7959,6 +8438,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8068,6 +8548,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -8086,6 +8576,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8093,6 +8584,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -8159,6 +8660,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8253,6 +8755,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -8286,6 +8798,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8360,6 +8873,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -8378,6 +8901,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8452,6 +8976,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -8506,6 +9040,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8626,6 +9161,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -8702,6 +9247,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8794,6 +9340,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -8812,6 +9368,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -8912,6 +9469,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -8928,6 +9495,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9028,6 +9596,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -9110,6 +9688,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9202,6 +9781,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -9220,6 +9809,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9320,6 +9910,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -9338,6 +9938,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9345,6 +9946,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -9363,6 +9974,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9370,6 +9982,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -9388,6 +10010,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9395,6 +10018,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -9413,6 +10046,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9420,6 +10054,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -9486,6 +10130,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -9558,6 +10203,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -9624,6 +10279,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -10954,6 +11610,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -11588,6 +12254,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -12898,6 +13565,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -12916,6 +13593,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -12923,6 +13601,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -12939,6 +13627,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -14249,6 +14938,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -14890,6 +15589,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -16192,6 +16892,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -16237,6 +16947,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -16389,6 +17100,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -16416,6 +17137,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -16536,6 +17258,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -16562,6 +17294,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -16674,6 +17407,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -16698,6 +17441,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -16818,6 +17562,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -16891,6 +17645,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17011,6 +17766,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17055,6 +17820,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17071,6 +17837,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17115,6 +17891,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17131,6 +17908,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17157,6 +17944,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17173,6 +17961,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17199,6 +17997,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17215,6 +18014,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17259,6 +18068,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17266,6 +18076,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17284,6 +18104,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17291,6 +18112,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17309,6 +18140,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17316,6 +18148,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17334,6 +18176,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17438,6 +18281,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17456,6 +18309,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17471,6 +18325,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17489,6 +18353,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17496,6 +18361,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17514,6 +18389,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17617,6 +18493,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17651,6 +18537,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17683,6 +18570,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17717,6 +18614,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17734,6 +18632,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17752,6 +18660,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17784,6 +18693,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17802,6 +18721,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -17819,6 +18739,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -17855,6 +18785,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -19165,6 +20096,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -19250,6 +20191,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20027,6 +20969,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20036,6 +20988,7 @@ "parameters": [], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20139,6 +21092,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20165,6 +21128,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20197,6 +21161,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20223,6 +21197,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20240,6 +21215,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20249,6 +21234,7 @@ "parameters": [], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20281,6 +21267,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20290,6 +21286,7 @@ "parameters": [], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20307,6 +21304,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20316,6 +21323,7 @@ "parameters": [], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20336,6 +21344,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20390,6 +21408,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20533,6 +21552,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -20589,6 +21618,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20712,6 +21742,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -20730,6 +21770,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20798,6 +21839,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -20814,6 +21865,7 @@ ], "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -20937,6 +21989,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, @@ -20981,6 +22043,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -21104,6 +22167,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -21144,6 +22217,7 @@ }, "responses": { "200": { + "description": "A successful response", "content": { "application/json": { "schema": { @@ -21151,6 +22225,16 @@ } } } + }, + "default": { + "description": "An error response with status, code and message fields", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } @@ -21163,6 +22247,93 @@ "in": "header", "name": "x-access-token" } + }, + "schemas": { + "Error": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "message", + "status" + ], + "properties": { + "status": { + "type": "integer", + "format": "uint16", + "minimum": 0 + }, + "message": { + "type": "string" + }, + "code": { + "type": "string", + "enum": [ + "INTERNAL", + "RESOURCE_NOT_FOUND", + "TOO_MANY_REQUESTS", + "BAD_REQUEST", + "INTERNAL_DB", + "INTERNAL_SERIALIZE", + "IO_REQUEST", + "TOKEN_MISSING", + "TOKEN_MALFORMED", + "TOKEN_NOT_FOUND", + "TOKEN_USER_NOT_FOUND", + "TOKEN_STATION_NOT_FOUND", + "TOKEN_ADMIN_NOT_FOUND", + "TOKEN_OUT_OF_SCOPE", + "TOKEN_USER_ACCOUNT_NOT_OWNER", + "STATION_NOT_FOUND", + "ADMIN_NOT_FOUND", + "USER_NOT_FOUND", + "ACCOUNT_NOT_FOUND", + "AUDIO_FILE_NOT_FOUND", + "DEVICE_NOT_FOUND", + "API_KEY_NOT_FOUND", + "PLAN_NOT_FOUND", + "PAYMENT_METHOD_NOT_FOUND", + "INVITATION_NOT_FOUND", + "QUERY_STRING_INVALID", + "PAYLOAD_IO", + "PAYLOAD_JSON", + "PAYLOAD_TOO_LARGE", + "PAYLOAD_INVALID", + "USER_AUTH_FAILED", + "ADMIN_AUTH_FAILED", + "USER_EMAIL_EXISTS", + "ADMIN_EMAIL_EXISTS", + "UPLOAD_EMPTY", + "UPLOAD_QUOTA_EXCEEDED", + "UPLOAD_INTERNAL_SPAWN", + "UPLOAD_INTENRAL_IO", + "UPLOAD_EXIT", + "RANGE_INVALID", + "RANGE_NO_OVERLAP", + "PATCH_EMPTY", + "PATCH_INVALID", + "PATCH_OUT_OF_SCOPE", + "CONTENT_LENGTH_REQUIRED", + "UNRESOLVABLE_ADMIN_ME", + "UNRESOLVABLE_USER_ME", + "PLAYLIST_START_IS_LIVE", + "PLAYLIST_START_IS_EXTERNAL_RELAY", + "PLAYLIST_START_NO_FILES", + "RENDER_MAIL", + "SEND_MAIL", + "CREATE_STATION_ACCOUNT_LIMIT", + "PAYMENTS_PERFORM" + ] + } + } + } + } + } } } } \ No newline at end of file diff --git a/openapi/redoc.html b/openapi/redoc.html index b41d7eec..88a307e8 100644 --- a/openapi/redoc.html +++ b/openapi/redoc.html @@ -4,9 +4,14 @@