I expect this couple routes to be hidden because of ApiExplorerSettings(IgnoreApi=true)
app.MapPost("/login", [ApiExplorerSettings(IgnoreApi=true)] async (string returnUrl, HttpContext context, [FromServices] SignInManager<LiteDbUser> signInManager) =>
{
var form = context.Request.Form;
var result = await signInManager.PasswordSignInAsync(form["username"], form["password"], false, false);
return result.Succeeded ? Results.Redirect(returnUrl ?? "/health") : Results.Redirect("/login");
});
app.MapGet("/logout", [ApiExplorerSettings(IgnoreApi=true)] async ([FromServices] SignInManager<LiteDbUser> signInManager) =>
{
await signInManager.SignOutAsync();
return Results.Redirect("/login");
});
but it seems there is no effect
Is this a bug or feature?
It seems there's not way to use attributes in minimal API. But you could try add.ExcludeFromDescription()
to hide an API.
app.MapGet("/test", string () => { return "test success"; }
).ExcludeFromDescription();