RicoSuter/NSwag

ReDoc hides document title in browser

Open

#2796 aperta il 15 apr 2020

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)C# (1189 fork)batch import
help wantedtype: enhancement

Metriche repository

Star
 (6291 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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?

Guida contributor