diff --git a/event-schemas/schema/v1/m.room.aliases b/event-schemas/schema/v1/m.room.aliases index 6bfa50f8..6585f13d 100644 --- a/event-schemas/schema/v1/m.room.aliases +++ b/event-schemas/schema/v1/m.room.aliases @@ -20,6 +20,10 @@ }, "required": ["aliases"] }, + "state_key": { + "type": "string", + "description": "The homeserver domain which owns these room aliases." + }, "type": { "type": "string", "enum": ["m.room.aliases"] diff --git a/event-schemas/schema/v1/m.room.create b/event-schemas/schema/v1/m.room.create index f133124a..f9fa12ea 100644 --- a/event-schemas/schema/v1/m.room.create +++ b/event-schemas/schema/v1/m.room.create @@ -19,6 +19,7 @@ }, "state_key": { "type": "string", + "description": "A 0-length string.", "pattern": "^$" }, "type": { diff --git a/event-schemas/schema/v1/m.room.join_rules b/event-schemas/schema/v1/m.room.join_rules index 16f5c9a6..307b5571 100644 --- a/event-schemas/schema/v1/m.room.join_rules +++ b/event-schemas/schema/v1/m.room.join_rules @@ -20,6 +20,7 @@ }, "state_key": { "type": "string", + "description": "A 0-length string.", "pattern": "^$" }, "type": { diff --git a/event-schemas/schema/v1/m.room.member b/event-schemas/schema/v1/m.room.member index a14a6c91..ab616176 100644 --- a/event-schemas/schema/v1/m.room.member +++ b/event-schemas/schema/v1/m.room.member @@ -27,7 +27,8 @@ "required": ["membership"] }, "state_key": { - "type": "string" + "type": "string", + "description": "The ``user_id`` this membership event relates to." }, "type": { "type": "string", diff --git a/event-schemas/schema/v1/m.room.name b/event-schemas/schema/v1/m.room.name index ba990c61..4fb02efc 100644 --- a/event-schemas/schema/v1/m.room.name +++ b/event-schemas/schema/v1/m.room.name @@ -19,6 +19,7 @@ }, "state_key": { "type": "string", + "description": "A 0-length string.", "pattern": "^$" }, "type": { diff --git a/event-schemas/schema/v1/m.room.power_levels b/event-schemas/schema/v1/m.room.power_levels index d439e4a0..944070eb 100644 --- a/event-schemas/schema/v1/m.room.power_levels +++ b/event-schemas/schema/v1/m.room.power_levels @@ -56,6 +56,7 @@ }, "state_key": { "type": "string", + "description": "A 0-length string.", "pattern": "^$" }, "type": { diff --git a/event-schemas/schema/v1/m.room.topic b/event-schemas/schema/v1/m.room.topic index 4849b229..96d61362 100644 --- a/event-schemas/schema/v1/m.room.topic +++ b/event-schemas/schema/v1/m.room.topic @@ -19,6 +19,7 @@ }, "state_key": { "type": "string", + "description": "A 0-length string.", "pattern": "^$" }, "type": { diff --git a/templating/internal/units.py b/templating/internal/units.py index f8cb0f15..328a9f07 100644 --- a/templating/internal/units.py +++ b/templating/internal/units.py @@ -100,6 +100,7 @@ def _load_schemas(): json_schema = json.loads(f.read()) schema = { "typeof": None, + "typeof_info": "", "type": None, "title": None, "desc": None, @@ -116,7 +117,7 @@ def _load_schemas(): # add typeof base_defs = { - "core#/definitions/room_event": "Room Event", + "core#/definitions/room_event": "Message Event", "core#/definitions/state_event": "State Event" } if type(json_schema.get("allOf")) == list: @@ -136,6 +137,13 @@ def _load_schemas(): prop(json_schema, "properties/content") ) + # Assign state key info + if schema["typeof"] == "State Event": + skey_desc = prop(json_schema, "properties/state_key/description") + if not skey_desc: + raise Exception("Missing description for state_key") + schema["typeof_info"] = "``state_key``: %s" % skey_desc + schemata[filename] = schema return schemata diff --git a/templating/templates/events.tmpl b/templating/templates/events.tmpl index b1710883..f875e29a 100644 --- a/templating/templates/events.tmpl +++ b/templating/templates/events.tmpl @@ -1,6 +1,9 @@ ``{{event.type}}`` {{(4 + event.type | length) * '-'}} -{{event.desc | wrap(80)}} +*{{event.typeof}}* + {{event.typeof_info}} + + {{event.desc | wrap(80) | indent_block(2)}} {% for table in event.content_fields -%} {{"``"+table.title+"``" if table.title else ""}}