RicoSuter/NSwag

ReDoc hides document title in browser

Open

#2796 opened on Apr 15, 2020

View on GitHub
 (4 comments) (0 reactions) (0 assignees)C# (6,291 stars) (1,189 forks)batch import
help wantedtype: enhancement

Description

I set document.Title in ConfigureServices. But in browser page title (<title> tag) is "ReDoc"

public void ConfigureServices(IServiceCollection services)
{
    services.AddOpenApiDocument(document =>
    {
        document.DocumentName = "v1.2";
        document.Title = "VERSTA Open API";
        document.Version = "1.2";
        document.SchemaType = SchemaType.OpenApi3;
     });
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseOpenApi(s =>
    {
        s.DocumentName = "v1.2";
        s.Path = "/openapi/v1/swagger.json";
     });

     app.UseReDoc(options =>
     {
        options.Path = "/docs";
        options.DocumentPath = "/openapi/v1/swagger.json";
        options.TransformToExternalPath = (internalUiRoute, request) =>
        {
             if (internalUiRoute.StartsWith("/") && internalUiRoute.StartsWith(request.PathBase) == false)
             {
                  return request.PathBase + internalUiRoute;
             }
                  return internalUiRoute;
         };
     });
}

image

Do I something wrong to set page title with ReDoc or is there a way to specify It?

Contributor guide