Merge pull request #2518 from matrix-org/kitsune/cleanup

Assorted cleanup pieces
pull/977/head
Kitsune Ral 4 years ago committed by GitHub
commit 5a699f2650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -46,7 +46,7 @@ To use the scripts, it is best to create a Python 3.4+ virtualenv as follows::
virtualenv -p python3 env virtualenv -p python3 env
env/bin/pip install -r scripts/requirements.txt env/bin/pip install -r scripts/requirements.txt
(Benjamin Synders has contributed a script for `Nix`_ users, which can be (Benjamin Saunders has contributed a script for `Nix`_ users, which can be
invoked with ``nix-shell scripts/contrib/shell.nix``.) invoked with ``nix-shell scripts/contrib/shell.nix``.)
.. TODO: Possibly we need some libs installed; should record what they are. .. TODO: Possibly we need some libs installed; should record what they are.

@ -50,7 +50,7 @@ paths:
x-example: "35" x-example: "35"
- in: body - in: body
name: body name: body
description: A list of events. description: Transaction information
schema: schema:
type: object type: object
example: { example: {
@ -59,7 +59,6 @@ paths:
{"$ref": "../../event-schemas/examples/m.room.message$m.text"} {"$ref": "../../event-schemas/examples/m.room.message$m.text"}
] ]
} }
description: Transaction information
properties: properties:
events: events:
type: array type: array

@ -108,6 +108,7 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
@ -195,14 +196,16 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
auth: auth:
description: |- description: |-
Additional authentication information for the Additional authentication information for the
user-interactive authentication API. user-interactive authentication API.
$ref: "definitions/auth_data.yaml" allOf:
- $ref: "definitions/auth_data.yaml"
client_secret: client_secret:
type: string type: string
description: The client secret used in the session with the homeserver. description: The client secret used in the session with the homeserver.
@ -247,6 +250,7 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
@ -299,6 +303,7 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
@ -363,6 +368,7 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
@ -427,7 +433,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
$ref: "./definitions/request_email_validation.yaml" $ref: "definitions/request_email_validation.yaml"
responses: responses:
200: 200:
description: |- description: |-
@ -477,7 +483,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
$ref: "./definitions/request_msisdn_validation.yaml" $ref: "definitions/request_msisdn_validation.yaml"
responses: responses:
200: 200:
description: An SMS message was sent to the given phone number. description: An SMS message was sent to the given phone number.

@ -163,9 +163,11 @@ paths:
- Media - Media
"/download/{serverName}/{mediaId}/{fileName}": "/download/{serverName}/{mediaId}/{fileName}":
get: get:
summary: |- summary: Download content from the content repository overriding the file name
Download content from the content repository. This is the same as description: |-
the download endpoint above, except permitting a desired file name. This will download content from the content repository (same as
the previous endpoint) but replace the target file name with the one
provided by the caller.
operationId: getContentOverrideName operationId: getContentOverrideName
produces: ["*/*"] produces: ["*/*"]
parameters: parameters:
@ -233,9 +235,10 @@ paths:
- Media - Media
"/thumbnail/{serverName}/{mediaId}": "/thumbnail/{serverName}/{mediaId}":
get: get:
summary: |- summary: Download a thumbnail of content from the content repository
Download a thumbnail of content from the content repository. See the `thumbnailing <#thumbnails>`_ description: |-
section for more information. Download a thumbnail of content from the content repository.
See the `thumbnailing <#thumbnails>`_ section for more information.
operationId: getContentThumbnail operationId: getContentThumbnail
produces: ["image/jpeg", "image/png"] produces: ["image/jpeg", "image/png"]
parameters: parameters:
@ -283,10 +286,10 @@ paths:
x-example: false x-example: false
required: false required: false
default: true default: true
description: | description: |-
Indicates to the server that it should not attempt to fetch the media if it is deemed Indicates to the server that it should not attempt to fetch
remote. This is to prevent routing loops where the server contacts itself. Defaults to the media if it is deemed remote. This is to prevent routing loops
true if not provided. where the server contacts itself. Defaults to true if not provided.
responses: responses:
200: 200:
description: "A thumbnail of the requested content." description: "A thumbnail of the requested content."

