Use correct schema and examples; Remind readers often about formats

This commit is contained in:
Travis Ralston 2025-09-08 16:21:24 -06:00
parent 1692d22a8c
commit 8ce59031c4
4 changed files with 45 additions and 65 deletions

View file

@ -0,0 +1,9 @@
[
{"$ref": "./minimal_pdu.json"},
{
"type": "m.room.create",
"content": {
"see_room_version_spec": "The event format changes depending on the room version."
}
}
]

View file

@ -85,10 +85,19 @@ paths:
Servers might need to apply validation to the `invite_room_state` depending
on room version. See the `400 M_MISSING_PARAM` error definition for more
information.
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
precise event formats.
items:
$ref: ../../event-schemas/schema/core-event-schema/stripped_state.yaml
type: object
properties: {}
description: |-
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
precise event formats.
example:
$ref: ../../event-schemas/examples/invite_room_state.json
$ref: ./examples/stripped_state.json
type: object
required: true
responses:
@ -129,35 +138,7 @@ paths:
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": {
"invite_room_state": [
{
"type": "m.room.create",
"sender": "@bob:example.org",
"state_key": "",
"content": {
"version": "12"
},
"remaining_fields": "are formatted according to the room version specification"
},
{
"type": "m.room.name",
"sender": "@bob:example.org",
"state_key": "",
"content": {
"name": "Example Room"
},
"remaining_fields": "are formatted according to the room version specification"
},
{
"type": "m.room.join_rules",
"sender": "@bob:example.org",
"state_key": "",
"content": {
"join_rule": "invite"
},
"remaining_fields": "are formatted according to the room version specification"
}
]
"invite_room_state": {"$ref": "./examples/stripped_state.json"}
},
"content": {
"membership": "invite"

View file

@ -86,10 +86,19 @@ paths:
Servers might need to apply validation to the `invite_room_state` depending
on room version. See the `400 M_MISSING_PARAM` error definition for more
information.
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
precise event formats.
items:
$ref: ../../event-schemas/schema/core-event-schema/stripped_state.yaml
type: object
properties: {}
description: |-
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
precise event formats.
example:
$ref: ../../event-schemas/examples/invite_room_state.json
$ref: ./examples/stripped_state.json
required:
- room_version
- event
@ -122,35 +131,7 @@ paths:
"origin_server_ts": 1549041175876,
"sender": "@someone:example.org",
"unsigned": {
"invite_room_state": [
{
"type": "m.room.create",
"sender": "@bob:example.org",
"state_key": "",
"content": {
"version": "12"
},
"remaining_fields": "are formatted according to the room version specification"
},
{
"type": "m.room.name",
"sender": "@bob:example.org",
"state_key": "",
"content": {
"name": "Example Room"
},
"remaining_fields": "are formatted according to the room version specification"
},
{
"type": "m.room.join_rules",
"sender": "@bob:example.org",
"state_key": "",
"content": {
"join_rule": "invite"
},
"remaining_fields": "are formatted according to the room version specification"
}
]
"invite_room_state": {"$ref": "./examples/stripped_state.json"}
},
"content": {
"membership": "invite"

View file

@ -293,7 +293,12 @@ paths:
knock_room_state:
type: array
items:
$ref: ../../event-schemas/schema/core-event-schema/stripped_state.yaml
type: object
properties: {}
description: |-
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
precise event formats.
x-changedInMatrixVersion:
"1.16": |
`m.room.create` and format requirements were added.
@ -309,15 +314,19 @@ paths:
Entries which are [improperly signed](/server-server-api/#validating-hashes-and-signatures-on-received-events)
or formatted SHOULD be removed by the server prior to supplying
them over the Client-Server API.
Note that events have a different format depending on the room
version - check the [room version specification](/rooms) for
precise event formats.
example:
$ref: ../../event-schemas/examples/knock_room_state.json
"$ref": "./examples/stripped_state.json"
required:
- knock_room_state
examples:
response:
value: {
"knock_room_state": {
"$ref": "../../event-schemas/examples/knock_room_state.json"
"$ref": "./examples/stripped_state.json"
}
}
"403":