def _parseSchema(schema, schema_store):
 result = {}
 schema = resolveSchema(schema, schema_store)
 def fill_in_result(object_schema):
  result['properties'] = {}
  for (prop, propSchema) in object_schema[u'properties'].iteritems():
   attr = result['properties'][prop] = {}
   attr['title'] = propSchema['title']
   attr['description'] = prepare_docstring(propSchema['description'])
   attr['required'] = (prop in object_schema.get('required', []))
   attr['type'] = propSchema['type']
 if (schema[u'type'] == u'object'):
  result['type'] = 'object'
  fill_in_result(schema)
 elif (schema[u'type'] == u'array'):
  result['type'] = 'array'
  child_schema = schema[u'items']
  if (child_schema.get('type') == 'object'):
   fill_in_result(child_schema)
  else:
   raise Exception('Only single object type allowed in an array.')
 else:
  raise Exception('Non-object/array top-level definitions not supported.')
 return result

def _parseSchema ( schema , schema_store ) : result = { } schema = resolveSchema ( schema , schema_store ) def fill_in_result ( object_schema ) : result [ 'properties' ] = { } for ( prop , propSchema ) in object_schema [ u'properties' ] . iteritems ( ) : attr = result [ 'properties' ] [ prop ] = { } attr [ 'title' ] = propSchema [ 'title' ] attr [ 'description' ] = prepare_docstring ( propSchema [ 'description' ] ) attr [ 'required' ] = ( prop in object_schema . get ( 'required' , [ ] ) ) attr [ 'type' ] = propSchema [ 'type' ] if ( schema [ u'type' ] == u'object' ) : result [ 'type' ] = 'object' fill_in_result ( schema ) elif ( schema [ u'type' ] == u'array' ) : result [ 'type' ] = 'array' child_schema = schema [ u'items' ] if ( child_schema . get ( 'type' ) == 'object' ) : fill_in_result ( child_schema ) else : raise Exception ( 'Only single object type allowed in an array.' ) else : raise Exception ( 'Non-object/array top-level definitions not supported.' ) return result
parse a json schema and return some information to document it .