From 2f3b84aec0fd3222e06b91a984b5dc733e77d722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Santilio?= Date: Sat, 23 Apr 2022 15:23:43 +0200 Subject: [PATCH 1/5] register CORE APIs --- api/openapi_v1.yaml | 505 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 505 insertions(+) create mode 100644 api/openapi_v1.yaml diff --git a/api/openapi_v1.yaml b/api/openapi_v1.yaml new file mode 100644 index 0000000..693ad9f --- /dev/null +++ b/api/openapi_v1.yaml @@ -0,0 +1,505 @@ +openapi: "3.0.2" + +info: + title: Godot Asset Library + description: Godot Engine's asset library + version: "1.0.0" + +servers: + - url: "https://godotengine.org/asset-library/api" + +tags: + - name: assets + description: Assets + + - name: configure + description: Configuration + +paths: + /asset: + get: + tags: [assets] + summary: List assets + description: Return a paginated list of assets. + + parameters: + - $ref: "#/components/parameters/typeParam" + - $ref: "#/components/parameters/categoryParam" + - $ref: "#/components/parameters/supportParam" + - $ref: "#/components/parameters/filterParam" + - $ref: "#/components/parameters/userParam" + - $ref: "#/components/parameters/godotVersionParam" + - $ref: "#/components/parameters/maxResultsParam" + - $ref: "#/components/parameters/pageParam" + - $ref: "#/components/parameters/offsetParam" + - $ref: "#/components/parameters/sortParam" + - $ref: "#/components/parameters/reverseParam" + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/PaginatedAssetList" + examples: + PaginatedAssetListExample1: + $ref: "#/components/examples/PaginatedAssetListExample" + + /asset/{id}: + get: + tags: [assets] + summary: Get information about an asset + description: Get information about a single asset. + + parameters: + - name: id + in: path + required: true + description: The asset's unique identifier. + schema: + type: integer + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/AssetDetails" + examples: + AssedDetailsExample1: + $ref: "#/components/examples/AssetDetailsExample" + 404: + description: Asset not found + content: + "application/json": + schema: + $ref: "#/components/schemas/NotFoundError" + 422: + description: Invalid request body + content: + "application/json": + schema: + $ref: "#/components/schemas/ValidationError" + + /configure: + get: + tags: [configure] + summary: Fetch categories + description: Returns category names and IDs (used for editor integration). + + parameters: + - $ref: "#/components/parameters/typeParam" + - $ref: "#/components/parameters/sessionParam" + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/Category" + + 422: + description: Invalid request body + content: + "application/json": + schema: + $ref: "#/components/schemas/ValidationError" + +components: + parameters: + typeParam: + in: query + name: type + required: false + schema: + type: string + default: any + enum: + - any + - addon + - project + categoryParam: + in: query + name: category + required: false + schema: + type: number + supportParam: + in: query + name: support + required: false + schema: + type: string + enum: + - official + - community + - testing + filterParam: + in: query + name: filter + required: false + schema: + type: string + userParam: + in: query + name: user + required: false + schema: + type: string + godotVersionParam: + in: query + name: godot_version + required: false + schema: + type: string + pattern: '^\d{1}.\d{1}.\d{1}$' + maxResultsParam: + in: query + name: max_results + required: false + schema: + type: number + minimum: 1 + maximum: 500 + pageParam: + in: query + name: page + required: false + schema: + type: number + offsetParam: + in: query + name: offset + required: false + schema: + type: number + sortParam: + in: query + name: sort + required: false + schema: + type: string + enum: + - rating + - cost + - name + - updated + reverseParam: + in: query + name: reverse + required: false + schema: + type: boolean + sessionParam: + in: query + name: session + required: false + schema: + type: boolean + + schemas: + AssetSummary: + type: object + description: | + A resource provided by the asset library (add-on, project, ...). + These properties are returned both when requesting a list of assets or a specific asset. + properties: + asset_id: + type: integer + description: The asset's unique identifier. + type: + type: string + description: The asset's type, can be "addon" or "project". + author: + type: string + description: The author's username. + author_id: + type: integer + description: The author's unique identifier. + category: + type: string + description: The category the asset belongs to. + category_id: + type: integer + description: The unique identifier of the category the asset belongs to. + download_provider: + type: string + download_commit: + type: string + download_hash: + type: string + default: '' + description: > + The asset's SHA-256 hash for the latest version. + **Note:** This is currently always an empty string as asset versions' hashes aren't computed and stored yet. + cost: + type: string + description: > + The asset's license as a [SPDX license identifier](https://spdx.org/licenses/). + For compatibility reasons, this field is called `cost` instead of `license`. + godot_version: + type: string + description: > + The Godot version the asset's latest version is intended for (in `major.minor` format).
+ This field is present for compatibility reasons with the Godot editor. + See also the `versions` array. + icon_url: + type: string + format: url + description: The asset's icon URL (should always be a PNG image). + is_archived: + type: boolean + description: > + If `true`, the asset is marked as archived by its author. + When archived, it can't receive any further reviews but can still be + unarchived at any time by the author. + issues_url: + type: string + format: url + description: > + The asset's issue reporting URL (typically associated with + the Git repository specified in `browse_url`). + modify_date: + type: string + format: date-time + description: > + The date on which the asset entry was last updated. + Note that entries can be edited independently of new asset versions being released. + rating: + type: integer + description: > + The asset's rating (unused). For compatibility reasons, a value of 0 is always returned. + You most likely want `score` instead. + support_level: + type: string + enum: [official, community, testing] + description: The asset's support level. + title: + type: string + description: The asset's title (usually less than 50 characters). + version: + type: integer + description: > + The asset revision number (starting from 1).
+ Every time the asset is edited (for anyone and for any reason), + this number is incremented by 1. + version_string: + type: string + description: > + The version string of the latest version (free-form, but usually `major.minor` + or `major.minor.patch`).
+ This field is present for compatibility reasons with the Godot editor. + See also the `versions` array. + searchable: + type: string + previews: + type: array + items: + $ref: "#/components/schemas/AssetPreview" + + PaginatedAssetList: + description: A paginated list of assets. + allOf: + - $ref: "#/components/schemas/PaginationResult" + - type: object + properties: + result: + type: array + items: { $ref: "#/components/schemas/AssetSummary" } + + AssetPreview: + description: | + ABCD. + type: object + properties: + preview_id: + type: string + type: + type: string + link: + type: string + format: url + thumbnail: + type: string + format: url + + AssetDetails: + description: | + A resource provided by the asset library (add-on, project, ...).
+ These properties are only returned when requesting a specific asset, + not a list of assets. + allOf: + - $ref: "#/components/schemas/AssetSummary" + - type: object + properties: + browse_url: + type: string + format: url + description: The asset's browsable repository URL. + description: + type: string + description: The asset's full description. + download_url: + type: string + format: url + description: > + The download link of the asset's latest version (should always point to a ZIP archive).
+ This field is present for compatibility reasons with the Godot editor. + See also the `versions` array. + + AssetVersion: + type: object + description: An asset version. + properties: + created_at: + type: string + format: date-time + description: The version's release date. + download_url: + type: string + format: url + description: > + The version's custom download URL (if any). Will be an empty string + if not set. + godot_version: + type: string + description: > + The minor Godot version the asset version was declared to be + compatible with (in `major.minor` format). + version_string: + type: string + description: The version identifier. + + Category: + type: object + description: > + A category in which assets belong to. An asset can only belong to + one category at a time. + properties: + id: + type: integer + description: The category's unique identifier. + name: + type: string + description: The category's name. + type: + type: integer + description: The category's type (0 = Add-ons, 1 = Projects). + + PaginationResult: + type: object + description: Properties which describe the results of the pagination requested. + properties: + page: + type: integer + description: The requested page number. + page_length: + type: integer + description: > + The requested page length.
+ **Note:** This can be higher than the total amount of items returned. + pages: + type: integer + description: > + The total number of pages available.
+ **Note:** If requesting a page higher than this value, a successful + response will be returned (status code 200) but no items will be listed. + total_items: + type: integer + description: The total number of items available. + + NotFoundError: + type: object + description: The requested resource was not found. + properties: + error: + type: string + description: A generic error message. + + TraceError: + type: object + properties: + file: + type: string + line: + type: integer + function: + type: string + class: + type: string + type: + type: string + + ValidationError: + type: object + description: An error returned by Laravel. + properties: + errors: + type: array + items: + type: string + description: Messages describing why the validation of the field failed. + message: + type: string + description: A generic error message. + + examples: + AssetDetailsExample: + value: + asset_id: '1' + type: addon + title: Snake + author: test + author_id: '1' + version: '1' + version_string: alpha + category: 2D Tools + category_id: '1' + godot_version: '2.1' + rating: '0' + cost: GPLv3 + description: Lorem ipsum… + support_level: testing + download_provider: GitHub + download_commit: master + download_hash: "(sha256 hash of the downloaded zip)" + browse_url: https://github.com/… + issues_url: https://github.com/…/issues + icon_url: https://….png + searchable: '1' + modify_date: '2018-08-21 15:49:00' + download_url: https://github.com/…/archive/master.zip + previews: + - preview_id: '1' + type: video + link: https://www.youtube.com/watch?v=… + thumbnail: https://img.youtube.com/vi/…/default.jpg + - preview_id: '2' + type: image + link: https://….png + thumbnail: https://….png + + PaginatedAssetListExample: + value: + result: + - asset_id: '1' + title: Snake + author: test + author_id: '1' + category: 2D Tools + category_id: '1' + godot_version: '2.1' + rating: '0' + cost: GPLv3 + support_level: testing + icon_url: https://….png + version: '1' + version_string: alpha + modify_date: '2018-08-21 15:49:00' + page: 0 + pages: 0 + page_length: 10 + total_items: 1 \ No newline at end of file From 1585a8e2e4a9a1f2d7e6f623ba9609422028cbb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Santilio?= Date: Sat, 23 Apr 2022 17:18:35 +0200 Subject: [PATCH 2/5] update swagger --- api/openapi_v1.yaml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/api/openapi_v1.yaml b/api/openapi_v1.yaml index 693ad9f..6205881 100644 --- a/api/openapi_v1.yaml +++ b/api/openapi_v1.yaml @@ -58,7 +58,7 @@ paths: required: true description: The asset's unique identifier. schema: - type: integer + type: string responses: 200: @@ -126,7 +126,7 @@ components: name: category required: false schema: - type: number + type: string supportParam: in: query name: support @@ -161,7 +161,7 @@ components: name: max_results required: false schema: - type: number + type: string minimum: 1 maximum: 500 pageParam: @@ -169,13 +169,13 @@ components: name: page required: false schema: - type: number + type: string offsetParam: in: query name: offset required: false schema: - type: number + type: string sortParam: in: query name: sort @@ -208,7 +208,7 @@ components: These properties are returned both when requesting a list of assets or a specific asset. properties: asset_id: - type: integer + type: string description: The asset's unique identifier. type: type: string @@ -217,13 +217,13 @@ components: type: string description: The author's username. author_id: - type: integer + type: string description: The author's unique identifier. category: type: string description: The category the asset belongs to. category_id: - type: integer + type: string description: The unique identifier of the category the asset belongs to. download_provider: type: string @@ -269,7 +269,7 @@ components: The date on which the asset entry was last updated. Note that entries can be edited independently of new asset versions being released. rating: - type: integer + type: string description: > The asset's rating (unused). For compatibility reasons, a value of 0 is always returned. You most likely want `score` instead. @@ -281,11 +281,11 @@ components: type: string description: The asset's title (usually less than 50 characters). version: - type: integer + type: string description: > - The asset revision number (starting from 1).
+ The asset revision string (starting from 1).
Every time the asset is edited (for anyone and for any reason), - this number is incremented by 1. + this string is incremented by 1. version_string: type: string description: > @@ -380,13 +380,13 @@ components: one category at a time. properties: id: - type: integer + type: string description: The category's unique identifier. name: type: string description: The category's name. type: - type: integer + type: string description: The category's type (0 = Add-ons, 1 = Projects). PaginationResult: @@ -395,7 +395,7 @@ components: properties: page: type: integer - description: The requested page number. + description: The requested page string. page_length: type: integer description: > @@ -404,12 +404,12 @@ components: pages: type: integer description: > - The total number of pages available.
+ The total string of pages available.
**Note:** If requesting a page higher than this value, a successful response will be returned (status code 200) but no items will be listed. total_items: type: integer - description: The total number of items available. + description: The total string of items available. NotFoundError: type: object @@ -425,7 +425,7 @@ components: file: type: string line: - type: integer + type: string function: type: string class: From c24f19c64c46893175113758b0827eadf11713da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Santilio?= Date: Mon, 25 Apr 2022 13:11:05 +0200 Subject: [PATCH 3/5] Complete swagger --- api/openapi_v1.yaml | 502 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 498 insertions(+), 4 deletions(-) diff --git a/api/openapi_v1.yaml b/api/openapi_v1.yaml index 6205881..cbaf7b6 100644 --- a/api/openapi_v1.yaml +++ b/api/openapi_v1.yaml @@ -10,12 +10,121 @@ servers: tags: - name: assets - description: Assets + description: Assets API + + - name: assetsEdit + description: Assets Edit API - name: configure - description: Configuration + description: Configuration API + + - name: auth + description: Authentication API paths: + /register: + post: + tags: [auth] + summary: Register a user + description: Register a user, given a username, password, and email. + + requestBody: + description: Username, Password and Email to register + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UserDetails' + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/RegisterSuccessfulResult" + + /login: + post: + tags: [auth] + summary: Login as a given user + description: Login as a given user. Results in a token which can be used for authenticated requests. + + requestBody: + description: Username and Passaword to login with + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UsernamePassword' + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/LoginSuccessfulResult" + 403: + description: Forbidden + content: + "application/json": + schema: + $ref: "#/components/schemas/LoginForbiddenResult" + 404: + description: Not found + content: + "application/json": + schema: + $ref: "#/components/schemas/LoginNotFoundResult" + + /logout: + post: + tags: [auth] + summary: Logout a user + description: Logout a user, given a token. The token is invalidated in the process. + + requestBody: + description: Username and Passaword to login with + required: true + content: + application/json: + schema: + type: object + properties: + token: + type: string + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/LogoutSuccessfulResult" + + /change_password: + post: + tags: [auth] + summary: Change a user's password + description: Change a user's password. The token is invalidated in the process. + + requestBody: + description: Old and New password. The authentication token is mandatory. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/ChangePassword' + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/ChangePwdSuccessfulResult" + /asset: get: tags: [assets] @@ -46,6 +155,31 @@ paths: PaginatedAssetListExample1: $ref: "#/components/examples/PaginatedAssetListExample" + post: + tags: [assetsEdit] + summary: Update information about an asset + description: Update information about a single asset. + + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AssetDetails" + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + type: object + properties: + id: + description: The id of the updated asset + type: string + + /asset/{id}: get: tags: [assets] @@ -75,7 +209,7 @@ paths: content: "application/json": schema: - $ref: "#/components/schemas/NotFoundError" + $ref: "#/components/schemas/AssetNotFound" 422: description: Invalid request body content: @@ -83,6 +217,262 @@ paths: schema: $ref: "#/components/schemas/ValidationError" + post: + tags: [assetsEdit] + summary: Update information about an asset + description: Update information about a single asset. + + parameters: + - name: id + in: path + required: true + description: The asset's unique identifier. + schema: + type: string + + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AssetDetails" + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + type: object + properties: + id: + description: The id of the updated asset + type: string + + /asset/{id}/delete: + post: + tags: [assets] + summary: Soft-delete an asset + description: Soft-delete an asset. Useable by moderators and the owner of the asset. + + parameters: + - name: id + in: path + required: true + description: The asset's unique identifier. + schema: + type: string + + requestBody: + description: The token for the authenticated user + required: true + content: + application/json: + schema: + type: object + properties: + token: + type: string + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/SuccessfulAssetOperation" + + /asset/{id}/support_level: + post: + tags: [assets] + summary: Change the support level of an asset + description: API used by moderators to change the support level of an asset. + + parameters: + - name: id + in: path + required: true + description: The asset's unique identifier. + schema: + type: string + + requestBody: + description: The token for the authenticated user + required: true + content: + application/json: + schema: + type: object + properties: + token: + type: string + support_Level: + type: string + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/SuccessfulAssetOperation" + + /asset/edit/{id}: + get: + tags: [assetsEdit] + summary: Returns a previously-submitted asset edit + description: Returns a previously-submitted asset edit. All fields with null are unchanged, and will stay the same as in the original. The previews array is merged from the new and original previews. + + parameters: + - name: id + in: path + required: true + description: The edit's unique identifier. + schema: + type: string + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/EditDetails" + + post: + tags: [assetsEdit] + summary: Update information about an asset + description: Update information about a single asset. + + parameters: + - name: id + in: path + required: true + description: The asset's unique identifier. + schema: + type: string + + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/AssetDetails" + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + type: object + properties: + id: + description: The id of the updated asset + type: string + + /asset/edit/{id}/review: + post: + tags: [assetsEdit] + summary: Put an edit in review + description: Moderator-only. Put an edit in review. It is impossible to change it after this. + + parameters: + - name: id + in: path + required: true + description: The edit's unique identifier. + schema: + type: string + + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + token: + description: The authentication token + type: string + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/EditSummary" + + /asset/edit/{id}/accept: + post: + tags: [assetsEdit] + summary: Apply an edit previously put in review + description: Moderator-only. Apply an edit previously put in review. + + parameters: + - name: id + in: path + required: true + description: The edit's unique identifier. + schema: + type: string + + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + token: + description: The authentication token + type: string + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/EditSummary" + + /asset/edit/{id}/reject: + post: + tags: [assetsEdit] + summary: Reject an edit previously put in review + description: Moderator-only. Reject an edit previously put in review. + + parameters: + - name: id + in: path + required: true + description: The edit's unique identifier. + schema: + type: string + + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + token: + description: The authentication token + type: string + reason: + description: The reason why the edit was rejected + type: string + + responses: + 200: + description: Successful operation + content: + "application/json": + schema: + $ref: "#/components/schemas/EditSummary" + /configure: get: tags: [configure] @@ -200,7 +590,107 @@ components: schema: type: boolean + schemas: + RegisterSuccessfulResult: + type: object + properties: + registered: + type: boolean + username: + type: string + + LoginSuccessfulResult: + type: object + properties: + authenticated: + type: boolean + username: + type: string + token: + type: string + url: + type: string + + LogoutSuccessfulResult: + type: object + properties: + authenticated: + type: boolean + token: + type: string + + ChangePwdSuccessfulResult: + type: object + properties: + token: + type: string + + LoginForbiddenResult: + allOf: + - $ref: "#/components/schemas/Error" + - type: object + properties: + authenticated: + type: boolean + + LoginNotFoundResult: + allOf: + - $ref: "#/components/schemas/Error" + + UsernamePassword: + type: object + properties: + username: + type: string + password: + type: string + + UserDetails: + allOf: + - $ref: "#/components/schemas/UsernamePassword" + - type: object + properties: + email: + type: string + + ChangePassword: + type: object + properties: + token: + type: string + old_password: + type: string + new_password: + type: string + + SuccessfulAssetOperation: + type: object + properties: + changed: + type: boolean + + EditSummary: + type: object + properties: + edit_id: + type: string + status: + type: string + reason: + type: string + warning: + type: string + + EditDetails: + allOf: + - $ref: "#/components/schemas/EditSummary" + - $ref: "#/components/schemas/AssetSummary" + - type: object + properties: + original: + $ref: "#/components/schemas/AssetDetails" + AssetSummary: type: object description: | @@ -411,7 +901,11 @@ components: type: integer description: The total string of items available. - NotFoundError: + AssetNotFound: + allOf: + - $ref: "#/components/schemas/Error" + + Error: type: object description: The requested resource was not found. properties: From 2bc6b8fb1a23de7980b94744223d43253d54c174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Santilio?= Date: Fri, 23 Dec 2022 09:14:37 +0100 Subject: [PATCH 4/5] (add) token in request - rename file --- api/{openapi_v1.yaml => openapi.yaml} | 85 +++++++++++++++------------ 1 file changed, 49 insertions(+), 36 deletions(-) rename api/{openapi_v1.yaml => openapi.yaml} (93%) diff --git a/api/openapi_v1.yaml b/api/openapi.yaml similarity index 93% rename from api/openapi_v1.yaml rename to api/openapi.yaml index cbaf7b6..ecec6d3 100644 --- a/api/openapi_v1.yaml +++ b/api/openapi.yaml @@ -4,6 +4,17 @@ info: title: Godot Asset Library description: Godot Engine's asset library version: "1.0.0" + termsOfService: https://github.com/godotengine/.github/blob/master/CODE_OF_CONDUCT.md + contact: + name: Contact the author + url: https://github.com/fenix-hub + license: + name: MIT License + url: https://github.com/godotengine/godot-asset-library/blob/master/LICENSE.txt + +externalDocs: + description: Markdown version + url: https://github.com/fenix-hub/godot-asset-library/blob/swagger/API.md servers: - url: "https://godotengine.org/asset-library/api" @@ -90,10 +101,7 @@ paths: content: application/json: schema: - type: object - properties: - token: - type: string + $ref: "#/components/schemas/AuthToken" responses: 200: @@ -165,7 +173,9 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AssetDetails" + allOf: + - $ref: "#/components/schemas/AuthToken" + - $ref: "#/components/schemas/AssetDetails" responses: 200: @@ -235,7 +245,9 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/AssetDetails" + allOf: + - $ref: "#/components/schemas/AuthToken" + - $ref: "#/components/schemas/AssetDetails" responses: 200: @@ -269,10 +281,7 @@ paths: content: application/json: schema: - type: object - properties: - token: - type: string + $ref: "#/components/schemas/AuthToken" responses: 200: @@ -302,12 +311,14 @@ paths: content: application/json: schema: - type: object - properties: - token: - type: string - support_Level: - type: string + allOf: + - $ref: "#/components/schemas/AuthToken" + - type: object + properties: + token: + type: string + support_level: + type: string responses: 200: @@ -390,11 +401,7 @@ paths: content: application/json: schema: - type: object - properties: - token: - description: The authentication token - type: string + $ref: "#/components/schemas/AuthToken" responses: 200: @@ -423,12 +430,8 @@ paths: content: application/json: schema: - type: object - properties: - token: - description: The authentication token - type: string - + $ref: "#/components/schemas/AuthToken" + responses: 200: description: Successful operation @@ -456,14 +459,13 @@ paths: content: application/json: schema: - type: object - properties: - token: - description: The authentication token - type: string - reason: - description: The reason why the edit was rejected - type: string + allOf: + - $ref: "#/components/schemas/AuthToken" + - type: object + properties: + reason: + description: The reason why the edit was rejected + type: string responses: 200: @@ -592,6 +594,14 @@ components: schemas: + AuthToken: + type: object + properties: + token: + type: string + required: + - token + RegisterSuccessfulResult: type: object properties: @@ -697,6 +707,9 @@ components: A resource provided by the asset library (add-on, project, ...). These properties are returned both when requesting a list of assets or a specific asset. properties: + token: + type: string + description: The Token obtained thorugh a login. asset_id: type: string description: The asset's unique identifier. @@ -996,4 +1009,4 @@ components: page: 0 pages: 0 page_length: 10 - total_items: 1 \ No newline at end of file + total_items: 1 From ef582b0b6b006d3a014da5ac593312d49fdd5eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Santilio?= Date: Fri, 23 Dec 2022 10:01:08 +0100 Subject: [PATCH 5/5] add `download_provider` as enum --- api/openapi.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/openapi.yaml b/api/openapi.yaml index ecec6d3..dabc8b9 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -730,6 +730,8 @@ components: description: The unique identifier of the category the asset belongs to. download_provider: type: string + enum: [Custom, GitHub, GitLab, BitBucket, Gogs/Gitea, cgit] + description: The download provider where the plugin source is hosted. download_commit: type: string download_hash: