From 06177740d4549fc2ca60b9ecbb59e89cb6c2fb4a Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 26 May 2015 17:39:38 +0100 Subject: [PATCH] Tweak how constants are represented. --- event-schemas/schema/v1/m.call.answer | 2 +- event-schemas/schema/v1/m.call.invite | 2 +- templating/matrix_templates/units.py | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/event-schemas/schema/v1/m.call.answer b/event-schemas/schema/v1/m.call.answer index d14d4c7d3..78b68ce1a 100644 --- a/event-schemas/schema/v1/m.call.answer +++ b/event-schemas/schema/v1/m.call.answer @@ -20,7 +20,7 @@ "type": { "type": "string", "enum": ["answer"], - "description": "The type of session description. Must be 'answer'." + "description": "The type of session description." }, "sdp": { "type": "string", diff --git a/event-schemas/schema/v1/m.call.invite b/event-schemas/schema/v1/m.call.invite index b951d30bf..2be014663 100644 --- a/event-schemas/schema/v1/m.call.invite +++ b/event-schemas/schema/v1/m.call.invite @@ -21,7 +21,7 @@ "type": { "type": "string", "enum": ["offer"], - "description": "The type of session description. Must be 'offer'." + "description": "The type of session description." }, "sdp": { "type": "string", diff --git a/templating/matrix_templates/units.py b/templating/matrix_templates/units.py index ea62725b0..28fc3f9b8 100644 --- a/templating/matrix_templates/units.py +++ b/templating/matrix_templates/units.py @@ -102,8 +102,15 @@ class MatrixUnits(Units): else: value_type = props[key_name]["type"] if props[key_name].get("enum"): - value_type = "enum" - desc += " One of: %s" % json.dumps(props[key_name]["enum"]) + if len(props[key_name].get("enum")) > 1: + value_type = "enum" + desc += ( + " One of: %s" % json.dumps(props[key_name]["enum"]) + ) + else: + desc += ( + " Must be '%s'." % props[key_name]["enum"][0] + ) fields["rows"].append({ "key": key_name,