-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1573 from turt2live/travis/c2s/sync-event-fields
Fix event schemas for /sync
- Loading branch information
Showing
11 changed files
with
201 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2018 New Vector Ltd | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
properties: | ||
events: | ||
description: List of events. | ||
items: | ||
allOf: | ||
- $ref: event-schemas/schema/core-event-schema/sync_room_event.yaml | ||
type: object | ||
required: | ||
- event_id | ||
#- room_id - Not in /sync | ||
- sender | ||
- origin_server_ts | ||
type: array | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2018 New Vector Ltd | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
properties: | ||
events: | ||
description: List of events. | ||
items: | ||
allOf: | ||
- $ref: event-schemas/schema/core-event-schema/sync_state_event.yaml | ||
type: object | ||
required: | ||
- event_id | ||
#- room_id - Not in /sync | ||
- sender | ||
- origin_server_ts | ||
- state_key | ||
type: array | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Clarify the event fields used in the ``/sync`` response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ properties: | |
type: string | ||
required: | ||
- type | ||
- content | ||
title: Event | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,14 @@ | ||
allOf: | ||
- $ref: event.yaml | ||
- $ref: sync_room_event.yaml | ||
description: In addition to the Event fields, Room Events have the following additional | ||
fields. | ||
properties: | ||
event_id: | ||
description: The globally unique event identifier. | ||
type: string | ||
room_id: | ||
description: The ID of the room associated with this event. | ||
type: string | ||
sender: | ||
description: Contains the fully-qualified ID of the user who *sent* | ||
this event. | ||
description: |- | ||
The ID of the room associated with this event. Will not be present on events | ||
that arrive through ``/sync``, despite being required everywhere else. | ||
type: string | ||
origin_server_ts: | ||
description: Timestamp in milliseconds on originating homeserver | ||
when this event was sent. | ||
type: integer | ||
format: int64 | ||
unsigned: | ||
description: Contains optional extra information about the event. | ||
properties: | ||
age: | ||
description: The time in milliseconds that has elapsed since the event was | ||
sent. This field is generated by the local homeserver, and may be incorrect | ||
if the local time on at least one of the two servers is out of sync, which can | ||
cause the age to either be negative or greater than it actually is. | ||
type: integer | ||
redacted_because: | ||
description: Optional. The event that redacted this event, if any. | ||
title: Event | ||
type: object | ||
transaction_id: | ||
description: The client-supplied transaction ID, if the client being given | ||
the event is the same one which sent it. | ||
type: string | ||
title: UnsignedData | ||
type: object | ||
required: | ||
- event_id | ||
- room_id | ||
- sender | ||
- origin_server_ts | ||
title: Room Event | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,7 @@ | ||
allOf: | ||
- $ref: room_event.yaml | ||
- $ref: sync_state_event.yaml | ||
description: In addition to the Room Event fields, State Events have the following | ||
additional fields. | ||
properties: | ||
prev_content: | ||
description: Optional. The previous ``content`` for this event. If there is no | ||
previous content, this key will be missing. | ||
title: EventContent | ||
type: object | ||
state_key: | ||
description: A unique key which defines the overwriting semantics for this piece | ||
of room state. This value is often a zero-length string. The presence of this | ||
key makes this event a State Event. | ||
|
||
State keys starting with an ``@`` are reserved for referencing user IDs, such | ||
as room members. With the exception of a few events, state events set with a | ||
given user's ID as the state key MUST only be set by that user. | ||
type: string | ||
required: | ||
- state_key | ||
title: State Event | ||
type: object |
60 changes: 60 additions & 0 deletions
60
event-schemas/schema/core-event-schema/sync_room_event.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Copyright 2018 New Vector Ltd | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
|
||
# Note: this is technically not a core event schema, however it is included here | ||
# to keep things sane. The short story is that /sync doesn't require a room_id to | ||
# be on events, so we give it a whole event structure as a base for room_event. | ||
# This base doesn't declare a room_id, which instead appears in the room_event. | ||
|
||
allOf: | ||
- $ref: event.yaml | ||
description: In addition to the Event fields, Room Events have the following additional | ||
fields. | ||
properties: | ||
event_id: | ||
description: The globally unique event identifier. | ||
type: string | ||
sender: | ||
description: Contains the fully-qualified ID of the user who sent this event. | ||
type: string | ||
origin_server_ts: | ||
description: Timestamp in milliseconds on originating homeserver | ||
when this event was sent. | ||
type: integer | ||
format: int64 | ||
unsigned: | ||
description: Contains optional extra information about the event. | ||
properties: | ||
age: | ||
description: The time in milliseconds that has elapsed since the event was | ||
sent. This field is generated by the local homeserver, and may be incorrect | ||
if the local time on at least one of the two servers is out of sync, which can | ||
cause the age to either be negative or greater than it actually is. | ||
type: integer | ||
redacted_because: | ||
description: Optional. The event that redacted this event, if any. | ||
title: Event | ||
type: object | ||
transaction_id: | ||
description: The client-supplied transaction ID, if the client being given | ||
the event is the same one which sent it. | ||
type: string | ||
title: UnsignedData | ||
type: object | ||
required: | ||
- event_id | ||
- sender | ||
- origin_server_ts | ||
title: Room Event | ||
type: object |
39 changes: 39 additions & 0 deletions
39
event-schemas/schema/core-event-schema/sync_state_event.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright 2018 New Vector Ltd | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# 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. | ||
|
||
# See sync_room_event.yaml for why this file is here. | ||
|
||
allOf: | ||
- $ref: sync_room_event.yaml | ||
description: In addition to the Room Event fields, State Events have the following | ||
additional fields. | ||
properties: | ||
prev_content: | ||
description: Optional. The previous ``content`` for this event. If there is no | ||
previous content, this key will be missing. | ||
title: EventContent | ||
type: object | ||
state_key: | ||
description: A unique key which defines the overwriting semantics for this piece | ||
of room state. This value is often a zero-length string. The presence of this | ||
key makes this event a State Event. | ||
|
||
State keys starting with an ``@`` are reserved for referencing user IDs, such | ||
as room members. With the exception of a few events, state events set with a | ||
given user's ID as the state key MUST only be set by that user. | ||
type: string | ||
required: | ||
- state_key | ||
title: State Event | ||
type: object |