[asterisk-commits] dlee: trunk r386461 - /trunk/rest-api-templates/swagger_model.py
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 24 16:43:19 CDT 2013
Author: dlee
Date: Wed Apr 24 16:43:16 2013
New Revision: 386461
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386461
Log:
Oops. Mustache doesn't like dictionaries
Modified:
trunk/rest-api-templates/swagger_model.py
Modified: trunk/rest-api-templates/swagger_model.py
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api-templates/swagger_model.py?view=diff&rev=386461&r1=386460&r2=386461
==============================================================================
--- trunk/rest-api-templates/swagger_model.py (original)
+++ trunk/rest-api-templates/swagger_model.py Wed Apr 24 16:43:16 2013
@@ -297,9 +297,11 @@
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 @@
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)
-
- 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)
+ self.models = [
+ Model().load(k, j, processor, context) for (k, j) in models]
+
return self
More information about the asterisk-commits
mailing list