code: def _generate_openapi_object(document):
      
      parsed_url = urlparse.urlparse(document.url)
  
      swagger = OrderedDict()
  
      swagger['swagger'] = '2.0'
      swagger['info'] = OrderedDict()
      swagger['info']['title'] = document.title
      swagger['info']['description'] = document.description
      swagger['info']['version'] = document.version
  
      if parsed_url.netloc:
          swagger['host'] = parsed_url.netloc
      if parsed_url.scheme:
          swagger['schemes'] = [parsed_url.scheme]
  
      swagger['paths'] = _get_paths_object(document)
  
      return swagger
docs: Generates root of the Swagger spec.