Format descriptions

Signed-off-by: Kai A. Hiller <git@kaialexhiller.de>
This commit is contained in:
Kai A. Hiller 2025-04-08 19:54:40 +02:00
parent aad66b5780
commit 00fe0a2a2c
11 changed files with 151 additions and 111 deletions

View file

@ -19,10 +19,13 @@ items:
properties: properties:
regex: regex:
type: string type: string
description: A POSIX regular expression defining which values this namespace includes. description: >-
A POSIX regular expression defining which values this namespace includes.
exclusive: exclusive:
type: boolean type: boolean
description: A true or false value stating whether this application service has exclusive access to events within this namespace. description: >-
A true or false value stating whether this application service has
exclusive access to events within this namespace.
required: required:
- regex - regex
- exclusive - exclusive

View file

@ -16,7 +16,7 @@ allOf:
- type: object - type: object
properties: properties:
instances: instances:
description: |- description: >-
A list of objects representing independent instances of configuration. A list of objects representing independent instances of configuration.
For example, multiple networks on IRC if multiple are provided by the For example, multiple networks on IRC if multiple are provided by the
same application service. same application service.

View file

@ -15,7 +15,7 @@ title: Protocol
type: object type: object
properties: properties:
user_fields: user_fields:
description: |- description: >-
Fields which may be used to identify a third-party user. These should be Fields which may be used to identify a third-party user. These should be
ordered to suggest the way that entities may be grouped, where higher ordered to suggest the way that entities may be grouped, where higher
groupings are ordered first. For example, the name of a network should be groupings are ordered first. For example, the name of a network should be
@ -26,9 +26,9 @@ properties:
description: Field used to identify a third-party user. description: Field used to identify a third-party user.
example: ["network", "nickname"] example: ["network", "nickname"]
location_fields: location_fields:
description: |- description: >-
Fields which may be used to identify a third-party location. These should be Fields which may be used to identify a third-party location. These should
ordered to suggest the way that entities may be grouped, where higher be ordered to suggest the way that entities may be grouped, where higher
groupings are ordered first. For example, the name of a network should be groupings are ordered first. For example, the name of a network should be
searched before the name of a channel. searched before the name of a channel.
type: array type: array
@ -41,10 +41,11 @@ properties:
type: string type: string
example: "mxc://example.org/aBcDeFgH" example: "mxc://example.org/aBcDeFgH"
field_types: field_types:
description: |- description: >-
The type definitions for the fields defined in `user_fields` and The type definitions for the fields defined in `user_fields` and
`location_fields`. Each entry in those arrays MUST have an entry here. `location_fields`. Each entry in those arrays MUST have an entry here. The
The `string` key for this object is the field name itself. `string` key for this object is the field name itself.
May be an empty object if no fields are defined. May be an empty object if no fields are defined.
type: object type: object
@ -54,10 +55,11 @@ properties:
type: object type: object
properties: properties:
regexp: regexp:
description: |- description: >-
A regular expression for validation of a field's value. This may be relatively A regular expression for validation of a field's value. This may be
coarse to verify the value as the application service providing this protocol relatively coarse to verify the value as the application service
may apply additional validation or filtering. providing this protocol may apply additional validation or
filtering.
type: string type: string
placeholder: placeholder:
description: A placeholder serving as a valid example of the field value. description: A placeholder serving as a valid example of the field value.

View file

@ -20,9 +20,9 @@ properties:
example: "Freenode" example: "Freenode"
icon: icon:
type: string type: string
description: |- description: >-
An optional content URI representing the protocol. Overrides the one provided An optional content URI representing the protocol. Overrides the one
at the higher level Protocol object. provided at the higher level Protocol object.
example: "mxc://example.org/JkLmNoPq" example: "mxc://example.org/JkLmNoPq"
fields: fields:
type: object type: object

View file

