We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swashbuckle.AspNetCore and Swashbuckle.AspNetCore.Newtonsoft of version 6.8.1
I have created a controller and the web api method as below,
[ApiController] public class CustomApiController : Microsoft.AspNetCore.Mvc.Controller { [HttpPost] [Route("api/custom/search")] public JsonResult CustomSearch(CustomSearchRequest request) { .... .... return JsonResult(object) } }
In Startup.cs
ConfigureServices Method:
services.AddEndpointsApiExplorer(); services.AddSwaggerGen(options => { options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); });
In Configure method:
app.UseSwagger(); app.UseSwaggerUI();
app.UseEndpoints(endpoints => { endpoints.MapControllerRoute(name: "Default", pattern: "{controller}/{action}/{id?}"); // Default controllers endpoints.MapControllers(); // Attribute Routing endpoints.MapControllerRoute( name: "CustomSearch", pattern: "api/custom/search", defaults: new { controller = "CustomApi", action = "CustomSearch" } ); }
The API endpoint is not shown in swagger UI
It shows all other APIs from the library. The custom API needs to be listed in the Swagger UI.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
VERSION:
Swashbuckle.AspNetCore and Swashbuckle.AspNetCore.Newtonsoft of version 6.8.1
STEPS TO REPRODUCE:
I have created a controller and the web api method as below,
[ApiController]
public class CustomApiController : Microsoft.AspNetCore.Mvc.Controller
{
[HttpPost]
[Route("api/custom/search")]
public JsonResult CustomSearch(CustomSearchRequest request)
{
....
....
return JsonResult(object)
}
}
In Startup.cs
ConfigureServices Method:
services.AddEndpointsApiExplorer();
services.AddSwaggerGen(options =>
{
options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
});
In Configure method:
app.UseSwagger();
app.UseSwaggerUI();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(name: "Default", pattern: "{controller}/{action}/{id?}"); // Default controllers
endpoints.MapControllers(); // Attribute Routing
endpoints.MapControllerRoute(
name: "CustomSearch",
pattern: "api/custom/search",
defaults: new { controller = "CustomApi", action = "CustomSearch" }
);
}
EXPECTED RESULT:
The API endpoint is not shown in swagger UI
ACTUAL RESULT:
It shows all other APIs from the library. The custom API needs to be listed in the Swagger UI.
The text was updated successfully, but these errors were encountered: