code: def build_swagger(graph, ns, operations):
      
      base_path = graph.build_route_path(ns.path, ns.prefix)
      schema = swagger.Swagger(
          swagger="2.0",
          info=swagger.Info(
              title=graph.metadata.name,
              version=ns.version,
          ),
          consumes=swagger.MediaTypeList([
              swagger.MimeType("application/json"),
          ]),
          produces=swagger.MediaTypeList([
              swagger.MimeType("application/json"),
          ]),
          basePath=base_path,
          paths=swagger.Paths(),
          definitions=swagger.Definitions(),
      )
      add_paths(schema.paths, base_path, operations)
      add_definitions(schema.definitions, operations)
      try:
          schema.validate()
      except Exception:
          logger.exception("Swagger definition did not validate against swagger schema")
          raise
  
      return schema
docs: Build out the top-level swagger definition.