@ -17,27 +17,37 @@ title: Registration
properties: properties:
id: id:
type: string type: string
description: A unique, user-defined ID of the application service which will never change. description: >-
A unique, user-defined ID of the application service which will never change.
url: url:
type: string type: string
description: The URL for the application service. May include a path after the domain name. Optionally set to null if no traffic is required. description: >-
The URL for the application service. May include a path after the domain
name. Optionally set to null if no traffic is required.
as_token: as_token:
type: string type: string
description: A secret token that the application service will use to authenticate requests to the homeserver. description: >-
A secret token that the application service will use to authenticate
requests to the homeserver.
hs_token: hs_token:
type: string type: string
description: A secret token that the homeserver will use authenticate requests to the application service. description: >-
A secret token that the homeserver will use authenticate requests to the
application service.
sender_localpart: sender_localpart:
type: string type: string
description: |- description: >-
The localpart of the user associated with the application service. Events will be sent to the AS if this user is the target of the event, or The localpart of the user associated with the application service. Events
is a joined member of the room where the event occurred. will be sent to the AS if this user is the target of the event, or is a
joined member of the room where the event occurred.
receive_ephemeral: receive_ephemeral:
type: boolean type: boolean
x-addedInMatrixVersion: "1.13" x-addedInMatrixVersion: "1.13"
description: |- description: >-
Whether the application service wants to [receive ephemeral data](/application-service-api/#pushing-ephemeral-data). Whether the application service wants to [receive ephemeral
data](/application-service-api/#pushing-ephemeral-data).
Defaults to `false` if not present. Defaults to `false` if not present.
namespaces: namespaces:
type: object type: object
@ -47,7 +57,7 @@ properties:
users: users:
allOf: allOf:
- $ref: namespace_list.yaml - $ref: namespace_list.yaml
- description: |- - description: >-
A list of namespaces defining the user IDs that the application A list of namespaces defining the user IDs that the application
service is interested in, in addition to its `sender_localpart`. service is interested in, in addition to its `sender_localpart`.
Events will be sent to the AS if a local user matching one of the Events will be sent to the AS if a local user matching one of the
@ -56,23 +66,26 @@ properties:
rooms: rooms:
allOf: allOf:
- $ref: namespace_list.yaml - $ref: namespace_list.yaml
- description: |- - description: >-
A list of namespaces defining the room IDs that the application A list of namespaces defining the room IDs that the application
service is interested in. All events sent in a room with an ID service is interested in. All events sent in a room with an ID
which matches one of the namespaces will be sent to the AS. which matches one of the namespaces will be sent to the AS.
aliases: aliases:
allOf: allOf:
- $ref: namespace_list.yaml - $ref: namespace_list.yaml
- description: |- - description: >-
A list of namespaces defining the room aliases that the application A list of namespaces defining the room aliases that the
service is interested in. All events sent in a room with an alias application service is interested in. All events sent in a room
which matches one of the namespaces will be sent to the AS. with an alias which matches one of the namespaces will be sent to
the AS.
rate_limited: rate_limited:
type: boolean type: boolean
description: Whether requests from masqueraded users are rate-limited. The sender is excluded. description: >-
Whether requests from masqueraded users are rate-limited. The sender is excluded.
protocols: protocols:
type: array type: array
description: The external protocols which the application service provides (e.g. IRC). description: >-
The external protocols which the application service provides (e.g. IRC).
items: items:
type: string type: string
required: required:

View file

@ -15,4 +15,5 @@
homeserverAccessToken: homeserverAccessToken:
type: http type: http
scheme: bearer scheme: bearer
description: The `Bearer` `hs_token` provided by the application service's registration. description: >-
The `Bearer` `hs_token` provided by the application service's registration.

View file

@ -20,13 +20,18 @@ paths:
post: post:
x-addedInMatrixVersion: "1.7" x-addedInMatrixVersion: "1.7"
summary: Ping the application service summary: Ping the application service
description: |- description: >-
This API is called by the homeserver to ensure that the connection works This API is called by the homeserver to ensure that the connection works
and the `hs_token` the homeserver has is correct. and the `hs_token` the homeserver has is correct.
Currently this is only called by the homeserver as a direct result of Currently this is only called by the homeserver as a direct result of
the application service calling the application service calling
[`POST /_matrix/client/v1/appservice/{appserviceId}/ping`](#post_matrixclientv1appserviceappserviceidping). [`POST /_matrix/client/v1/appservice/{appserviceId}/ping`].
[`POST /_matrix/client/v1/appservice/{appserviceId}/ping`]:
<#post_matrixclientv1appserviceappserviceidping>
operationId: ping operationId: ping
security: security:
- homeserverAccessToken: [] - homeserverAccessToken: []
@ -41,13 +46,14 @@ paths:
properties: properties:
transaction_id: transaction_id:
type: string type: string
description: |- description: >-
A transaction ID for the ping, copied directly from the A transaction ID for the ping, copied directly from the
`POST /_matrix/client/v1/appservice/{appserviceId}/ping` call. `POST /_matrix/client/v1/appservice/{appserviceId}/ping` call.
description: Ping body with optional transaction ID. description: Ping body with optional transaction ID.
responses: responses:
"200": "200":
description: The provided `hs_token` is valid and the ping request was successful. description: >-
The provided `hs_token` is valid and the ping request was successful.
content: content:
application/json: application/json:
schema: schema:

View file

@ -20,10 +20,10 @@ paths:
get: get:
summary: Retrieve metadata about a specific protocol that the application summary: Retrieve metadata about a specific protocol that the application
service supports. service supports.
description: |- description: >-
This API is called by the homeserver when it wants to present clients This API is called by the homeserver when it wants to present clients
with specific information about the various third-party networks that with specific information about the various third-party networks that an
an application service supports. application service supports.
operationId: getProtocolMetadata operationId: getProtocolMetadata
security: security:
- homeserverAccessToken: [] - homeserverAccessToken: []
@ -43,9 +43,10 @@ paths:
schema: schema:
$ref: definitions/protocol.yaml $ref: definitions/protocol.yaml
"401": "401":
description: |- description: >-
The homeserver has not supplied credentials to the application service. The homeserver has not supplied credentials to the application
Optional error information can be included in the body of this response. service. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:
@ -80,10 +81,10 @@ paths:
"/thirdparty/user/{protocol}": "/thirdparty/user/{protocol}":
get: get:
summary: Retrieve the Matrix User ID of a corresponding third-party user. summary: Retrieve the Matrix User ID of a corresponding third-party user.
description: |- description: >-
This API is called by the homeserver in order to retrieve a Matrix This API is called by the homeserver in order to retrieve a Matrix User
User ID linked to a user on the third-party network, given a set of ID linked to a user on the third-party network, given a set of user
user parameters. parameters.
operationId: queryUserByProtocol operationId: queryUserByProtocol
security: security:
- homeserverAccessToken: [] - homeserverAccessToken: []
@ -97,9 +98,9 @@ paths:
type: string type: string
- in: query - in: query
name: fields name: fields
description: |- description: >-
One or more custom fields that are passed to the application One or more custom fields that are passed to the application service
service to help identify the user. to help identify the user.
schema: schema:
type: object type: object
additionalProperties: additionalProperties:
@ -112,9 +113,10 @@ paths:
schema: schema:
$ref: definitions/user_batch.yaml $ref: definitions/user_batch.yaml
"401": "401":
description: |- description: >-
The homeserver has not supplied credentials to the application service. The homeserver has not supplied credentials to the application
Optional error information can be included in the body of this response. service. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:
@ -149,7 +151,8 @@ paths:
"/thirdparty/location/{protocol}": "/thirdparty/location/{protocol}":
get: get:
summary: Retrieve Matrix-side portal rooms leading to a third-party location. summary: Retrieve Matrix-side portal rooms leading to a third-party location.
description: Retrieve a list of Matrix portal rooms that lead to the matched description: >-
Retrieve a list of Matrix portal rooms that lead to the matched
third-party location. third-party location.
operationId: queryLocationByProtocol operationId: queryLocationByProtocol
security: security:
@ -164,9 +167,9 @@ paths:
type: string type: string
- in: query - in: query
name: fields name: fields
description: |- description: >-
One or more custom fields that are passed to the application One or more custom fields that are passed to the application service
service to help identify the third-party location. to help identify the third-party location.
schema: schema:
type: object type: object
additionalProperties: additionalProperties:
@ -179,9 +182,10 @@ paths:
schema: schema:
$ref: definitions/location_batch.yaml $ref: definitions/location_batch.yaml
"401": "401":
description: |- description: >-
The homeserver has not supplied credentials to the application service. The homeserver has not supplied credentials to the application
Optional error information can be included in the body of this response. service. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:
@ -216,9 +220,8 @@ paths:
/thirdparty/location: /thirdparty/location:
get: get:
summary: Reverse-lookup third-party locations given a Matrix room alias. summary: Reverse-lookup third-party locations given a Matrix room alias.
description: |- description: >-
Retrieve an array of third-party network locations from a Matrix room Retrieve an array of third-party network locations from a Matrix room alias.
alias.
operationId: queryLocationByAlias operationId: queryLocationByAlias
security: security:
- homeserverAccessToken: [] - homeserverAccessToken: []
@ -236,9 +239,10 @@ paths:
schema: schema:
$ref: definitions/location_batch.yaml $ref: definitions/location_batch.yaml
"401": "401":
description: |- description: >-
The homeserver has not supplied credentials to the application service. The homeserver has not supplied credentials to the application
Optional error information can be included in the body of this response. service. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:
@ -291,9 +295,10 @@ paths:
schema: schema:
$ref: definitions/user_batch.yaml $ref: definitions/user_batch.yaml
"401": "401":
description: |- description: >-
The homeserver has not supplied credentials to the application service. The homeserver has not supplied credentials to the application
Optional error information can be included in the body of this response. service. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:

View file

@ -20,12 +20,12 @@ paths:
"/rooms/{roomAlias}": "/rooms/{roomAlias}":
get: get:
summary: Query if a room alias should exist on the application service. summary: Query if a room alias should exist on the application service.
description: |- description: >-
This endpoint is invoked by the homeserver on an application service to query This endpoint is invoked by the homeserver on an application service to
the existence of a given room alias. The homeserver will only query room query the existence of a given room alias. The homeserver will only
aliases inside the application service's `aliases` namespace. The query room aliases inside the application service's `aliases` namespace.
homeserver will send this request when it receives a request to join a The homeserver will send this request when it receives a request to join
room alias within the application service's namespace. a room alias within the application service's namespace.
operationId: queryRoomByAlias operationId: queryRoomByAlias
security: security:
- homeserverAccessToken: [] - homeserverAccessToken: []
@ -39,7 +39,7 @@ paths:
type: string type: string
responses: responses:
"200": "200":
description: |- description: >-
The application service indicates that this room alias exists. The The application service indicates that this room alias exists. The
application service MUST have created a room and associated it with application service MUST have created a room and associated it with
the queried room alias using the client-server API. Additional the queried room alias using the client-server API. Additional
@ -53,9 +53,10 @@ paths:
response: response:
value: {} value: {}
"401": "401":
description: |- description: >-
The homeserver has not supplied credentials to the application service. The homeserver has not supplied credentials to the application
Optional error information can be included in the body of this response. service. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:
@ -77,9 +78,10 @@ paths:
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN" "errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
} }
"404": "404":
description: |- description: >-
The application service indicates that this room alias does not exist. The application service indicates that this room alias does not
Optional error information can be included in the body of this response. exist. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:

