Skip to content

Swagger Supporting UI Files Not Loading #1

@dwatson-seymour

Description

@dwatson-seymour

Hello,

When I cloned your project I found the UI never displayed in http://localhost:52530/docs/index.html?url=/docs/api-specification.json due to UseSpaStaticFiles.

I found changing the Startup.cs to call UseSwaggerUi3 before UseSpaStaticFiles resolved the problem:

       app.UseStaticFiles();
        // Register the Swagger generator and the Swagger UI middlewares
        // NSwage.MsBuild + adding automation config in GhostUI.csproj makes this part of the build step (updates to API will be handled automatically)
        app.UseOpenApi();
        app.UseSwaggerUi3(settings =>
        {
            settings.Path = "/docs";
            settings.DocumentPath = "/docs/api-specification.json";
        });

        app.UseSpaStaticFiles();
        app.UseRouting();

Not sure if that's the best workaround, but it worked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions