Add support for additionalProperties when printing schema'd objects.
Reviewed in http://codereview.appspot.com/6348104/.
diff --git a/apiclient/schema.py b/apiclient/schema.py
index ddcd670..cfed7de 100644
--- a/apiclient/schema.py
+++ b/apiclient/schema.py
@@ -244,9 +244,13 @@
if stype == 'object':
self.emitEnd('{', schema.get('description', ''))
self.indent()
- for pname, pschema in schema.get('properties', {}).iteritems():
- self.emitBegin('"%s": ' % pname)
- self._to_str_impl(pschema)
+ if 'properties' in schema:
+ for pname, pschema in schema.get('properties', {}).iteritems():
+ self.emitBegin('"%s": ' % pname)
+ self._to_str_impl(pschema)
+ elif 'additionalProperties' in schema:
+ self.emitBegin('"a_key": ')
+ self._to_str_impl(schema['additionalProperties'])
self.undent()
self.emit('},')
elif '$ref' in schema: