title: Import OpenAPI Document or JSON during Swagger Generation
body: <p>I have a small program that takes in an assembly and produces all relevant <code>OpenApiDocument</code>.  Now, my question is, can this be imported into Swagger?  I know you can add filters for modifying the documents after they have been created, but I am wondering if you can give Swagger the documents and circumvent the auto-generation.</p>
  
  <p>Inside of the <code>IDocumentFilter</code> it allows you to modify the <code>OpenApiDocument</code> that Swagger creates, but I would like to use my own <code>OpenApiDocument</code>.</p>
  
  <pre><code>  public interface IDocumentFilter
    {
        void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context);
    }
  </code></pre>
  
  <p>Here is where I want to configure Swagger to use the predefined <code>OpenApiDocument</code>:</p>
  
  <pre><code> public void ConfigureServices(IServiceCollection services)
   {
       services.AddSwaggerGen(setupAction =&gt; TODO);
   }
  
   public void Configure(IApplicationBuilder app, IApiVersionDescriptionProvider provider)
   {
   }
  </code></pre>
  
  <p>Here are the publicly available methods that I want to utilize in the API startup when configuring Swagger:</p>
  
  <pre><code> public static IEnumerable&lt;OpenApiDocument&gt; CreateDocuments(this Assembly assembly, string title, string description, string name, string email)
   {
        return ControllerInfo.FindControllers(assembly)
            .GroupBy(controller =&gt; controller.Version)
            .OrderBy(group =&gt; group.Key)
            .Select(group =&gt; CreateDocument(group.Key, group, title, description, name, email));
   }
  
   public static string ToJson(this OpenApiDocument document)
   {
       using var outputString = new StringWriter();
       document.SerializeAsV3(new OpenApiJsonWriter(outputString));
       return outputString.ToString();
   }
  </code></pre>