Endpoints Not Visible in EndpointsApiExplorer
johnholliday opened this issue · comments
Declaring minimal API endpoints in a Carter module hides them from the EndpointsApiExplorer.
Does this sample app work for you?
https://github.com/CarterCommunity/Carter/blob/main/samples/CarterSample/Program.cs
…On Fri, 1 Sep 2023 at 04:58, John Holliday ***@***.***> wrote:
Declaring minimal API endpoints in a Carter module hides them from the
EndpointsApiExplorer.
—
Reply to this email directly, view it on GitHub
<#326>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZVJXBOA4JXVQHS2Q5BTDXYFMPDANCNFSM6AAAAAA4G7FVK4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
The problem is that the EndpointsApiExplorer requires literal path strings.
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Jonathan Channon ***@***.***>
Sent: Friday, September 1, 2023 5:39:14 PM
To: CarterCommunity/Carter ***@***.***>
Cc: John Holliday ***@***.***>; Author ***@***.***>
Subject: Re: [CarterCommunity/Carter] Endpoints Not Visible in EndpointsApiExplorer (Issue #326)
Does this sample app work for you?
https://github.com/CarterCommunity/Carter/blob/main/samples/CarterSample/Program.cs
On Fri, 1 Sep 2023 at 04:58, John Holliday ***@***.***> wrote:
Declaring minimal API endpoints in a Carter module hides them from the
EndpointsApiExplorer.
—
Reply to this email directly, view it on GitHub
<#326>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZVJXBOA4JXVQHS2Q5BTDXYFMPDANCNFSM6AAAAAA4G7FVK4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
—
Reply to this email directly, view it on GitHub<#326 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABIMPXCYD2TEZ6QWOBOVECDXYJIYFANCNFSM6AAAAAA4G7FVK4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
I don’t understand sorry
…On Fri, 1 Sep 2023 at 22:55, John Holliday ***@***.***> wrote:
The problem is that the EndpointsApiExplorer requires literal path
strings.
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Jonathan Channon ***@***.***>
Sent: Friday, September 1, 2023 5:39:14 PM
To: CarterCommunity/Carter ***@***.***>
Cc: John Holliday ***@***.***>; Author ***@***.***>
Subject: Re: [CarterCommunity/Carter] Endpoints Not Visible in
EndpointsApiExplorer (Issue #326)
Does this sample app work for you?
https://github.com/CarterCommunity/Carter/blob/main/samples/CarterSample/Program.cs
On Fri, 1 Sep 2023 at 04:58, John Holliday ***@***.***> wrote:
> Declaring minimal API endpoints in a Carter module hides them from the
> EndpointsApiExplorer.
>
> —
> Reply to this email directly, view it on GitHub
> <#326>, or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAAZVJXBOA4JXVQHS2Q5BTDXYFMPDANCNFSM6AAAAAA4G7FVK4>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
—
Reply to this email directly, view it on GitHub<
#326 (comment)>,
or unsubscribe<
https://github.com/notifications/unsubscribe-auth/ABIMPXCYD2TEZ6QWOBOVECDXYJIYFANCNFSM6AAAAAA4G7FVK4>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
—
Reply to this email directly, view it on GitHub
<#326 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAZVJU7HPDKMZM54WF4BIDXYJKWZANCNFSM6AAAAAA4G7FVK4>
.
You are receiving this because you commented.Message ID:
***@***.***>
The problem is not with Carter. The EndpointsApiExplorer cannot recognize paths that are declared with const or static strings. They have to be literal strings. In other words...
This works
public class ActorsModule : ICarterModule
{
public void AddRoutes(IEndpointRouteBuilder app)
{
app.MapGet("/actors", GetAllActors).WithName("GetActors");
}
}
This does not work. The Api explorer view will be empty.
public class ActorsModule : ICarterModule
{
public static string ActorsRoute = "/actors";
public void AddRoutes(IEndpointRouteBuilder app)
{
app.MapGet(ActorsRoute, GetAllActors).WithName("GetActors");
}
}