Add descriptions to state_keys. Add it into the template.

pull/977/head
Kegan Dougal 10 years ago
parent 6a41bd9b82
commit 73d84f3722

@ -20,6 +20,10 @@
}, },
"required": ["aliases"] "required": ["aliases"]
}, },
"state_key": {
"type": "string",
"description": "The homeserver domain which owns these room aliases."
},
"type": { "type": {
"type": "string", "type": "string",
"enum": ["m.room.aliases"] "enum": ["m.room.aliases"]

@ -19,6 +19,7 @@
}, },
"state_key": { "state_key": {
"type": "string", "type": "string",
"description": "A 0-length string.",
"pattern": "^$" "pattern": "^$"
}, },
"type": { "type": {

@ -20,6 +20,7 @@
}, },
"state_key": { "state_key": {
"type": "string", "type": "string",
"description": "A 0-length string.",
"pattern": "^$" "pattern": "^$"
}, },
"type": { "type": {

@ -27,7 +27,8 @@
"required": ["membership"] "required": ["membership"]
}, },
"state_key": { "state_key": {
"type": "string" "type": "string",
"description": "The ``user_id`` this membership event relates to."
}, },
"type": { "type": {
"type": "string", "type": "string",

@ -19,6 +19,7 @@
}, },
"state_key": { "state_key": {
"type": "string", "type": "string",
"description": "A 0-length string.",
"pattern": "^$" "pattern": "^$"
}, },
"type": { "type": {

@ -56,6 +56,7 @@
}, },
"state_key": { "state_key": {
"type": "string", "type": "string",
"description": "A 0-length string.",
"pattern": "^$" "pattern": "^$"
}, },
"type": { "type": {

@ -19,6 +19,7 @@
}, },
"state_key": { "state_key": {
"type": "string", "type": "string",
"description": "A 0-length string.",
"pattern": "^$" "pattern": "^$"
}, },
"type": { "type": {

@ -100,6 +100,7 @@ def _load_schemas():
json_schema = json.loads(f.read()) json_schema = json.loads(f.read())
schema = { schema = {
"typeof": None, "typeof": None,
"typeof_info": "",
"type": None, "type": None,
"title": None, "title": None,
"desc": None, "desc": None,
@ -116,7 +117,7 @@ def _load_schemas():
# add typeof # add typeof
base_defs = { base_defs = {
"core#/definitions/room_event": "Room Event", "core#/definitions/room_event": "Message Event",
"core#/definitions/state_event": "State Event" "core#/definitions/state_event": "State Event"
} }
if type(json_schema.get("allOf")) == list: if type(json_schema.get("allOf")) == list:
@ -136,6 +137,13 @@ def _load_schemas():
prop(json_schema, "properties/content") 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 schemata[filename] = schema
return schemata return schemata

@ -1,6 +1,9 @@
``{{event.type}}`` ``{{event.type}}``
{{(4 + event.type | length) * '-'}} {{(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 -%} {% for table in event.content_fields -%}
{{"``"+table.title+"``" if table.title else ""}} {{"``"+table.title+"``" if table.title else ""}}

Loading…
Cancel
Save