Merge pull request #1834 from matrix-org/travis/misc/event-formats

Represent event format changes more clearly in the spec
pull/977/head
Travis Ralston 6 years ago committed by GitHub
commit 9923584c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -75,6 +75,12 @@ def check_response(filepath, request, code, response):
filepath, request, code filepath, request, code
)) ))
check_schema(filepath, example, schema) check_schema(filepath, example, schema)
except jsonschema.SchemaError as error:
for suberror in sorted(error.context, key=lambda e: e.schema_path):
print(list(suberror.schema_path), suberror.message, sep=", ")
raise ValueError("Error validating JSON schema for %r %r" % (
request, code
), e)
except Exception as e: except Exception as e:
raise ValueError("Error validating JSON schema for %r %r" % ( raise ValueError("Error validating JSON schema for %r %r" % (
request, code request, code

@ -65,22 +65,6 @@ paths:
event(s), up to the given limit. event(s), up to the given limit.
schema: schema:
$ref: "definitions/transaction.yaml" $ref: "definitions/transaction.yaml"
# Override the example to show the response of the request a bit better
examples:
application/json: {
"$ref": "examples/transaction.json",
"pdus": [
{
"$ref": "pdu.json",
"room_id": "!SomeRoom:matrix.org",
"event_id": "$abc123:matrix.org"
},
{
"$ref": "pdu.json",
"room_id": "!SomeRoom:matrix.org"
},
]
}
"/get_missing_events/{roomId}": "/get_missing_events/{roomId}":
post: post:
summary: Retrieves events that the sender is missing summary: Retrieves events that the sender is missing
@ -114,14 +98,14 @@ paths:
earliest_events: earliest_events:
type: array type: array
description: |- description: |-
The latest events that the sender already has. These are skipped when retrieving The latest event IDs that the sender already has. These are skipped when retrieving
the previous events of ``latest_events``. the previous events of ``latest_events``.
items: items:
type: string type: string
example: ["$missing_event:example.org"] example: ["$missing_event:example.org"]
latest_events: latest_events:
type: array type: array
description: The events to retrieve the previous events for. description: The event IDs to retrieve the previous events for.
items: items:
type: string type: string
example: ["$event_that_has_the_missing_event_as_a_previous_event:example.org"] example: ["$event_that_has_the_missing_event_as_a_previous_event:example.org"]
@ -136,13 +120,16 @@ paths:
properties: properties:
events: events:
type: array type: array
description: The missing events. description: |-
The missing events. The event format varies depending on the room version - check
the `room version specification`_ for precise event formats.
items: items:
$ref: definitions/pdu.yaml type: object
title: PDU
required: ['events'] required: ['events']
examples: examples:
application/json: { application/json: {
"events": [ "events": [
{"$ref": "examples/pdu.json"} {"$ref": "examples/minimal_pdu.json"}
] ]
} }

@ -1,4 +1,4 @@
# Copyright 2018 New Vector Ltd # Copyright 2018-2019 New Vector Ltd
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -13,15 +13,14 @@
# limitations under the License. # limitations under the License.
type: object type: object
title: Invite Event title: Invite Event
description: An invite event description: |-
An invite event. Note that events have a different format depending on the
room version - check the `room version specification`_ for precise event formats.
allOf: allOf:
- $ref: "pdu.yaml"
- type: object - type: object
properties: properties:
# Note: we override a bunch of parameters to change their descriptions
sender: sender:
type: string type: string
# TODO: Verify/clarify this - it doesn't seem right, given this is a 'regular' invite
description: |- description: |-
The matrix ID of the user who sent the original ``m.room.third_party_invite``. The matrix ID of the user who sent the original ``m.room.third_party_invite``.
example: "@someone:example.org" example: "@someone:example.org"
@ -55,33 +54,10 @@ allOf:
description: The value ``invite``. description: The value ``invite``.
example: "invite" example: "invite"
required: ['membership'] required: ['membership']
auth_events:
type: array
description: |-
An event reference list containing the authorization events that would
allow the member to be invited to the room.
items:
type: array
maxItems: 2
minItems: 2
items:
- type: string
title: Event ID
example: "$abc123:matrix.org"
- type: object
title: Event Hash
example: {
"sha256": "abase64encodedsha256hashshouldbe43byteslong"
}
properties:
sha256:
type: string
description: The event hash.
example: abase64encodedsha256hashshouldbe43byteslong
required: ['sha256']
redacts:
type: string
description: Not used.
required: required:
# Every other field is already flagged as required by the $ref
- state_key - state_key
- sender
- origin
- origin_server_ts
- type
- content

@ -31,7 +31,17 @@ properties:
example: 1532991320875 example: 1532991320875
pdus: pdus:
type: array type: array
description: List of persistent updates to rooms. Must not include more than 50 PDUs. description: |-
List of persistent updates to rooms. Must not include more than 50 PDUs. Note that
events have a different format depending on the room version - check the
`room version specification`_ for precise event formats.
items: items:
$ref: "pdu.yaml" type: object
title: PDU
description: |-
The `PDUs <#pdus>`_ contained in the transaction. The event format varies depending
on the room version - check the `room version specification`_ for precise event formats.
properties: []
example:
$ref: "../examples/minimal_pdu.json"
required: ['origin', 'origin_server_ts', 'pdus'] required: ['origin', 'origin_server_ts', 'pdus']

@ -58,10 +58,19 @@ paths:
type: array type: array
description: |- description: |-
The full set of authorization events that make up the state of The full set of authorization events that make up the state of
the room, and their authorization events, recursively. the room, and their authorization events, recursively. Note that
events have a different format depending on the room version -
check the `room version specification`_ for precise event formats.
items: items:
$ref: "definitions/pdu.yaml" type: object
example: [{"$ref": "examples/pdu.json"}] title: PDU
description: |-
The `PDUs <#pdus>`_ contained in the auth chain. The event format
varies depending on the room version - check the `room version specification`_
for precise event formats.
properties: []
example:
$ref: "examples/minimal_pdu.json"
required: ['auth_chain'] required: ['auth_chain']
"/query_auth/{roomId}/{eventId}": "/query_auth/{roomId}/{eventId}":
post: post:
@ -98,10 +107,20 @@ paths:
properties: properties:
auth_chain: auth_chain:
type: array type: array
description: The auth chain (the "remote auth"). description: |-
The auth chain (the "remote auth"). Note that events have a different
format depending on the room version - check the `room version specification`_
for precise event formats.
items: items:
$ref: "definitions/pdu.yaml" type: object
example: [{"$ref": "examples/pdu.json"}] title: PDU
description: |-
The `PDUs <#pdus>`_ contained in the auth chain. The event format
varies depending on the room version - check the `room version specification`_
for precise event formats.
properties: []
example:
$ref: "examples/minimal_pdu.json"
missing: missing:
type: array type: array
description: |- description: |-
@ -142,10 +161,19 @@ paths:
type: array type: array
description: |- description: |-
The auth chain the receiver has, and used to determine the auth The auth chain the receiver has, and used to determine the auth
chain differences (the "local auth"). chain differences (the "local auth"). Note that events have a different
format depending on the room version - check the `room version specification`_
for precise event formats.
items: items:
$ref: "definitions/pdu.yaml" type: object
example: [{"$ref": "examples/pdu.json"}] title: PDU
description: |-
The `PDUs <#pdus>`_ contained in the auth chain. The event format
varies depending on the room version - check the `room version specification`_
for precise event formats.
properties: []
example:
$ref: "examples/minimal_pdu.json"
missing: missing:
type: array type: array
description: |- description: |-

@ -59,17 +59,35 @@ paths:
type: array type: array
description: |- description: |-
The full set of authorization events that make up the state The full set of authorization events that make up the state
of the room, and their authorization events, recursively. 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`_ for precise event formats.
items: items:
$ref: "definitions/pdu.yaml" type: object
example: [{"$ref": "examples/pdu.json"}] title: PDU
description: |-
The `PDUs <#pdus>`_ contained in the auth chain. The event format
varies depending on the room version - check the `room version specification`_
for precise event formats.
properties: []
example:
$ref: "examples/minimal_pdu.json"
pdus: pdus:
type: array type: array
description: |- description: |-
The fully resolved state of the room at the given event. 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`_ for precise event formats.
items: items:
$ref: "definitions/pdu.yaml" type: object
example: [{"$ref": "examples/pdu.json"}] title: PDU
description: |-
The `PDUs <#pdus>`_ for the fully resolved state of the room. The event format
varies depending on the room version - check the `room version specification`_
for precise event formats.
properties: []
example:
$ref: "examples/minimal_pdu.json"
required: ['auth_chain', 'pdus'] required: ['auth_chain', 'pdus']
"/state_ids/{roomId}": "/state_ids/{roomId}":
get: get:

@ -0,0 +1,7 @@
{
"type": "m.room.minimal_pdu",
"room_id": "!somewhere:example.org",
"content": {
"see_room_version_spec": "The event format changes depending on the room version."
}
}

@ -1,5 +1,7 @@
{ {
"origin": "matrix.org", "origin": "matrix.org",
"origin_server_ts": 1234567890, "origin_server_ts": 1234567890,
"pdus": [{"$ref": "pdu.json"}] "pdus": [{
"$ref": "minimal_pdu.json"
}]
} }

@ -38,6 +38,11 @@ paths:
Servers should prefer to use the v2 API for invites instead of the v1 API. Servers Servers should prefer to use the v2 API for invites instead of the v1 API. Servers
which receive a v1 invite request must assume that the room version is either ``"1"`` which receive a v1 invite request must assume that the room version is either ``"1"``
or ``"2"``. or ``"2"``.
Note that events have a different format depending on the room version - check the
`room version specification`_ for precise event formats. **The request and response
bodies here describe the common event fields in more detail and may be missing other
required fields for a PDU.**
operationId: sendInviteV1 operationId: sendInviteV1
security: security:
- signedRequest: [] - signedRequest: []
@ -107,9 +112,12 @@ paths:
} }
] ]
example: { example: {
"$ref": "examples/pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@joe:elsewhere.com", "state_key": "@joe:elsewhere.com",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": { "unsigned": {
"invite_room_state": [ "invite_room_state": [
{ {
@ -143,7 +151,8 @@ paths:
200: 200:
description: |- description: |-
The event with the invited server's signature added. All other fields of the events The event with the invited server's signature added. All other fields of the events
should remain untouched. should remain untouched. Note that events have a different format depending on the
room version - check the `room version specification`_ for precise event formats.
schema: schema:
type: array type: array
minItems: 2 minItems: 2
@ -164,9 +173,12 @@ paths:
200, 200,
{ {
"event": { "event": {
"$ref": "examples/pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": { "unsigned": {
"invite_room_state": [ "invite_room_state": [
{ {

@ -42,6 +42,11 @@ paths:
This endpoint is preferred over the v1 API as it is more useful for servers. Senders This endpoint is preferred over the v1 API as it is more useful for servers. Senders
which receive a 400 or 404 response to this endpoint should retry using the v1 which receive a 400 or 404 response to this endpoint should retry using the v1
API as the server may be older, if the room version is "1" or "2". API as the server may be older, if the room version is "1" or "2".
Note that events have a different format depending on the room version - check the
`room version specification`_ for precise event formats. **The request and response
bodies here describe the common event fields in more detail and may be missing other
required fields for a PDU.**
operationId: sendInviteV2 operationId: sendInviteV2
security: security:
- signedRequest: [] - signedRequest: []
@ -111,9 +116,12 @@ paths:
example: { example: {
"room_version": "2", "room_version": "2",
"event": { "event": {
"$ref": "examples/pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@joe:elsewhere.com", "state_key": "@joe:elsewhere.com",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "invite" "membership": "invite"
}, },
@ -146,7 +154,8 @@ paths:
200: 200:
description: |- description: |-
The event with the invited server's signature added. All other fields of the events The event with the invited server's signature added. All other fields of the events
should remain untouched. should remain untouched. Note that events have a different format depending on the
room version - check the `room version specification`_ for precise event formats.
schema: schema:
type: object type: object
description: An object containing the signed invite event. description: An object containing the signed invite event.
@ -158,9 +167,12 @@ paths:
examples: examples:
application/json: { application/json: {
"event": { "event": {
"$ref": "examples/pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": { "unsigned": {
"invite_room_state": [ "invite_room_state": [
{ {

@ -61,7 +61,11 @@ paths:
responses: responses:
200: 200:
description: |- description: |-
A template to be used for the rest of the `Joining Rooms`_ handshake. A template to be used for the rest of the `Joining Rooms`_ handshake. Note that
events have a different format depending on the room version - check the
`room version specification`_ for precise event formats. **The response body
here describes the common event fields in more detail and may be missing other
required fields for a PDU.**
schema: schema:
type: object type: object
properties: properties:
@ -72,96 +76,65 @@ paths:
the room version is assumed to be either "1" or "2". the room version is assumed to be either "1" or "2".
example: "2" example: "2"
event: event:
allOf: description: |-
- $ref: "definitions/unsigned_pdu.yaml" An unsigned template event. Note that events have a different format
- description: |- depending on the room version - check the `room version specification`_
An unsigned template event. for precise event formats.
type: object
title: Event Template
properties:
sender:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
origin:
type: string
description: The name of the resident homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the resident homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
content:
type: object type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "join"}
properties: properties:
# Note: we override a bunch of parameters to change their descriptions membership:
sender:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
origin:
type: string
description: The name of the resident homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the resident homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
content:
type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "join"}
properties:
membership:
type: string
description: The value ``join``.
example: "join"
required: ['membership']
depth:
type: integer
description: This field must be present but is ignored; it may be 0.
example: 12
auth_events:
type: array
description: |-
An event reference list containing the authorization events that would
allow the member to join the room. This should normally be the
``m.room.create``, ``m.room.power_levels``, and ``m.room.join_rules``
events.
items:
type: array
maxItems: 2
minItems: 2
items:
- type: string
title: Event ID
example: "$abc123:matrix.org"
- type: object
title: Event Hash
example: {
"sha256": "abase64encodedsha256hashshouldbe43byteslong"
}
properties:
sha256:
type: string
description: The event hash.
example: abase64encodedsha256hashshouldbe43byteslong
required: ['sha256']
redacts:
type: string type: string
description: Not used. description: The value ``join``.
required: example: "join"
# Every other field is already flagged as required by the $ref required: ['membership']
- state_key required:
- state_key
- origin
- origin_server_ts
- type
- content
- sender
examples: examples:
application/json: { application/json: {
"room_version": "2", "room_version": "2",
"event": { "event": {
"$ref": "examples/unsigned_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "join" "membership": "join"
}, }
"auth_events": [
["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}]
]
} }
} }
400: 400:
@ -193,7 +166,12 @@ paths:
summary: Submit a signed join event to a resident server summary: Submit a signed join event to a resident server
description: |- description: |-
Submits a signed join event to the resident server for it Submits a signed join event to the resident server for it
to accept it into the room's graph. to accept it into the room's graph. Note that events have
a different format depending on the room version - check
the `room version specification`_ for precise event formats.
**The request and response body here describes the common
event fields in more detail and may be missing other required
fields for a PDU.**
operationId: sendJoin operationId: sendJoin
security: security:
- signedRequest: [] - signedRequest: []
@ -215,81 +193,54 @@ paths:
type: object type: object
required: true required: true
schema: schema:
allOf: type: object
- $ref: "definitions/pdu.yaml" properties:
- type: object sender:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
origin:
type: string
description: The name of the joining homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the joining homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
content:
type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "join"}
properties: properties:
# Note: we override a bunch of parameters to change their descriptions membership:
sender:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
origin:
type: string
description: The name of the joining homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the joining homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
content:
type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "join"}
properties:
membership:
type: string
description: The value ``join``.
example: "join"
required: ['membership']
depth:
type: integer
description: This field must be present but is ignored; it may be 0.
example: 12
auth_events:
type: array
description: |-
An event reference list containing the authorization events that would
allow the member to join the room.
items:
type: array
maxItems: 2
minItems: 2
items:
- type: string
title: Event ID
example: "$abc123:matrix.org"
- type: object
title: Event Hash
example: {
"sha256": "abase64encodedsha256hashshouldbe43byteslong"
}
properties:
sha256:
type: string
description: The event hash.
example: abase64encodedsha256hashshouldbe43byteslong
required: ['sha256']
redacts:
type: string type: string
description: Not used. description: The value ``join``.
required: example: "join"
# Every other field is already flagged as required by the $ref required: ['membership']
- state_key required:
- state_key
- sender
- origin
- origin_server_ts
- type
- content
example: { example: {
"$ref": "examples/pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "join" "membership": "join"
} }
@ -315,25 +266,44 @@ paths:
description: The resident server's DNS name. description: The resident server's DNS name.
auth_chain: auth_chain:
type: array type: array
description: The auth chain. description: |-
The auth chain. Note that events have a different format depending on
the room version - check the `room version specification`_ for precise
event formats.
items: items:
type: object type: object
title: PDU
description: |-
The `PDUs <#pdus>`_ that make up the auth chain. The event format varies depending
on the room version - check the `room version specification`_ for precise event formats.
schema: schema:
$ref: "definitions/pdu.yaml" type: object
properties: []
example:
$ref: "examples/minimal_pdu.json"
state: state:
type: array type: array
description: The room state. description: |-
The room state. The event format varies depending on the room version -
check the `room version specification`_ for precise event formats.
items: items:
type: object type: object
title: PDU
description: |-
The `PDUs <#pdus>`_ for the fully resolved state of the room. The event format varies depending
on the room version - check the `room version specification`_ for precise event formats.
schema: schema:
$ref: "definitions/pdu.yaml" type: object
properties: []
example:
$ref: "examples/minimal_pdu.json"
required: ["auth_chain", "state", "origin"] required: ["auth_chain", "state", "origin"]
examples: examples:
application/json: [ application/json: [
200, 200,
{ {
"origin": "matrix.org", "origin": "matrix.org",
"auth_chain": [{"$ref": "examples/pdu.json"}], "auth_chain": [{"$ref": "examples/minimal_pdu.json"}],
"state": [{"$ref": "examples/pdu.json"}] "state": [{"$ref": "examples/minimal_pdu.json"}]
} }
] ]

@ -52,7 +52,11 @@ paths:
responses: responses:
200: 200:
description: |- description: |-
A template to be used to call ``/send_leave``. A template to be used to call ``/send_leave``. Note that
events have a different format depending on the room version - check the
`room version specification`_ for precise event formats. **The response body
here describes the common event fields in more detail and may be missing other
required fields for a PDU.**
schema: schema:
schema: schema:
type: object type: object
@ -64,92 +68,65 @@ paths:
the room version is assumed to be either "1" or "2". the room version is assumed to be either "1" or "2".
example: "2" example: "2"
event: event:
allOf: description: |-
- $ref: "definitions/unsigned_pdu.yaml" An unsigned template event. Note that events have a different format
- description: |- depending on the room version - check the `room version specification`_
An unsigned template event. for precise event formats.
type: object
title: Event Template
properties:
sender:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
origin:
type: string
description: The name of the resident homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the resident homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
content:
type: object type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "leave"}
properties: properties:
# Note: we override a bunch of parameters to change their descriptions membership:
sender:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
origin:
type: string
description: The name of the resident homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the resident homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
content:
type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "leave"}
properties:
membership:
type: string
description: The value ``leave``.
example: "leave"
required: ['membership']
auth_events:
type: array
description: |-
An event reference list containing the authorization events that would
allow the member to leave the room. This should normally be the
``m.room.create``, ``m.room.power_levels``, and ``m.room.join_rules``
events.
items:
type: array
maxItems: 2
minItems: 2
items:
- type: string
title: Event ID
example: "$abc123:matrix.org"
- type: object
title: Event Hash
example: {
"sha256": "abase64encodedsha256hashshouldbe43byteslong"
}
properties:
sha256:
type: string
description: The event hash.
example: abase64encodedsha256hashshouldbe43byteslong
required: ['sha256']
redacts:
type: string type: string
description: Not used. description: The value ``leave``.
required: example: "leave"
# Every other field is already flagged as required by the $ref required: ['membership']
- state_key required:
- state_key
- sender
- origin
- origin_server_ts
- type
- content
examples: examples:
application/json: { application/json: {
"room_version": "2", "room_version": "2",
"event": { "event": {
"$ref": "examples/unsigned_pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "leave" "membership": "leave"
}, }
"auth_events": [
["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}]
]
} }
} }
403: 403:
@ -167,7 +144,12 @@ paths:
summary: Submit a signed leave event to a resident server summary: Submit a signed leave event to a resident server
description: |- description: |-
Submits a signed leave event to the resident server for it Submits a signed leave event to the resident server for it
to accept it into the room's graph. to accept it into the room's graph. Note that events have
a different format depending on the room version - check
the `room version specification`_ for precise event formats.
**The request and response body here describes the common
event fields in more detail and may be missing other required
fields for a PDU.**
operationId: sendLeave operationId: sendLeave
security: security:
- signedRequest: [] - signedRequest: []
@ -189,81 +171,59 @@ paths:
type: object type: object
required: true required: true
schema: schema:
allOf: type: object
- $ref: "definitions/pdu.yaml" properties:
- type: object sender:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
origin:
type: string
description: The name of the leaving homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the leaving homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
content:
type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "leave"}
properties: properties:
# Note: we override a bunch of parameters to change their descriptions membership:
sender:
type: string type: string
description: The user ID of the leaving member. description: The value ``leave``.
example: "@someone:example.org" example: "leave"
origin: required: ['membership']
type: string depth:
description: The name of the leaving homeserver. type: integer
example: "matrix.org" description: This field must be present but is ignored; it may be 0.
origin_server_ts: example: 12
type: integer required:
format: int64 - state_key
description: A timestamp added by the leaving homeserver. - sender
example: 1234567890 - origin
type: - origin_server_ts
type: string - type
description: The value ``m.room.member``. - depth
example: "m.room.member" - content
state_key:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
content:
type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "leave"}
properties:
membership:
type: string
description: The value ``leave``.
example: "leave"
required: ['membership']
depth:
type: integer
description: This field must be present but is ignored; it may be 0.
example: 12
auth_events:
type: array
description: |-
An event reference list containing the authorization events that would
allow the member to leave the room.
items:
type: array
maxItems: 2
minItems: 2
items:
- type: string
title: Event ID
example: "$abc123:matrix.org"
- type: object
title: Event Hash
example: {
"sha256": "abase64encodedsha256hashshouldbe43byteslong"
}
properties:
sha256:
type: string
description: The event hash.
example: abase64encodedsha256hashshouldbe43byteslong
required: ['sha256']
redacts:
type: string
description: Not used.
required:
# Every other field is already flagged as required by the $ref
- state_key
example: { example: {
"$ref": "examples/pdu.json", "$ref": "examples/minimal_pdu.json",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@someone:example.org", "state_key": "@someone:example.org",
"origin": "example.org",
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"content": { "content": {
"membership": "leave" "membership": "leave"
} }

@ -85,6 +85,7 @@ paths:
third_party_invite: third_party_invite:
type: object type: object
description: The third party invite description: The third party invite
title: Third Party Invite
properties: properties:
display_name: display_name:
type: string type: string
@ -97,6 +98,7 @@ paths:
description: |- description: |-
A block of content which has been signed, which servers can use to A block of content which has been signed, which servers can use to
verify the event. verify the event.
title: Invite Signatures
properties: properties:
signatures: signatures:
type: object type: object

@ -37,6 +37,9 @@ paths:
The sending server must wait and retry for a 200 OK response before sending a The sending server must wait and retry for a 200 OK response before sending a
transaction with a different ``txnId`` to the receiving server. transaction with a different ``txnId`` to the receiving server.
Note that events have a different format depending on the room version - check
the `room version specification`_ for precise event formats.
operationId: sendTransaction operationId: sendTransaction
security: security:
- signedRequest: [] - signedRequest: []

@ -1267,7 +1267,21 @@ point in time::
[E0]->[E1]->[E2]->[E3]->[E4]->[E5] [E0]->[E1]->[E2]->[E3]->[E4]->[E5]
.. WARNING::
The format of events can change depending on room version. Check the
`room version specification`_ for specific details on what to expect for
event formats. Examples contained within the client-server specification
are expected to be compatible with all specified room versions, however
some differences may still apply.
For this version of the specification, clients only need to worry about
the event ID format being different depending on room version. Clients
should not be parsing the event ID, and instead be treating it as an
opaque string. No changes should be required to support the currently
available room versions.
.. _`room version specification`: ../index.html#room-versions
Types of room events Types of room events
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~

Loading…
Cancel
Save