View file

@ -20,12 +20,13 @@ paths:
"/users/{userId}": "/users/{userId}":
get: get:
summary: Query if a user should exist on the application service. summary: Query if a user should exist on the application service.
description: |- description: >-
This endpoint is invoked by the homeserver on an application service to query This endpoint is invoked by the homeserver on an application service to
the existence of a given user ID. The homeserver will only query user IDs query the existence of a given user ID. The homeserver will only query
inside the application service's `users` namespace. The homeserver will user IDs inside the application service's `users` namespace. The
send this request when it receives an event for an unknown user ID in homeserver will send this request when it receives an event for an
the application service's namespace, such as a room invite. unknown user ID in the application service's namespace, such as a room
invite.
operationId: queryUserById operationId: queryUserById
security: security:
- homeserverAccessToken: [] - homeserverAccessToken: []
@ -39,9 +40,9 @@ paths:
type: string type: string
responses: responses:
"200": "200":
description: |- description: >-
The application service indicates that this user exists. The application The application service indicates that this user exists. The
service MUST create the user using the client-server API. application service MUST create the user using the client-server API.
content: content:
application/json: application/json:
schema: schema:
@ -50,9 +51,10 @@ paths:
response: response:
value: {} value: {}
"401": "401":
description: |- description: >-
The homeserver has not supplied credentials to the application service. The homeserver has not supplied credentials to the application
Optional error information can be included in the body of this response. service. Optional error information can be included in the body of
this response.
content: content:
application/json: application/json:
schema: schema:
@ -74,9 +76,10 @@ paths:
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN" "errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
} }
"404": "404":
description: |- description: >-
The application service indicates that this user does not exist. The application service indicates that this user does not exist.
Optional error information can be included in the body of this response. Optional error information can be included in the body of this
response.
content: content:
application/json: application/json:
schema: schema:

