From d3e39567f479abaddf33870c5444f0664b84b892 Mon Sep 17 00:00:00 2001 From: Alexandre Franke Date: Mon, 31 Jan 2022 11:31:29 +0100 Subject: [PATCH] Responses schema fixes (#3650) Fixes #2237. Corrects the response schemas for: ``` PUT /user/{user_id}/account_data/{account_dataType} PUT /user/{user_id}/rooms/{roomId}/account_data/{type} PUT /directory/list/room/{roomId} PUT /sendToDevice/{eventType}/{txnId} POST /account/3pid POST /account/3pid/add POST /account/3pid/bind ``` --- .../newsfragments/3650.clarification | 1 + data/api/client-server/account-data.yaml | 8 ++++ .../client-server/administrative_contact.yaml | 46 +++++++++---------- data/api/client-server/key_backup.yaml | 3 +- data/api/client-server/list_public_rooms.yaml | 2 + data/api/client-server/to_device.yaml | 5 +- 6 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 changelogs/client_server/newsfragments/3650.clarification diff --git a/changelogs/client_server/newsfragments/3650.clarification b/changelogs/client_server/newsfragments/3650.clarification new file mode 100644 index 00000000..e0fdc4ce --- /dev/null +++ b/changelogs/client_server/newsfragments/3650.clarification @@ -0,0 +1 @@ +Correct the schema for the responses for various API endpoints. diff --git a/data/api/client-server/account-data.yaml b/data/api/client-server/account-data.yaml index 89c2f220..f7e7993d 100644 --- a/data/api/client-server/account-data.yaml +++ b/data/api/client-server/account-data.yaml @@ -67,6 +67,10 @@ paths: 200: description: The account_data was successfully added. + examples: + application/json: {} + schema: + type: object tags: - User data get: @@ -151,6 +155,10 @@ paths: 200: description: The account_data was successfully added. + examples: + application/json: {} + schema: + type: object tags: - User data get: diff --git a/data/api/client-server/administrative_contact.yaml b/data/api/client-server/administrative_contact.yaml index 84c24a9f..e2e782aa 100644 --- a/data/api/client-server/administrative_contact.yaml +++ b/data/api/client-server/administrative_contact.yaml @@ -149,26 +149,26 @@ paths: application/json: { "submit_url": "https://example.org/path/to/submitToken" } - schema: - type: object - properties: - submit_url: - type: string - format: uri - description: |- - An optional field containing a URL where the client must - submit the validation token to, with identical parameters - to the Identity Service API's `POST - /validate/email/submitToken` endpoint (without the requirement - for an access token). The homeserver must send this token to the - user (if applicable), who should then be prompted to provide it - to the client. + schema: + type: object + properties: + submit_url: + type: string + format: uri + description: |- + An optional field containing a URL where the client must + submit the validation token to, with identical parameters + to the Identity Service API's `POST + /validate/email/submitToken` endpoint (without the requirement + for an access token). The homeserver must send this token to the + user (if applicable), who should then be prompted to provide it + to the client. - If this field is not present, the client can assume that - verification will happen without the client's involvement - provided the homeserver advertises this specification version - in the `/versions` response (ie: r0.5.0). - example: "https://example.org/path/to/submitToken" + If this field is not present, the client can assume that + verification will happen without the client's involvement + provided the homeserver advertises this specification version + in the `/versions` response (ie: r0.5.0). + example: "https://example.org/path/to/submitToken" 403: description: The credentials could not be verified with the identity server. examples: @@ -223,8 +223,8 @@ paths: description: The addition was successful. examples: application/json: {} - schema: - type: object + schema: + type: object 401: description: |- The homeserver requires additional authentication information. @@ -282,8 +282,8 @@ paths: description: The addition was successful. examples: application/json: {} - schema: - type: object + schema: + type: object 429: description: This request was rate-limited. schema: diff --git a/data/api/client-server/key_backup.yaml b/data/api/client-server/key_backup.yaml index 00ecdba6..9ec72aeb 100644 --- a/data/api/client-server/key_backup.yaml +++ b/data/api/client-server/key_backup.yaml @@ -298,9 +298,10 @@ paths: responses: 200: description: The update succeeded. + examples: + application/json: {} schema: type: object - properties: {} 400: description: |- A parameter was incorrect. For example, the `algorithm` does not diff --git a/data/api/client-server/list_public_rooms.yaml b/data/api/client-server/list_public_rooms.yaml index fd776b52..b702f1bf 100644 --- a/data/api/client-server/list_public_rooms.yaml +++ b/data/api/client-server/list_public_rooms.yaml @@ -104,6 +104,8 @@ paths: description: The visibility was updated, or no change was needed. examples: application/json: {} + schema: + type: object 404: description: The room is not known to the server examples: diff --git a/data/api/client-server/to_device.yaml b/data/api/client-server/to_device.yaml index c74aee55..fb0c1d37 100644 --- a/data/api/client-server/to_device.yaml +++ b/data/api/client-server/to_device.yaml @@ -85,7 +85,8 @@ paths: description: The message was successfully sent. examples: - application/json: { - } + application/json: {} + schema: + type: object tags: - Send-to-Device messaging