diff --git a/event-schemas/examples/m.room.topic b/event-schemas/examples/m.room.topic new file mode 100644 index 000000000..8a469122c --- /dev/null +++ b/event-schemas/examples/m.room.topic @@ -0,0 +1,12 @@ +{ + "age": 242352, + "content": { + "topic": "A room topic" + }, + "state_key": "", + "origin_server_ts": 1431961217939, + "event_id": "$WLGTSEFSEF:localhost", + "type": "m.room.topic", + "room_id": "!Cuyf34gef24t:localhost", + "user_id": "@example:localhost" +} diff --git a/event-schemas/schema/core b/event-schemas/schema/core index 277ff768a..11d931d51 100644 --- a/event-schemas/schema/core +++ b/event-schemas/schema/core @@ -2,25 +2,32 @@ "$schema": "http://json-schema.org/draft-04/schema#", "definitions": { "event": { + "title": "Event", + "description": "The basic set of fields all events must have.", "type": "object", "properties": { "event_id": { - "type": "string" + "type": "string", + "description": "The globally unique event identifier." }, "user_id": { "type": "string" }, "content": { - "type": "object" + "type": "object", + "description": "The fields in this object will vary depending on the type of event." }, "type": { - "type": "string" + "type": "string", + "description": "The type of event. This SHOULD be namespaced similar to Java package naming conventions e.g. 'com.example.subdomain.event.type'" } }, "required": ["event_id", "user_id", "content", "type"] }, "room_event": { "type": "object", + "title": "Room Event", + "description": "The basic set of fields all room events must have.", "allOf":[{ "$ref": "#/definitions/event" }], @@ -33,12 +40,19 @@ }, "state_event": { "type": "object", + "title": "State Event", + "description": "The basic set of fields which define a room state event.", "allOf":[{ "$ref": "#/definitions/room_event" }], "properties": { "state_key": { - "type": "string" + "type": "string", + "description": "A unique key which defines the overwriting semantics for this piece of room state. This value is often a 0-length string." + }, + "prev_content": { + "type": "object", + "description": "The previous content if this event has overwritten another event." } }, "required": ["state_key"] diff --git a/event-schemas/schema/m.room.message b/event-schemas/schema/m.room.message index 0b22ca9de..2b00dfd02 100644 --- a/event-schemas/schema/m.room.message +++ b/event-schemas/schema/m.room.message @@ -16,6 +16,10 @@ } }, "required": ["msgtype", "body"] + }, + "type": { + "type": "string", + "enum": ["m.room.message"] } } } diff --git a/event-schemas/schema/m.room.name b/event-schemas/schema/m.room.name index bfcd509b3..6dca3b140 100644 --- a/event-schemas/schema/m.room.name +++ b/event-schemas/schema/m.room.name @@ -17,6 +17,10 @@ "state_key": { "type": "string", "pattern": "^$" + }, + "type": { + "type": "string", + "enum": ["m.room.name"] } } } diff --git a/event-schemas/schema/m.room.topic b/event-schemas/schema/m.room.topic new file mode 100644 index 000000000..80ae1191d --- /dev/null +++ b/event-schemas/schema/m.room.topic @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "allOf": [{ + "$ref": "core#/definitions/state_event" + }], + "properties": { + "content": { + "type": "object", + "properties": { + "topic": { + "type": "string" + } + }, + "required": ["topic"] + }, + "state_key": { + "type": "string", + "pattern": "^$" + }, + "type": { + "type": "string", + "enum": ["m.room.topic"] + } + } +}