View file

@ -20,20 +20,21 @@ paths:
"/transactions/{txnId}": "/transactions/{txnId}":
put: put:
summary: Send some events to the application service. summary: Send some events to the application service.
description: |- description: >-
This API is called by the homeserver when it wants to push an event This API is called by the homeserver when it wants to push an event (or
(or batch of events) to the application service. batch of events) to the application service.
Note that the application service should distinguish state events
from message events via the presence of a `state_key`, rather than Note that the application service should distinguish state events from
via the event type. message events via the presence of a `state_key`, rather than via the
event type.
operationId: sendTransaction operationId: sendTransaction
security: security:
- homeserverAccessToken: [] - homeserverAccessToken: []
parameters: parameters:
- in: path - in: path
name: txnId name: txnId
description: |- description: >-
The transaction ID for this set of events. Homeservers generate The transaction ID for this set of events. Homeservers generate
these IDs and they are used to ensure idempotency of requests. these IDs and they are used to ensure idempotency of requests.
required: true required: true
@ -73,15 +74,19 @@ paths:
ephemeral: ephemeral:
type: array type: array
x-addedInMatrixVersion: "1.13" x-addedInMatrixVersion: "1.13"
description: |- description: >-
A list of ephemeral data, if the `receive_ephemeral` setting was enabled in the A list of ephemeral data, if the `receive_ephemeral` setting
was enabled in the
[registration](/application-service-api/#registration) file. [registration](/application-service-api/#registration) file.
There are only three event types that can currently occur in this list: `m.presence`,
`m.typing`, and `m.receipt`. Room-scoped ephemeral data (`m.typing` and There are only three event types that can currently occur in
`m.receipt`) MUST include a `room_id` property to identify the room that they this list: `m.presence`, `m.typing`, and `m.receipt`.
Room-scoped ephemeral data (`m.typing` and `m.receipt`) MUST
include a `room_id` property to identify the room that they
were sent in. were sent in.
This property can be omitted if it would be empty. This property can be omitted if it would be empty.
items: items:
$ref: ../../event-schemas/schema/core-event-schema/event.yaml $ref: ../../event-schemas/schema/core-event-schema/event.yaml