0

My swagger is not updating the end points I deleted the controller but yet the case items are still showing on the swagger end point. The cases end point

services.AddSwaggerGen(c => {
            c.SwaggerDoc("v1", new OpenApiInfo { Title = "Warehouse Crm", Version = "v1" });
            //   c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
            //Expose XML comments in doc.
            c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme {
                Description =
                    "JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below.\r\n\r\nExample: \"Bearer 12345abcdef\"",
                Name = "Authorization",
                In = ParameterLocation.Header,
                Type = SecuritySchemeType.ApiKey,
                Scheme = "Bearer"
            });
            c.AddSecurityRequirement(new OpenApiSecurityRequirement
            {
                {
                    new OpenApiSecurityScheme
                    {
                        Reference = new OpenApiReference
                        {
                            Type = ReferenceType.SecurityScheme,
                            Id = "Bearer"
                        },
                        Scheme = "oauth2",
                        Name = "Bearer",
                        In = ParameterLocation.Header
                    },
                    new List<string>()
                }
            });
        });

The bit in blue has been deleted from the controllers so should not be there. The solution has been built and cleaned so no idea as to why its still showing in the ui

enter image description here

As you see here

enter image description here

Edit 3

My Configure section showing that I am using app.UseSwagger();

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
        if (env.IsDevelopment()) {
            app.UseDeveloperExceptionPage();
            app.UseDatabaseErrorPage();
        } else {
            app.UseExceptionHandler("/Home/Error");
            // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            app.UseHsts();
        }
        // Enable middleware to serve generated Swagger as a JSON endpoint.
        app.UseSwagger();
     
        // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
        // specifying the Swagger JSON endpoint.
        app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); });
        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseDeveloperExceptionPage();
        app.UseRouting();
        app.UseCors();
        app.UseAuthentication();
        app.UseAuthorization();
        if (env.IsDevelopment()) IdentityModelEventSource.ShowPII = true;


        app.UseEndpoints(endpoints => {
            endpoints.MapControllerRoute(
                "default",
                "{controller=Home}/{action=Index}/{id?}");
            endpoints.MapRazorPages();
        });
    }
}
c-sharp-and-swiftui-devni
  • 3,743
  • 4
  • 39
  • 100

0 Answers0