@ -80,6 +80,7 @@ paths:
- in: body - in: body
name: body name: body
description: The desired room configuration. description: The desired room configuration.
required: true
schema: schema:
type: object type: object
example: { example: {

@ -83,7 +83,7 @@ paths:
schema: schema:
type: object type: object
allOf: allOf:
- $ref: "definitions/client_device.yaml" - $ref: "definitions/client_device.yaml"
examples: examples:
application/json: { application/json: {
"device_id": "QBUAZIFURK", "device_id": "QBUAZIFURK",
@ -119,9 +119,9 @@ paths:
display_name: display_name:
type: string type: string
description: |- description: |-
The new display name for this device. If not given, the The new display name for this device. If not given, the
display name is unchanged. display name is unchanged.
example: My other phone example: { "display_name": "My other phone" }
responses: responses:
200: 200:
description: The device was successfully updated. description: The device was successfully updated.
@ -152,14 +152,16 @@ paths:
x-example: "QBUAZIFURK" x-example: "QBUAZIFURK"
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
auth: auth:
description: |- description: |-
Additional authentication information for the Additional authentication information for the
user-interactive authentication API. user-interactive authentication API.
"$ref": "definitions/auth_data.yaml" allOf:
- "$ref": "definitions/auth_data.yaml"
responses: responses:
200: 200:
description: |- description: |-
@ -190,6 +192,7 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
@ -201,10 +204,11 @@ paths:
description: A list of device IDs. description: A list of device IDs.
example: ["QBUAZIFURK", "AUIECTSRND"] example: ["QBUAZIFURK", "AUIECTSRND"]
auth: auth:
allOf:
- "$ref": "definitions/auth_data.yaml"
description: |- description: |-
Additional authentication information for the Additional authentication information for the
user-interactive authentication API. user-interactive authentication API.
"$ref": "definitions/auth_data.yaml"
required: required:
- devices - devices
responses: responses:

@ -119,7 +119,7 @@ paths:
responses: responses:
200: 200:
description: |- description: |-
"The filter defintion" The filter definition.
examples: examples:
application/json: { application/json: {
"room": { "room": {

@ -31,7 +31,8 @@ paths:
post: post:
summary: Start the requesting user participating in a particular room. summary: Start the requesting user participating in a particular room.
description: |- description: |-
*Note that this API requires a room ID, not alias.* ``/join/{roomIdOrAlias}`` *exists if you have a room alias.* *Note that this API requires a room ID, not alias.*
``/join/{roomIdOrAlias}`` *exists if you have a room alias.*
This API starts a user participating in a particular room, if that user This API starts a user participating in a particular room, if that user
is allowed to participate in that room. After this call, the client is is allowed to participate in that room. After this call, the client is
@ -40,10 +41,6 @@ paths:
After a user has joined a room, the room will appear as an entry in the After a user has joined a room, the room will appear as an entry in the
response of the |/initialSync|_ and |/sync|_ APIs. response of the |/initialSync|_ and |/sync|_ APIs.
If a ``third_party_signed`` was supplied, the homeserver must verify
that it matches a pending ``m.room.third_party_invite`` event in the
room, and perform key validity checking if required by the event.
operationId: joinRoomById operationId: joinRoomById
security: security:
- accessToken: [] - accessToken: []
@ -56,11 +53,17 @@ paths:
x-example: "!d41d8cd:matrix.org" x-example: "!d41d8cd:matrix.org"
- in: body - in: body
name: third_party_signed name: third_party_signed
required: true
schema: schema:
type: object type: object
properties: properties:
third_party_signed: third_party_signed:
$ref: "definitions/third_party_signed.yaml" allOf:
- $ref: "definitions/third_party_signed.yaml"
description: |-
If supplied, the homeserver must verify that it matches a pending
``m.room.third_party_invite`` event in the room, and perform
key validity checking if required by the event.
responses: responses:
200: 200:
description: |- description: |-
@ -79,7 +82,8 @@ paths:
required: ["room_id"] required: ["room_id"]
403: 403:
description: |- description: |-
You do not have permission to join the room. A meaningful ``errcode`` and description error text will be returned. Example reasons for rejection are: You do not have permission to join the room. A meaningful ``errcode``
and description error text will be returned. Example reasons for rejection are:
- The room is invite-only and the user was not invited. - The room is invite-only and the user was not invited.
- The user has been banned from the room. - The user has been banned from the room.
@ -107,10 +111,6 @@ paths:
After a user has joined a room, the room will appear as an entry in the After a user has joined a room, the room will appear as an entry in the
response of the |/initialSync|_ and |/sync|_ APIs. response of the |/initialSync|_ and |/sync|_ APIs.
If a ``third_party_signed`` was supplied, the homeserver must verify
that it matches a pending ``m.room.third_party_invite`` event in the
room, and perform key validity checking if required by the event.
operationId: joinRoom operationId: joinRoom
security: security:
- accessToken: [] - accessToken: []
@ -132,11 +132,17 @@ paths:
x-example: ["matrix.org", "elsewhere.ca"] x-example: ["matrix.org", "elsewhere.ca"]
- in: body - in: body
name: third_party_signed name: third_party_signed
required: true
schema: schema:
type: object type: object
properties: properties:
third_party_signed: third_party_signed:
$ref: "definitions/third_party_signed.yaml" allOf:
- $ref: "definitions/third_party_signed.yaml"
description: |-
If a ``third_party_signed`` was supplied, the homeserver must verify
that it matches a pending ``m.room.third_party_invite`` event in the
room, and perform key validity checking if required by the event.
responses: responses:
200: 200:
description: |- description: |-
@ -155,7 +161,8 @@ paths:
required: ["room_id"] required: ["room_id"]
403: 403:
description: |- description: |-
You do not have permission to join the room. A meaningful ``errcode`` and description error text will be returned. Example reasons for rejection are: You do not have permission to join the room. A meaningful ``errcode``
and description error text will be returned. Example reasons for rejection are:
- The room is invite-only and the user was not invited. - The room is invite-only and the user was not invited.
- The user has been banned from the room. - The user has been banned from the room.

@ -39,6 +39,7 @@ paths:
- in: body - in: body
name: version name: version
description: "The backup configuration." description: "The backup configuration."
required: true
schema: schema:
type: object type: object
properties: properties:
@ -257,6 +258,7 @@ paths:
- in: body - in: body
name: version name: version
description: "The backup configuration" description: "The backup configuration"
required: true
schema: schema:
type: object type: object
properties: properties:
@ -398,6 +400,7 @@ paths:
- in: body - in: body
name: data name: data
description: "The key data." description: "The key data."
required: true
schema: schema:
"$ref": "definitions/key_backup_data.yaml" "$ref": "definitions/key_backup_data.yaml"
responses: responses:
@ -568,6 +571,7 @@ paths:
- in: body - in: body
description: "The backup data" description: "The backup data"
name: backupData name: backupData
required: true
schema: schema:
$ref: "definitions/room_key_backup.yaml" $ref: "definitions/room_key_backup.yaml"
responses: responses:
@ -734,6 +738,7 @@ paths:
- in: body - in: body
description: "The backup data." description: "The backup data."
name: backupData name: backupData
required: true
schema: schema:
type: object type: object
properties: properties:

@ -41,6 +41,7 @@ paths:
name: keys name: keys
description: |- description: |-
The keys to be published The keys to be published
required: true
schema: schema:
type: object type: object
properties: properties:
@ -133,6 +134,7 @@ paths:
name: query name: query
description: |- description: |-
Query defining the keys to be downloaded Query defining the keys to be downloaded
required: true
schema: schema:
type: object type: object
properties: properties:
@ -196,6 +198,7 @@ paths:
additionalProperties: additionalProperties:
type: object type: object
additionalProperties: additionalProperties:
title: DeviceInformation
allOf: allOf:
- $ref: definitions/device_keys.yaml - $ref: definitions/device_keys.yaml
properties: properties:
@ -249,6 +252,7 @@ paths:
name: query name: query
description: |- description: |-
Query defining the keys to be claimed Query defining the keys to be claimed
required: true
schema: schema:
type: object type: object
properties: properties:

@ -77,7 +77,8 @@ paths:
type: object type: object
403: 403:
description: |- description: |-
You do not have permission to kick the user from the room. A meaningful ``errcode`` and description error text will be returned. Example reasons for rejections are: You do not have permission to kick the user from the room. A meaningful ``errcode`` and
description error text will be returned. Example reasons for rejections are:
- The kicker is not currently in the room. - The kicker is not currently in the room.
- The kickee is not currently in the room. - The kickee is not currently in the room.

@ -82,6 +82,7 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
example: { example: {
@ -99,7 +100,6 @@ paths:
enum: ["m.login.password", "m.login.token"] enum: ["m.login.password", "m.login.token"]
description: The login type being used. description: The login type being used.
identifier: identifier:
description: Identification information for the user.
"$ref": "definitions/user_identifier.yaml" "$ref": "definitions/user_identifier.yaml"
user: user:
type: string type: string
@ -175,13 +175,13 @@ paths:
ID of the logged-in device. Will be the same as the ID of the logged-in device. Will be the same as the
corresponding parameter in the request, if one was specified. corresponding parameter in the request, if one was specified.
well_known: well_known:
type: object
description: |- description: |-
Optional client configuration provided by the server. If present, Optional client configuration provided by the server. If present,
clients SHOULD use the provided object to reconfigure themselves, clients SHOULD use the provided object to reconfigure themselves,
optionally validating the URLs within. This object takes the same optionally validating the URLs within. This object takes the same
form as the one returned from .well-known autodiscovery. form as the one returned from .well-known autodiscovery.
"$ref": "definitions/wellknown/full.yaml" allOf:
- "$ref": "definitions/wellknown/full.yaml"
400: 400:
description: |- description: |-
Part of the request was invalid. For example, the login type may not be recognised. Part of the request was invalid. For example, the login type may not be recognised.

@ -111,8 +111,6 @@ paths:
for ``dir=f`` in chronological order, so that events start for ``dir=f`` in chronological order, so that events start
at the ``from`` point. at the ``from`` point.
items: items:
type: object
title: RoomEvent
"$ref": "definitions/event-schemas/schema/core-event-schema/room_event.yaml" "$ref": "definitions/event-schemas/schema/core-event-schema/room_event.yaml"
state: state:
type: array type: array
@ -126,8 +124,6 @@ paths:
sent to the client in prior calls to this endpoint, assuming sent to the client in prior calls to this endpoint, assuming
the membership of those members has not changed. the membership of those members has not changed.
items: items:
type: object
title: RoomStateEvent
$ref: "definitions/event-schemas/schema/core-event-schema/state_event.yaml" $ref: "definitions/event-schemas/schema/core-event-schema/state_event.yaml"
examples: examples:
application/json: { application/json: {

@ -49,7 +49,7 @@ paths:
name: limit name: limit
description: Limit on the number of events to return in this request. description: Limit on the number of events to return in this request.
required: false required: false
x-example: "20" x-example: 20
- in: query - in: query
name: only name: only
type: string type: string

@ -62,7 +62,7 @@ paths:
description: The new presence state. description: The new presence state.
status_msg: status_msg:
type: string type: string
description: "The status message to attach to this state." description: The status message to attach to this state.
required: ["presence"] required: ["presence"]
responses: responses:
200: 200:

@ -45,7 +45,7 @@ paths:
x-example: "@alice:example.com" x-example: "@alice:example.com"
- in: body - in: body
name: displayName name: displayName
description: The display name info. description: The new display name information.
required: true required: true
schema: schema:
type: object type: object
@ -119,7 +119,7 @@ paths:
x-example: "@alice:example.com" x-example: "@alice:example.com"
- in: body - in: body
name: avatar_url name: avatar_url
description: The avatar url info. description: The new avatar information.
required: true required: true
schema: schema:
type: object type: object

@ -65,6 +65,7 @@ paths:
x-example: "37" x-example: "37"
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
example: { example: {

@ -84,17 +84,19 @@ paths:
description: The kind of account to register. Defaults to ``user``. description: The kind of account to register. Defaults to ``user``.
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
auth: auth:
description: |- description: |-
Additional authentication information for the Additional authentication information for the
user-interactive authentication API. Note that this user-interactive authentication API. Note that this
information is *not* used to define how the registered user information is *not* used to define how the registered user
should be authenticated, but is instead used to should be authenticated, but is instead used to
authenticate the ``register`` call itself. authenticate the ``register`` call itself.
"$ref": "definitions/auth_data.yaml" allOf:
- "$ref": "definitions/auth_data.yaml"
username: username:
type: string type: string
description: |- description: |-
@ -227,7 +229,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
$ref: "./definitions/request_email_validation.yaml" $ref: "definitions/request_email_validation.yaml"
responses: responses:
200: 200:
description: |- description: |-
@ -277,7 +279,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
$ref: "./definitions/request_msisdn_validation.yaml" $ref: "definitions/request_msisdn_validation.yaml"
responses: responses:
200: 200:
description: |- description: |-
@ -336,6 +338,7 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
@ -354,8 +357,9 @@ paths:
example: true example: true
auth: auth:
description: |- description: |-
Additional authentication information for the user-interactive authentication API. Additional authentication information for the user-interactive authentication API.
"$ref": "definitions/auth_data.yaml" allOf:
- "$ref": "definitions/auth_data.yaml"
required: ["new_password"] required: ["new_password"]
responses: responses:
200: 200:
@ -404,7 +408,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
$ref: "./definitions/request_email_validation.yaml" $ref: "definitions/request_email_validation.yaml"
responses: responses:
200: 200:
description: An email was sent to the given address. description: An email was sent to the given address.
@ -462,7 +466,7 @@ paths:
name: body name: body
required: true required: true
schema: schema:
$ref: "../identity/definitions/request_msisdn_validation.yaml" $ref: "definitions/request_msisdn_validation.yaml"
responses: responses:
200: 200:
description: An SMS message was sent to the given phone number. description: An SMS message was sent to the given phone number.
@ -516,13 +520,15 @@ paths:
parameters: parameters:
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
properties: properties:
auth: auth:
description: |- description: |-
Additional authentication information for the user-interactive authentication API. Additional authentication information for the user-interactive authentication API.
"$ref": "definitions/auth_data.yaml" allOf:
- $ref: "definitions/auth_data.yaml"
id_server: id_server:
type: string type: string
description: |- description: |-

@ -45,7 +45,6 @@ paths:
- in: body - in: body
name: body name: body
required: true required: true
description: The request body
schema: schema:
type: object type: object
properties: properties:

@ -45,6 +45,7 @@ paths:
x-example: "YWxsCgpOb25lLDM1ODcwOA" x-example: "YWxsCgpOb25lLDM1ODcwOA"
- in: body - in: body
name: body name: body
required: true
schema: schema:
type: object type: object
example: { example: {
@ -95,7 +96,8 @@ paths:
# for now :/ # for now :/
description: |- description: |-
This takes a `filter`_. This takes a `filter`_.
$ref: "definitions/room_event_filter.yaml" allOf:
- $ref: "definitions/room_event_filter.yaml"
order_by: order_by:
title: "Ordering" title: "Ordering"
type: string type: string

@ -39,7 +39,6 @@ paths:
200: 200:
description: Server discovery information. description: Server discovery information.
schema: schema:
type: object
"$ref": "definitions/wellknown/full.yaml" "$ref": "definitions/wellknown/full.yaml"
404: 404:
description: No server discovery information available. description: No server discovery information available.

@ -6,6 +6,19 @@ across the specification. The defined extensions are listed below. Extensions
should not break parsers, however if extra functionality is required, aware should not break parsers, however if extra functionality is required, aware
parsers should be able to take advantage of the added syntax. parsers should be able to take advantage of the added syntax.
## Using multiple files to describe API
To ease API design and management, the API definition is split across several
files. Each of these files is self-contained valid OpenAPI (except
client-server files that become valid OpenAPI after substituting
`%CLIENT_MAJOR_VERSION%` with `unstable` or an API release).
There is no single root file in the source tree as OpenAPI requires; this file
can be generated by `dump_swagger.py` (also doing the substitution mentioned
above). The script does not convert the extensions described further in this
document (`oneOf` and parameter exploding) so there can be minor
interoperability issues with tooling that expects compliant Swagger.
## Extensible Query Parameters ## Extensible Query Parameters
<!-- TODO: Remove and change instances to 'explode' after OpenAPI/Swagger v3 update --> <!-- TODO: Remove and change instances to 'explode' after OpenAPI/Swagger v3 update -->

@ -86,7 +86,7 @@ paths:
name: body name: body
required: true required: true
description: |- description: |-
Options for which rooms to return. Options for which rooms to return, or empty object to use defaults.
schema: schema:
type: object type: object
properties: properties:

@ -43,7 +43,7 @@ parser = argparse.ArgumentParser(
parser.add_argument( parser.add_argument(
"--client_release", "-c", metavar="LABEL", "--client_release", "-c", metavar="LABEL",
default="unstable", default="unstable",
help="""The client-server release version to gneerate for. Default: help="""The client-server release version to generate for. Default:
%(default)s""", %(default)s""",
) )
parser.add_argument( parser.add_argument(

Loading…
Cancel
Save