Skip to content

Incorrect Open API doc generated when branching request execution pipeline #60322

Open
@alinia

Description

@alinia

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I branch request execution pipeline like this:

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:

{
  "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

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions