summaryrefslogtreecommitdiff
path: root/rest-api-templates
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-04-24 21:43:16 +0000
committerDavid M. Lee <dlee@digium.com>2013-04-24 21:43:16 +0000
commit22aa2a6e9b80891bf0cf8668bc5cca3e404fd515 (patch)
treebc389b08d07c5077f12795cbc0fa29aa7fbd8f28 /rest-api-templates
parent72828808c88cd95cbc5014da931275bccda4208d (diff)
Oops. Mustache doesn't like dictionaries
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'rest-api-templates')
-rw-r--r--rest-api-templates/swagger_model.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/rest-api-templates/swagger_model.py b/rest-api-templates/swagger_model.py
index c42bb7086..32e7cb5cd 100644
--- a/rest-api-templates/swagger_model.py
+++ b/rest-api-templates/swagger_model.py
@@ -297,9 +297,11 @@ class Model(Stringify):
self.id = None
self.properties = None
- def load(self, model_json, processor, context):
+ def load(self, id, model_json, processor, context):
context = add_context(context, model_json, 'id')
self.id = model_json.get('id')
+ if id != self.id:
+ raise SwaggerError("Model id doesn't match name", c)
props = model_json.get('properties').items() or []
self.properties = [
Property(k).load(j, processor, context) for (k, j) in props]
@@ -372,13 +374,9 @@ class ApiDeclaration(Stringify):
self.apis = [
Api().load(j, processor, context) for j in api_json]
models = api_decl_json.get('models').items() or []
- self.models = OrderedDict(
- (k, Model().load(j, processor, context)) for (k, j) in models)
+ self.models = [
+ Model().load(k, j, processor, context) for (k, j) in models]
- for (name, model) in self.models.items():
- c = list(context).append('model = %s' % name)
- if name != model.id:
- raise SwaggerError("Model id doesn't match name", c)
return self