Upgrade Swagger data to OpenAPI 3.1 (#1310)

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2023-06-07 14:16:29 +02:00 committed by GitHub
parent c64a616d54
commit 45b6aaf07a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
118 changed files with 15064 additions and 12727 deletions

View file

@ -11,84 +11,80 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
swagger: '2.0'
openapi: 3.1.0
info:
title: "Matrix Federation Events API"
version: "1.0.0"
host: localhost:8448
schemes:
- https
basePath: /_matrix/federation/v1
produces:
- application/json
securityDefinitions:
$ref: definitions/security.yaml
title: Matrix Federation Events API
version: 1.0.0
paths:
"/state/{roomId}":
get:
summary: Get all the state of a given room
description: |-
Retrieves a snapshot of a room's state at a given event.
description: Retrieves a snapshot of a room's state at a given event.
operationId: getRoomState
security:
- signedRequest: []
parameters:
- in: path
name: roomId
type: string
description: The room ID to get state for.
required: true
x-example: "!abc123:matrix.org"
example: "!abc123:matrix.org"
schema:
type: string
- in: query
name: event_id
type: string
description: An event ID in the room to retrieve the state at.
required: true
x-example: "$helloworld:matrix.org"
example: $helloworld:matrix.org
schema:
type: string
responses:
200:
"200":
description: |-
The fully resolved state for the room, prior to considering any state
changes induced by the requested event. Includes the authorization
chain for the events.
schema:
type: object
properties:
auth_chain:
type: array
description: |-
The full set of authorization events that make up the state
of the room, and their authorization events, recursively. Note that
events have a different format depending on the room version -
check the [room version specification](/rooms) for precise event formats.
items:
type: object
title: PDU
description: |-
The [PDUs](/server-server-api/#pdus) contained in the auth chain. The event format
varies depending on the room version - check the [room version specification](/rooms)
for precise event formats.
properties: {}
example:
$ref: "examples/minimal_pdu.json"
pdus:
type: array
description: |-
The fully resolved state of the room at the given event. Note that
events have a different format depending on the room version -
check the [room version specification](/rooms) for precise event formats.
items:
type: object
title: PDU
description: |-
The [PDUs](/server-server-api/#pdus) for the fully resolved state of the room. The event format
varies depending on the room version - check the [room version specification](/rooms)
for precise event formats.
properties: {}
example:
$ref: "examples/minimal_pdu.json"
required: ['auth_chain', 'pdus']
content:
application/json:
schema:
type: object
properties:
auth_chain:
type: array
description: |-
The full set of authorization events that make up the state
of the room, and their authorization events, recursively. Note that
events have a different format depending on the room version -
check the [room version specification](/rooms) for precise event formats.
items:
type: object
title: PDU
description: |-
The [PDUs](/server-server-api/#pdus) contained in the auth chain. The event format
varies depending on the room version - check the [room version specification](/rooms)
for precise event formats.
properties: {}
example:
$ref: examples/minimal_pdu.json
pdus:
type: array
description: |-
The fully resolved state of the room at the given event. Note that
events have a different format depending on the room version -
check the [room version specification](/rooms) for precise event formats.
items:
type: object
title: PDU
description: |-
The [PDUs](/server-server-api/#pdus) for the fully resolved state of the room. The event format
varies depending on the room version - check the [room version specification](/rooms)
for precise event formats.
properties: {}
example:
$ref: examples/minimal_pdu.json
required:
- auth_chain
- pdus
"/state_ids/{roomId}":
get:
summary: Get all the state event IDs of a given room
@ -102,72 +98,84 @@ paths:
parameters:
- in: path
name: roomId
type: string
description: The room ID to get state for.
required: true
x-example: "!abc123:matrix.org"
example: "!abc123:matrix.org"
schema:
type: string
- in: query
name: event_id
type: string
description: An event ID in the room to retrieve the state at.
required: true
x-example: "$helloworld:matrix.org"
example: $helloworld:matrix.org
schema:
type: string
responses:
200:
"200":
description: |-
The fully resolved state for the room, prior to considering any state
changes induced by the requested event. Includes the authorization
chain for the events.
schema:
type: object
properties:
auth_chain_ids:
type: array
description: |-
The full set of authorization events that make up the state
of the room, and their authorization events, recursively.
items:
type: string
example: ["$an_event:example.org"]
pdu_ids:
type: array
description: |-
The fully resolved state of the room at the given event.
items:
type: string
example: ["$an_event:example.org"]
required: ['auth_chain_ids', 'pdu_ids']
404:
content:
application/json:
schema:
type: object
properties:
auth_chain_ids:
type: array
description: |-
The full set of authorization events that make up the state
of the room, and their authorization events, recursively.
items:
type: string
example:
- $an_event:example.org
pdu_ids:
type: array
description: The fully resolved state of the room at the given event.
items:
type: string
example:
- $an_event:example.org
required:
- auth_chain_ids
- pdu_ids
"404":
description: |-
The given `event_id` was not found or the server doesn't know about the state at
that event to return anything useful.
examples:
application/json: {
"errcode": "M_NOT_FOUND",
"error": "Could not find event $Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg"
}
schema:
"$ref": "../client-server/definitions/errors/error.yaml"
content:
application/json:
schema:
$ref: ../client-server/definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_NOT_FOUND",
"error": "Could not find event $Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg"
}
"/event/{eventId}":
get:
summary: Get a single event
description: |-
Retrieves a single event.
description: Retrieves a single event.
operationId: getEvent
security:
- signedRequest: []
parameters:
- in: path
name: eventId
type: string
description: The event ID to get.
required: true
x-example: "$abc123:matrix.org"
responses:
200:
description: A transaction containing a single PDU which is the event requested.
example: $abc123:matrix.org
schema:
$ref: "definitions/single_pdu_transaction.yaml"
type: string
responses:
"200":
description: A transaction containing a single PDU which is the event requested.
content:
application/json:
schema:
$ref: definitions/single_pdu_transaction.yaml
"/timestamp_to_event/{roomId}":
get:
summary: Get the closest event ID to the given timestamp
@ -202,55 +210,79 @@ paths:
- accessToken: []
parameters:
- in: path
type: string
name: roomId
description: The ID of the room to search
required: true
x-example: "!636q39766251:matrix.org"
example: "!636q39766251:matrix.org"
schema:
type: string
- in: query
type: integer
name: ts
description: |-
The timestamp to search from, as given in milliseconds
since the Unix epoch.
required: true
x-example: 1432684800000
example: 1432684800000
schema:
type: integer
- in: query
type: string
enum: [f, b]
name: dir
description: |-
The direction in which to search. `f` for forwards, `b` for backwards.
description: The direction in which to search. `f` for forwards, `b` for
backwards.
required: true
x-example: f
example: f
schema:
type: string
enum:
- f
- b
responses:
200:
description: |-
An event was found matching the search parameters.
schema:
type: object
properties:
event_id:
type: string
description: |-
The ID of the event found
origin_server_ts:
type: integer
description: |-
The event's timestamp, in milliseconds since the Unix epoch.
required: ['event_id', 'origin_server_ts']
examples:
application/json: {
"event_id": "$143273582443PhrSn:example.org",
"origin_server_ts": 1432735824653
}
404:
description: |-
No event was found.
examples:
application/json: {
"errcode": "M_NOT_FOUND",
"error": "Unable to find event from 1432684800000 in forward direction"
}
schema:
"$ref": "../client-server/definitions/errors/error.yaml"
"200":
description: An event was found matching the search parameters.
content:
application/json:
schema:
type: object
properties:
event_id:
type: string
description: The ID of the event found
origin_server_ts:
type: integer
description: The event's timestamp, in milliseconds since the Unix epoch.
required:
- event_id
- origin_server_ts
examples:
response:
value: {
"event_id": "$143273582443PhrSn:example.org",
"origin_server_ts": 1432735824653
}
"404":
description: No event was found.
content:
application/json:
schema:
$ref: ../client-server/definitions/errors/error.yaml
examples:
response:
value: {
"errcode": "M_NOT_FOUND",
"error": "Unable to find event from 1432684800000 in forward direction"
}
servers:
- url: "{protocol}://{hostname}{basePath}"
variables:
protocol:
enum:
- http
- https
default: https
hostname:
default: localhost:8448
basePath:
default: /_matrix/federation/v1
components:
securitySchemes:
$ref: definitions/security.yaml