From 820704a16a7e38d0deac1747a3a66f358ff2dd5a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 26 Sep 2017 17:53:28 +0100 Subject: [PATCH] Format examples as raw objects According the the openapi spec, examples for responses and schemas should be raw objects rather than being json strings. (It's unclear what non-json examples should look like...). The swagger UI used to support json strings, but no longer does. In short, let's turn the json strings into their raw formats. --- .../application_service.yaml | 33 ++++++--------- api/check_examples.py | 21 ++-------- api/client-server/account-data.yaml | 8 ++-- api/client-server/admin.yaml | 3 +- api/client-server/administrative_contact.yaml | 11 ++--- api/client-server/banning.yaml | 20 ++++------ api/client-server/content-repo.yaml | 3 +- api/client-server/create_room.yaml | 6 +-- api/client-server/device_management.yaml | 14 +++---- api/client-server/directory.yaml | 20 ++++------ api/client-server/event_context.yaml | 3 +- api/client-server/filter.yaml | 9 ++--- api/client-server/inviting.yaml | 11 +++-- api/client-server/joining.yaml | 22 +++++----- api/client-server/kicking.yaml | 10 ++--- api/client-server/leaving.yaml | 8 ++-- api/client-server/list_public_rooms.yaml | 10 ++--- api/client-server/login.yaml | 13 +++--- api/client-server/message_pagination.yaml | 3 +- api/client-server/notifications.yaml | 3 +- api/client-server/old_sync.yaml | 9 ++--- api/client-server/peeking_events.yaml | 3 +- api/client-server/presence.yaml | 20 ++++------ api/client-server/profile.yaml | 23 +++++------ api/client-server/pusher.yaml | 13 +++--- api/client-server/pushrules.yaml | 40 ++++++++----------- api/client-server/receipts.yaml | 8 ++-- api/client-server/redaction.yaml | 6 +-- api/client-server/registration.yaml | 15 +++---- api/client-server/room_initial_sync.yaml | 3 +- api/client-server/room_send.yaml | 6 +-- api/client-server/room_state.yaml | 12 ++---- api/client-server/rooms.yaml | 14 +++---- api/client-server/search.yaml | 6 +-- api/client-server/sync.yaml | 3 +- api/client-server/tags.yaml | 15 ++++--- api/client-server/third_party_membership.yaml | 11 +++-- api/client-server/to_device.yaml | 4 +- api/client-server/typing.yaml | 7 ++-- api/client-server/versions.yaml | 3 +- api/client-server/voip.yaml | 3 +- api/identity/lookup.yaml | 3 +- api/identity/pubkey.yaml | 9 ++--- api/push-gateway/push_notifier.yaml | 6 +-- 44 files changed, 183 insertions(+), 290 deletions(-) diff --git a/api/application-service/application_service.yaml b/api/application-service/application_service.yaml index d7ad5b19..45a53946 100644 --- a/api/application-service/application_service.yaml +++ b/api/application-service/application_service.yaml @@ -45,8 +45,7 @@ paths: description: A list of events schema: type: object - example: |- - { + example: { "events": [ { "age": 32, @@ -87,8 +86,8 @@ paths: 200: description: The transaction was processed successfully. examples: - application/json: |- - {} + application/json: { + } schema: type: object @@ -117,8 +116,8 @@ paths: information about the room such as its name and topic can be set before responding. examples: - application/json: |- - {} + application/json: { + } schema: type: object 401: @@ -126,8 +125,7 @@ paths: The homeserver has not supplied credentials to the application service. Optional error information can be included in the body of this response. examples: - application/json: |- - { + application/json: { "errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED" } schema: @@ -136,8 +134,7 @@ paths: description: |- The credentials supplied by the homeserver were rejected. examples: - application/json: |- - { + application/json: { "errcode": "M_FORBIDDEN" } schema: @@ -147,8 +144,7 @@ paths: The application service indicates that this room alias does not exist. Optional error information can be included in the body of this response. examples: - application/json: |- - { + application/json: { "errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND" } schema: @@ -175,8 +171,8 @@ paths: The application service indicates that this user exists. The application service MUST create the user using the client-server API. examples: - application/json: |- - {} + application/json: { + } schema: type: object 401: @@ -184,8 +180,7 @@ paths: The homeserver has not supplied credentials to the application service. Optional error information can be included in the body of this response. examples: - application/json: |- - { + application/json: { "errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED" } schema: @@ -194,8 +189,7 @@ paths: description: |- The credentials supplied by the homeserver were rejected. examples: - application/json: |- - { + application/json: { "errcode": "M_FORBIDDEN" } schema: @@ -205,8 +199,7 @@ paths: The application service indicates that this user does not exist. Optional error information can be included in the body of this response. examples: - application/json: |- - { + application/json: { "errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND" } schema: diff --git a/api/check_examples.py b/api/check_examples.py index 009055be..be0676bb 100755 --- a/api/check_examples.py +++ b/api/check_examples.py @@ -45,15 +45,8 @@ except ImportError as e: def check_parameter(filepath, request, parameter): schema = parameter.get("schema") - example = None - try: - example_json = schema.get('example') - if example_json and not schema.get("format") == "byte": - example = json.loads(example_json) - except Exception as e: - raise ValueError("Error parsing JSON example request for %r" % ( - request - ), e) + example = schema.get('example') + fileurl = "file://" + os.path.abspath(filepath) if example and schema: try: @@ -72,15 +65,7 @@ def check_parameter(filepath, request, parameter): def check_response(filepath, request, code, response): - example = None - try: - example_json = response.get('examples', {}).get('application/json') - if example_json: - example = json.loads(example_json) - except Exception as e: - raise ValueError("Error parsing JSON example response for %r %r" % ( - request, code - ), e) + example = response.get('examples', {}).get('application/json') schema = response.get('schema') fileurl = "file://" + os.path.abspath(filepath) if example and schema: diff --git a/api/client-server/account-data.yaml b/api/client-server/account-data.yaml index 934c59cf..d8e93ef4 100644 --- a/api/client-server/account-data.yaml +++ b/api/client-server/account-data.yaml @@ -60,8 +60,8 @@ paths: The content of the account_data schema: type: object - example: |- - {"custom_account_data_key": "custom_config_value"} + example: { + "custom_account_data_key": "custom_config_value"} responses: 200: description: @@ -108,8 +108,8 @@ paths: The content of the account_data schema: type: object - example: |- - {"custom_account_data_key": "custom_account_data_value"} + example: { + "custom_account_data_key": "custom_account_data_value"} responses: 200: description: diff --git a/api/client-server/admin.yaml b/api/client-server/admin.yaml index a27596a8..d5b964b3 100644 --- a/api/client-server/admin.yaml +++ b/api/client-server/admin.yaml @@ -49,8 +49,7 @@ paths: 200: description: The lookup was successful. examples: - application/json: |- - { + application/json: { "user_id": "@peter:rabbit.rocks", "devices": { "teapot": { diff --git a/api/client-server/administrative_contact.yaml b/api/client-server/administrative_contact.yaml index 73f2e05c..e9b7caa4 100644 --- a/api/client-server/administrative_contact.yaml +++ b/api/client-server/administrative_contact.yaml @@ -45,8 +45,7 @@ paths: 200: description: The lookup was successful. examples: - application/json: |- - { + application/json: { "threepids": [ { "medium": "email", @@ -106,8 +105,7 @@ paths: server. Default: ``false``. x-example: true required: ["three_pid_creds"] - example: |- - { + example: { "three_pid_creds": { "id_server": "matrix.org", "sid": "abc123987", @@ -119,14 +117,13 @@ paths: 200: description: The addition was successful. examples: - application/json: "{}" + application/json: {} schema: type: object 403: description: The credentials could not be verified with the identity server. examples: - application/json: |- - { + application/json: { "errcode": "M_THREEPID_AUTH_FAILED", "error": "The third party credentials could not be verified by the identity server." } diff --git a/api/client-server/banning.yaml b/api/client-server/banning.yaml index cdeaaa5d..517552a6 100644 --- a/api/client-server/banning.yaml +++ b/api/client-server/banning.yaml @@ -50,8 +50,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "reason": "Telling unfunny jokes", "user_id": "@cheeky_monkey:matrix.org" } @@ -67,8 +66,8 @@ paths: 200: description: The user has been kicked and banned from the room. examples: - application/json: |- - {} + application/json: { + } schema: type: object 403: @@ -78,8 +77,7 @@ paths: - The banner is not currently in the room. - The banner's power level is insufficient to ban users from the room. examples: - application/json: |- - { + application/json: { "errcode": "M_FORBIDDEN", "error": "You do not have a high enough power level to ban from this room." } @@ -107,8 +105,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "user_id": "@cheeky_monkey:matrix.org" } properties: @@ -120,8 +117,8 @@ paths: 200: description: The user has been unbanned from the room. examples: - application/json: |- - {} + application/json: { + } schema: type: object 403: @@ -130,8 +127,7 @@ paths: - The unbanner's power level is insufficient to unban users from the room. examples: - application/json: |- - { + application/json: { "errcode": "M_FORBIDDEN", "error": "You do not have a high enough power level to unban from this room." } diff --git a/api/client-server/content-repo.yaml b/api/client-server/content-repo.yaml index f9c92a0d..ebb63ba4 100644 --- a/api/client-server/content-repo.yaml +++ b/api/client-server/content-repo.yaml @@ -57,8 +57,7 @@ paths: type: string description: "The MXC URI to the uploaded content." examples: - "application/json": |- - { + application/json: { "content_uri": "mxc://example.com/AQwafuaFswefuhsfAFAgsw" } tags: diff --git a/api/client-server/create_room.yaml b/api/client-server/create_room.yaml index a321b0f7..8b9ea6f0 100644 --- a/api/client-server/create_room.yaml +++ b/api/client-server/create_room.yaml @@ -54,8 +54,7 @@ paths: description: The desired room configuration. schema: type: object - example: |- - { + example: { "preset": "public_chat", "room_alias_name": "thepub", "name": "The Grand Duke Pub", @@ -188,8 +187,7 @@ paths: description: |- The created room's ID. examples: - application/json: |- - { + application/json: { "room_id": "!sefiuhWgwghwWgh:example.com" } 400: diff --git a/api/client-server/device_management.yaml b/api/client-server/device_management.yaml index ddfbad85..3ee9c746 100644 --- a/api/client-server/device_management.yaml +++ b/api/client-server/device_management.yaml @@ -49,8 +49,7 @@ paths: allOf: - $ref: "definitions/client_device.yaml" examples: - application/json: |- - { + application/json: { "devices": [ { "device_id": "QBUAZIFURK", @@ -84,8 +83,7 @@ paths: allOf: - $ref: "definitions/client_device.yaml" examples: - application/json: |- - { + application/json: { "device_id": "QBUAZIFURK", "display_name": "android", "last_seen_ip": "1.2.3.4", @@ -125,8 +123,8 @@ paths: 200: description: The device was successfully updated. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 404: @@ -166,8 +164,8 @@ paths: schema: type: object examples: - application/json: |- - {} + application/json: { + } 401: description: |- The homeserver requires additional authentication information. diff --git a/api/client-server/directory.yaml b/api/client-server/directory.yaml index 0a69a8ec..bfa71a73 100644 --- a/api/client-server/directory.yaml +++ b/api/client-server/directory.yaml @@ -49,23 +49,21 @@ paths: room_id: type: string description: The room ID to set. - example: |- - { + example: { "room_id": "!abnjk1jdasj98:capuchins.com" } responses: 200: description: The mapping was created. examples: - application/json: |- - {} + application/json: { + } schema: type: object 409: description: A room alias with that name already exists. examples: - application/json: |- - { + application/json: { "errcode": "M_UNKNOWN", "error": "Room alias #monkeys:matrix.org already exists." } @@ -103,8 +101,7 @@ paths: type: string description: A server which is aware of this room alias. examples: - application/json: |- - { + application/json: { "room_id": "!abnjk1jdasj98:capuchins.com", "servers": [ "capuchins.com", @@ -115,8 +112,7 @@ paths: 404: description: There is no mapped room ID for this room alias. examples: - application/json: |- - { + application/json: { "errcode": "M_NOT_FOUND", "error": "Room alias #monkeys:matrix.org not found." } @@ -141,8 +137,8 @@ paths: 200: description: The mapping was deleted. examples: - application/json: |- - {} + application/json: { + } schema: type: object tags: diff --git a/api/client-server/event_context.yaml b/api/client-server/event_context.yaml index 8c5567b2..14889819 100644 --- a/api/client-server/event_context.yaml +++ b/api/client-server/event_context.yaml @@ -99,8 +99,7 @@ paths: allOf: - "$ref": "definitions/event-schemas/schema/core-event-schema/state_event.yaml" examples: - application/json: |- - { + application/json: { "end": "t29-57_2_0_2", "events_after": [ { diff --git a/api/client-server/filter.yaml b/api/client-server/filter.yaml index cfd55920..ac8e04f5 100644 --- a/api/client-server/filter.yaml +++ b/api/client-server/filter.yaml @@ -52,8 +52,7 @@ paths: type: object allOf: - $ref: "definitions/sync_filter.yaml" - example: |- - { + example: { "room": { "state": { "types": ["m.room.*"], @@ -82,8 +81,7 @@ paths: 200: description: The filter was created. examples: - application/json: |- - { + application/json: { "filter_id": "66696p746572" } schema: @@ -120,8 +118,7 @@ paths: description: |- "The filter defintion" examples: - application/json: |- - { + application/json: { "room": { "state": { "types": ["m.room.*"], diff --git a/api/client-server/inviting.yaml b/api/client-server/inviting.yaml index e73d44fc..942be63e 100644 --- a/api/client-server/inviting.yaml +++ b/api/client-server/inviting.yaml @@ -65,8 +65,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "user_id": "@cheeky_monkey:matrix.org" } properties: @@ -78,8 +77,8 @@ paths: 200: description: The user has been invited to join the room. examples: - application/json: |- - {} + application/json: { + } schema: type: object 403: @@ -91,8 +90,8 @@ paths: - The inviter is not currently in the room. - The inviter's power level is insufficient to invite users to the room. examples: - application/json: |- - {"errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"} + application/json: { + "errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"} 429: description: This request was rate-limited. schema: diff --git a/api/client-server/joining.yaml b/api/client-server/joining.yaml index 92454239..c2388c2f 100644 --- a/api/client-server/joining.yaml +++ b/api/client-server/joining.yaml @@ -57,8 +57,7 @@ paths: name: third_party_signed schema: type: object - example: |- - { + example: { "third_party_signed": { "sender": "@cat:the.hat", "mxid": "@green:eggs.ham", @@ -97,8 +96,8 @@ paths: The joined room ID must be returned in the ``room_id`` field. examples: - application/json: |- - {"room_id": "!d41d8cd:matrix.org"} + application/json: { + "room_id": "!d41d8cd:matrix.org"} schema: type: object 403: @@ -108,8 +107,8 @@ paths: - The room is invite-only and the user was not invited. - The user has been banned from the room. examples: - application/json: |- - {"errcode": "M_FORBIDDEN", "error": "You are not invited to this room."} + application/json: { + "errcode": "M_FORBIDDEN", "error": "You are not invited to this room."} 429: description: This request was rate-limited. schema: @@ -146,8 +145,7 @@ paths: name: third_party_signed schema: type: object - example: |- - { + example: { "third_party_signed": { "signed": { "sender": "@cat:the.hat", @@ -193,8 +191,8 @@ paths: The joined room ID must be returned in the ``room_id`` field. examples: - application/json: |- - {"room_id": "!d41d8cd:matrix.org"} + application/json: { + "room_id": "!d41d8cd:matrix.org"} schema: type: object 403: @@ -204,8 +202,8 @@ paths: - The room is invite-only and the user was not invited. - The user has been banned from the room. examples: - application/json: |- - {"errcode": "M_FORBIDDEN", "error": "You are not invited to this room."} + application/json: { + "errcode": "M_FORBIDDEN", "error": "You are not invited to this room."} 429: description: This request was rate-limited. schema: diff --git a/api/client-server/kicking.yaml b/api/client-server/kicking.yaml index 137e72cf..fbc0db72 100644 --- a/api/client-server/kicking.yaml +++ b/api/client-server/kicking.yaml @@ -48,8 +48,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "reason": "Telling unfunny jokes", "user_id": "@cheeky_monkey:matrix.org" } @@ -65,8 +64,8 @@ paths: 200: description: The user has been kicked from the room. examples: - application/json: |- - {} + application/json: { + } schema: type: object 403: @@ -77,8 +76,7 @@ paths: - The kickee is not currently in the room. - The kicker's power level is insufficient to kick users from the room. examples: - application/json: |- - { + application/json: { "errcode": "M_FORBIDDEN", "error": "You do not have a high enough power level to kick from this room." } diff --git a/api/client-server/leaving.yaml b/api/client-server/leaving.yaml index 655308d2..a70b8a80 100644 --- a/api/client-server/leaving.yaml +++ b/api/client-server/leaving.yaml @@ -56,8 +56,8 @@ paths: description: |- The room has been left. examples: - application/json: |- - {} + application/json: { + } schema: type: object 429: @@ -93,8 +93,8 @@ paths: description: |- The room has been forgotten. examples: - application/json: |- - {} + application/json: { + } schema: type: object 429: diff --git a/api/client-server/list_public_rooms.yaml b/api/client-server/list_public_rooms.yaml index 3aa449d3..86e15095 100644 --- a/api/client-server/list_public_rooms.yaml +++ b/api/client-server/list_public_rooms.yaml @@ -132,8 +132,7 @@ paths: An estimate on the total number of public rooms, if the server has an estimate. examples: - application/json: |- - { + application/json: { "chunk": [ { "aliases": ["#murrays:cheese.bar"], @@ -198,8 +197,8 @@ paths: description: |- A string to search for in the room metadata, e.g. name, topic, canonical alias etc. (Optional). - example: |- - {"limit": 10, "filter": {"generic_search_term": "foo"}} + example: { + "limit": 10, "filter": {"generic_search_term": "foo"}} responses: 200: description: A list of the rooms on the server. @@ -279,8 +278,7 @@ paths: An estimate on the total number of public rooms, if the server has an estimate. examples: - application/json: |- - { + application/json: { "chunk": [ { "aliases": ["#murrays:cheese.bar"], diff --git a/api/client-server/login.yaml b/api/client-server/login.yaml index 8c0282be..c6dc0848 100644 --- a/api/client-server/login.yaml +++ b/api/client-server/login.yaml @@ -46,8 +46,7 @@ paths: name: body schema: type: object - example: |- - { + example: { "type": "m.login.password", "user": "cheeky_monkey", "password": "ilovebananas", @@ -93,8 +92,7 @@ paths: 200: description: The user has been authenticated. examples: - application/json: |- - { + application/json: { "user_id": "@cheeky_monkey:matrix.org", "access_token": "abc123", "home_server": "matrix.org", @@ -123,8 +121,7 @@ paths: description: |- Part of the request was invalid. For example, the login type may not be recognised. examples: - application/json: |- - { + application/json: { "errcode": "M_UNKNOWN", "error": "Bad login type." } @@ -132,8 +129,8 @@ paths: description: |- The login attempt failed. For example, the password may have been incorrect. examples: - application/json: |- - {"errcode": "M_FORBIDDEN"} + application/json: { + "errcode": "M_FORBIDDEN"} 429: description: This request was rate-limited. schema: diff --git a/api/client-server/message_pagination.yaml b/api/client-server/message_pagination.yaml index 005b8fb3..734565ec 100644 --- a/api/client-server/message_pagination.yaml +++ b/api/client-server/message_pagination.yaml @@ -107,8 +107,7 @@ paths: type: object title: RoomEvent examples: - application/json: |- - { + application/json: { "start": "t47429-4392820_219380_26003_2265", "end": "t47409-4357353_219380_26003_2265", "chunk": [ diff --git a/api/client-server/notifications.yaml b/api/client-server/notifications.yaml index 8a5e9553..3c92e310 100644 --- a/api/client-server/notifications.yaml +++ b/api/client-server/notifications.yaml @@ -62,8 +62,7 @@ paths: 200: description: A batch of events is being returned examples: - application/json: |- - { + application/json: { "next_token": "abcdef", "notifications": [ { diff --git a/api/client-server/old_sync.yaml b/api/client-server/old_sync.yaml index e3e1ea8a..c4da0ea1 100644 --- a/api/client-server/old_sync.yaml +++ b/api/client-server/old_sync.yaml @@ -59,8 +59,7 @@ paths: 200: description: "The events received, which may be none." examples: - application/json: |- - { + application/json: { "start": "s3456_9_0", "end": "s3457_9_0", "chunk": [ @@ -138,8 +137,7 @@ paths: 200: description: The user's current state. examples: - application/json: |- - { + application/json: { "end": "s3456_9_0", "presence": [ { @@ -421,8 +419,7 @@ paths: 200: description: The full event. examples: - application/json: |- - { + application/json: { "content": { "body": "Hello world!", "msgtype": "m.text" diff --git a/api/client-server/peeking_events.yaml b/api/client-server/peeking_events.yaml index e33a4ce3..7c109ce7 100644 --- a/api/client-server/peeking_events.yaml +++ b/api/client-server/peeking_events.yaml @@ -69,8 +69,7 @@ paths: 200: description: "The events received, which may be none." examples: - application/json: |- - { + application/json: { "start": "s3456_9_0", "end": "s3457_9_0", "chunk": [ diff --git a/api/client-server/presence.yaml b/api/client-server/presence.yaml index 7a963067..f17f9c73 100644 --- a/api/client-server/presence.yaml +++ b/api/client-server/presence.yaml @@ -50,8 +50,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "presence": "online", "status_msg": "I am here." } @@ -68,8 +67,8 @@ paths: 200: description: The new presence state was set. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 429: @@ -93,8 +92,7 @@ paths: 200: description: The presence state for this user. examples: - application/json: |- - { + application/json: { "presence": "unavailable", "last_active_ago": 420845 } @@ -143,8 +141,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "invite": [ "@bob:matrix.org" ], @@ -169,8 +166,8 @@ paths: 200: description: The list was updated. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 429: @@ -194,8 +191,7 @@ paths: 200: description: A list of presence events for this list. examples: - application/json: |- - [ + application/json: [ { "content": { "last_active_ago": 395, diff --git a/api/client-server/profile.yaml b/api/client-server/profile.yaml index 89ebdc2a..10e2a369 100644 --- a/api/client-server/profile.yaml +++ b/api/client-server/profile.yaml @@ -48,8 +48,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "displayname": "Alice Margatroid" } properties: @@ -60,8 +59,8 @@ paths: 200: description: The display name was set. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 429: @@ -87,8 +86,7 @@ paths: 200: description: The display name for this user. examples: - application/json: |- - { + application/json: { "displayname": "Alice Margatroid" } schema: @@ -122,8 +120,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "avatar_url": "mxc://matrix.org/wefh34uihSDRGhw34" } properties: @@ -134,8 +131,8 @@ paths: 200: description: The avatar URL was set. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 429: @@ -161,8 +158,7 @@ paths: 200: description: The avatar URL for this user. examples: - application/json: |- - { + application/json: { "avatar_url": "mxc://matrix.org/SDGdghriugerRg" } schema: @@ -194,8 +190,7 @@ paths: 200: description: The avatar URL for this user. examples: - application/json: |- - { + application/json: { "avatar_url": "mxc://matrix.org/SDGdghriugerRg", "displayname": "Alice Margatroid" } diff --git a/api/client-server/pusher.yaml b/api/client-server/pusher.yaml index 5807b007..0183520f 100644 --- a/api/client-server/pusher.yaml +++ b/api/client-server/pusher.yaml @@ -38,8 +38,7 @@ paths: 200: description: The pushers for this user examples: - application/json: |- - { + application/json: { "pushers": [ { "pushkey": "Xp/MzCt8/9DcSNE9cuiaoT5Ac55job3TdLSSmtmYl4A=", @@ -133,8 +132,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "lang": "en", "kind": "http", "app_display_name": "Mat Rix", @@ -216,15 +214,14 @@ paths: 200: description: The pusher was set. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 400: description: One or more of the pusher values were invalid. examples: - application/json: |- - { + application/json: { "error": "Missing parameters: lang, data", "errcode": "M_MISSING_PARAM" } diff --git a/api/client-server/pushrules.yaml b/api/client-server/pushrules.yaml index 0ba8d481..2bc7e2a8 100644 --- a/api/client-server/pushrules.yaml +++ b/api/client-server/pushrules.yaml @@ -52,8 +52,7 @@ paths: "$ref": "definitions/push_ruleset.yaml" ] examples: - application/json: |- - { + application/json: { "global": { "content": [ { @@ -279,8 +278,7 @@ paths: The specific push rule. This will also include keys specific to the rule itself such as the rule's ``actions`` and ``conditions`` if set. examples: - application/json: |- - { + application/json: { "actions": [ "dont_notify" ], @@ -330,8 +328,8 @@ paths: 200: description: The push rule was deleted. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object tags: @@ -393,8 +391,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "pattern": "cake*lie", "actions": ["notify"] } @@ -425,15 +422,14 @@ paths: 200: description: The pusher was set. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 400: description: There was a problem configuring this push rule. examples: - application/json: |- - { + application/json: { "error": "before/after rule not found: someRuleId", "errcode": "M_UNKNOWN" } @@ -480,8 +476,7 @@ paths: 200: description: Whether the push rule is enabled. examples: - application/json: |- - { + application/json: { "enabled": true } schema: @@ -532,16 +527,15 @@ paths: type: boolean description: Whether the push rule is enabled or not. required: ["enabled"] - example: |- - { + example: { "enabled": true } responses: 200: description: The push rule was enabled or disabled. examples: - application/json: |- - {} + application/json: { + } schema: type: object tags: @@ -581,8 +575,7 @@ paths: 200: description: The actions for this push rule. examples: - application/json: |- - { + application/json: { "actions": ["notify"] } schema: @@ -640,16 +633,15 @@ paths: enum: ["notify", "dont_notify", "coalesce", "set_tweak"] # TODO: type: object e.g. {"set_sound":"beeroclock.wav"} :/ required: ["actions"] - example: |- - { + example: { "actions": ["notify"] } responses: 200: description: The actions for the push rule were set. examples: - application/json: |- - {} + application/json: { + } schema: type: object tags: diff --git a/api/client-server/receipts.yaml b/api/client-server/receipts.yaml index 9bd7f56c..8d2cc631 100644 --- a/api/client-server/receipts.yaml +++ b/api/client-server/receipts.yaml @@ -62,14 +62,14 @@ paths: server will automatically set the ``ts`` field. schema: type: object - example: |- - {} + example: { + } responses: 200: description: The receipt was sent. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 429: diff --git a/api/client-server/redaction.yaml b/api/client-server/redaction.yaml index df60f817..029dd05c 100644 --- a/api/client-server/redaction.yaml +++ b/api/client-server/redaction.yaml @@ -66,8 +66,7 @@ paths: name: body schema: type: object - example: |- - { + example: { "reason": "Indecent material" } properties: @@ -78,8 +77,7 @@ paths: 200: description: "An ID for the redaction event." examples: - application/json: |- - { + application/json: { "event_id": "YUwQidLecu" } schema: diff --git a/api/client-server/registration.yaml b/api/client-server/registration.yaml index d09cd431..9bd6aa75 100644 --- a/api/client-server/registration.yaml +++ b/api/client-server/registration.yaml @@ -110,8 +110,7 @@ paths: 200: description: The account has been registered. examples: - application/json: |- - { + application/json: { "user_id": "@cheeky_monkey:matrix.org", "access_token": "abc123", "home_server": "matrix.org", @@ -154,8 +153,7 @@ paths: them after authentication is completed if, for example, the requested user ID was registered whilst the client was performing authentication. examples: - application/json: |- - { + application/json: { "errcode": "M_USER_IN_USE", "error": "Desired user ID is already taken." } @@ -210,7 +208,7 @@ paths: Note that this may be an email containing the validation token or it may be informing the user of an error. examples: - application/json: "{}" + application/json: {} schema: type: object 400: @@ -225,8 +223,7 @@ paths: * ``M_SERVER_NOT_TRUSTED`` : The ``id_server`` parameter refers to an ID server that is not trusted by this Home Server. examples: - application/json: |- - { + application/json: { "errcode": "M_THREEPID_IN_USE", "error": "The specified address is already in use" } @@ -266,7 +263,7 @@ paths: 200: description: The password has been changed. examples: - application/json: "{}" + application/json: {} schema: type: object 401: @@ -331,7 +328,7 @@ paths: 200: description: The account has been deactivated. examples: - application/json: "{}" + application/json: {} schema: type: object 401: diff --git a/api/client-server/room_initial_sync.yaml b/api/client-server/room_initial_sync.yaml index bf403606..64eca5c0 100644 --- a/api/client-server/room_initial_sync.yaml +++ b/api/client-server/room_initial_sync.yaml @@ -37,8 +37,7 @@ paths: 200: description: The current state of the room examples: - application/json: |- - { + application/json: { "membership": "join", "messages": { "chunk": [ diff --git a/api/client-server/room_send.yaml b/api/client-server/room_send.yaml index 64dbf4e7..5326ab59 100644 --- a/api/client-server/room_send.yaml +++ b/api/client-server/room_send.yaml @@ -66,8 +66,7 @@ paths: name: body schema: type: object - example: |- - { + example: { "msgtype": "m.text", "body": "hello" } @@ -75,8 +74,7 @@ paths: 200: description: "An ID for the sent event." examples: - application/json: |- - { + application/json: { "event_id": "YUwRidLecu" } schema: diff --git a/api/client-server/room_state.yaml b/api/client-server/room_state.yaml index f6a452f2..ae50eec3 100644 --- a/api/client-server/room_state.yaml +++ b/api/client-server/room_state.yaml @@ -67,8 +67,7 @@ paths: name: body schema: type: object - example: |- - { + example: { "membership": "join", "avatar_url": "mxc://localhost/SEsfnsuifSDFSSEF#auto", "displayname": "Alice Margatroid" @@ -77,8 +76,7 @@ paths: 200: description: "An ID for the sent event." examples: - application/json: |- - { + application/json: { "event_id": "YUwRidLecu" } schema: @@ -125,16 +123,14 @@ paths: name: body schema: type: object - example: |- - { + example: { "name": "New name for the room" } responses: 200: description: "An ID for the sent event." examples: - application/json: |- - { + application/json: { "event_id": "YUwRidLecu" } schema: diff --git a/api/client-server/rooms.yaml b/api/client-server/rooms.yaml index 0bb268dd..2f17c17c 100644 --- a/api/client-server/rooms.yaml +++ b/api/client-server/rooms.yaml @@ -60,8 +60,8 @@ paths: 200: description: The content of the state event. examples: - application/json: |- - {"name": "Example room name"} + application/json: { + "name": "Example room name"} schema: type: object 404: @@ -101,8 +101,8 @@ paths: 200: description: The content of the state event. examples: - application/json: |- - {"name": "Example room name"} + application/json: { + "name": "Example room name"} schema: type: object 404: @@ -131,8 +131,7 @@ paths: 200: description: The current state of the room examples: - application/json: |- - [ + application/json: [ { "age": 7148266897, "content": { @@ -249,8 +248,7 @@ paths: this will be the current members of the room. If you have left the room then this will be the members of the room when you left. examples: - application/json: |- - { + application/json: { "chunk": [ { "age": 6547561012, diff --git a/api/client-server/search.yaml b/api/client-server/search.yaml index a1c7b9fe..78dace90 100644 --- a/api/client-server/search.yaml +++ b/api/client-server/search.yaml @@ -46,8 +46,7 @@ paths: name: body schema: type: object - example: |- - { + example: { "search_categories": { "room_events": { "keys": [ @@ -297,8 +296,7 @@ paths: the next call. If this field is absent, there are no more results. examples: - application/json: |- - { + application/json: { "search_categories": { "room_events": { "groups": { diff --git a/api/client-server/sync.yaml b/api/client-server/sync.yaml index be2a8217..2276317f 100644 --- a/api/client-server/sync.yaml +++ b/api/client-server/sync.yaml @@ -253,8 +253,7 @@ paths: Information on end-to-end device updates, as specified in |device_lists_sync|_. examples: - application/json: |- - { + application/json: { "next_batch": "s72595_4483_1934", "presence": { "events": [ diff --git a/api/client-server/tags.yaml b/api/client-server/tags.yaml index 7add8479..686d52a5 100644 --- a/api/client-server/tags.yaml +++ b/api/client-server/tags.yaml @@ -61,8 +61,7 @@ paths: title: Tags type: object examples: - application/json: |- - { + application/json: { "tags": { "work": {"order": "1"}, "pinned": {} @@ -107,8 +106,8 @@ paths: Extra data for the tag, e.g. ordering. schema: type: object - example: |- - {"order": "1"} + example: { + "order": "1"} responses: 200: description: @@ -116,8 +115,8 @@ paths: schema: type: object examples: - application/json: |- - {} + application/json: { + } tags: - User data delete: @@ -156,7 +155,7 @@ paths: schema: type: object examples: - application/json: |- - {} + application/json: { + } tags: - User data diff --git a/api/client-server/third_party_membership.yaml b/api/client-server/third_party_membership.yaml index a2e40372..51b5c7d4 100644 --- a/api/client-server/third_party_membership.yaml +++ b/api/client-server/third_party_membership.yaml @@ -89,8 +89,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "id_server": "matrix.org", "medium": "email", "address": "cheeky@monkey.com" @@ -111,8 +110,8 @@ paths: 200: description: The user has been invited to join the room. examples: - application/json: |- - {} + application/json: { + } schema: type: object 403: @@ -124,8 +123,8 @@ paths: - The inviter is not currently in the room. - The inviter's power level is insufficient to invite users to the room. examples: - application/json: |- - {"errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"} + application/json: { + "errcode": "M_FORBIDDEN", "error": "@cheeky_monkey:matrix.org is banned from the room"} 429: description: This request was rate-limited. schema: diff --git a/api/client-server/to_device.yaml b/api/client-server/to_device.yaml index 16af1182..6c1f1e57 100644 --- a/api/client-server/to_device.yaml +++ b/api/client-server/to_device.yaml @@ -83,7 +83,7 @@ paths: description: The message was successfully sent. examples: - application/json: |- - {} + application/json: { + } tags: - Send-to-Device messaging diff --git a/api/client-server/typing.yaml b/api/client-server/typing.yaml index fea94108..c4a8aea7 100644 --- a/api/client-server/typing.yaml +++ b/api/client-server/typing.yaml @@ -56,8 +56,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "typing": true, "timeout": 30000 } @@ -75,8 +74,8 @@ paths: 200: description: The new typing state was set. examples: - application/json: |- - {} + application/json: { + } schema: type: object # empty json object 429: diff --git a/api/client-server/versions.yaml b/api/client-server/versions.yaml index 1352279a..189e9b75 100644 --- a/api/client-server/versions.yaml +++ b/api/client-server/versions.yaml @@ -37,8 +37,7 @@ paths: 200: description: The versions supported by the server. examples: - application/json: |- - { + application/json: { "versions": ["r0.0.1"] } schema: diff --git a/api/client-server/voip.yaml b/api/client-server/voip.yaml index 30000540..f853c3a3 100644 --- a/api/client-server/voip.yaml +++ b/api/client-server/voip.yaml @@ -39,8 +39,7 @@ paths: 200: description: The TURN server credentials. examples: - application/json: |- - { + application/json: { "username":"1443779631:@user:example.com", "password":"JlKfBy1QwLrO20385QyAtEyIv0=", "uris":[ diff --git a/api/identity/lookup.yaml b/api/identity/lookup.yaml index 83c3b661..18e5e77d 100644 --- a/api/identity/lookup.yaml +++ b/api/identity/lookup.yaml @@ -45,8 +45,7 @@ paths: description: The association for that 3pid, or the empty object if no association is known. examples: - application/json: |- - { + application/json: { "address": "louise@bobs.burgers", "medium": "email", "mxid": "@ears:matrix.org", diff --git a/api/identity/pubkey.yaml b/api/identity/pubkey.yaml index 40d2a237..d78cd33f 100644 --- a/api/identity/pubkey.yaml +++ b/api/identity/pubkey.yaml @@ -43,8 +43,7 @@ paths: description: The public key exists. examples: - application/json: |- - { + application/json: { "public_key": "VXuGitF39UH5iRfvbIknlvlAVKgD1BsLDMvBf0pmp7c" } schema: @@ -70,8 +69,7 @@ paths: description: The validity of the public key. examples: - application/json: |- - { + application/json: { "valid": true } schema: @@ -98,8 +96,7 @@ paths: description: The validity of the public key. examples: - application/json: |- - { + application/json: { "valid": true } schema: diff --git a/api/push-gateway/push_notifier.yaml b/api/push-gateway/push_notifier.yaml index 0effef08..6e3720c3 100644 --- a/api/push-gateway/push_notifier.yaml +++ b/api/push-gateway/push_notifier.yaml @@ -54,8 +54,7 @@ paths: required: true schema: type: object - example: |- - { + example: { "notification": { "id": "$3957tyerfgewrf384", "room_id": "!slw48wfj34rtnrf:example.com", @@ -207,8 +206,7 @@ paths: 200: description: A list of rejected push keys. examples: - application/json: |- - { + application/json: { "rejected": [ "V2h5IG9uIGVhcnRoIGRpZCB5b3UgZGVjb2RlIHRoaXM/" ] } schema: