RicoSuter/NSwag

ReDoc hides document title in browser

Open

#2,796 创建于 2020年4月15日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)C# (6,291 star) (1,189 fork)batch import
help wantedtype: enhancement

描述

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?

贡献者指南