Microsoft.Extensions.ApiDescription.Server - Altering Endpoint defined in another project does not re-build document
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [x] 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.
```csharp
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
1. Build sln once
2. Observe WebApi.json - endpoint path is `MyEndpoint1`
3. Update the path in `ClassLibContainingEndpoint.Endpoints`
4. Observe the path has not changed in WebApi.json, and that the document generation did not run (`dotnet build -tlp:v=d` or `dotnet build --tl:off` to see tool invocation in logs)
5. Update the endpoint path in `Program.cs`
6. Observe that the document **is** generated
### Exceptions (if any)
_No response_
### .NET Version
10.0.100-preview.4.25258.110
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.