Incorrect Open API doc generated when branching request execution pipeline
- 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
When I branch request execution pipeline like this:
```csharp
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapOpenApi();
app.Map(
"/branch1",
b =>
{
b.UseRouting();
b.UseEndpoints(e => e.MapGet("say-hello", () => "Hello from branch1"));
}
);
app.Map(
"/branch2",
b =>
{
b.UseRouting();
b.UseEndpoints(e => e.MapGet("say-hello", () => "Hello from branch2"));
}
);
app.Run();
```
The generated Open API doc contains only one path instead of two and with the wrong path:
```json
{
"openapi": "3.0.1",
"info": {
"title": "TestApplication | v1",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:5013"
}
],
"paths": {
"/say-hello": {
"get": {
"tags": [
"TestApplication"
],
"responses": {
"200": {
"description": "OK",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
},
"components": { },
"tags": [
{
"name": "TestApplication"
}
]
}
```
### Expected Behavior
I expect the Open API document to contain two paths one for each branch.
### Steps To Reproduce
https://github.com/alinia/test-application/
### Exceptions (if any)
_No response_
### .NET Version
9.0.102
### Anything else?
.NET SDK:
Version: 9.0.102
Commit: cb83cd4923
Workload version: 9.0.100-manifests.43af17c7
MSBuild version: 17.12.18+ed8c6aec5
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.3
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/9.0.102/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.1
Architecture: arm64
Commit: c8acea2262
.NET SDKs installed:
6.0.428 [/usr/local/share/dotnet/sdk]
9.0.102 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Contributor guide
Assessment
This issue has not been assessed yet.