Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
ASP.NET Core - when a minimal endpoint is registered in another project/assembly, the Microsoft.Extensions.ApiDescription.Server
document generation does not run in some cases.
builder.MapGet("MyEndpoint1", () => "Hello, World!").WithName("MyEndpoint");
It will run if e.g. it is changed from .MapGet to .MapPost
It will not run if the endpoint path is changed from MyEndpoint1
to MyEndpoint2
.
Interestingly, it will run if the endpoint path changes, if the endpoint is defined in the ASP.NET Core project containing the Microsoft.Extensions.ApiDescription.Server
reference.
Expected Behavior
OpenApi document generation runs whenever the registered endpoints have changed, in referenced projects.
I understand that this may be hard to fix, as the precise details of the mapped endpoints cannot be determined before building, and may be harder to determine across assemblies. Happy for this to be closed if nothing can be improved :)
Steps To Reproduce
Repro: https://github.com/MattParkerDev/Repro.AspnetCoreOpenApiDocBuild
Using .NET 10 preview 4
- Build sln once
- Observe WebApi.json - endpoint path is
MyEndpoint1
- Update the path in
ClassLibContainingEndpoint.Endpoints
- Observe the path has not changed in WebApi.json, and that the document generation did not run (
dotnet build -tlp:v=d
ordotnet build --tl:off
to see tool invocation in logs) - Update the endpoint path in
Program.cs
- Observe that the document is generated
Exceptions (if any)
No response
.NET Version
10.0.100-preview.4.25258.110
Anything else?
No response