Skip to content

[OpenApi] xml doc not used when endpoint delegate is async #61875

Closed
@jasonswearingen

Description

@jasonswearingen

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

endpoints with async handlers do not have the xml doc properly applied to the openapi .json output.

I define endpoints like this:

RouteGroupBuilder dashboardEndpoints = app.MapGroup("/dashboard/v1");
dashboardEndpoints.MapGet("Test", Test);
dashboardEndpoints.MapGet("TestAsync", TestAsync);

with handlers defined as:

/// <summary>
/// Test summary
/// </summary>
/// <returns>Test return</returns>
public static IResult Test()
{
    return TypedResults.Conflict();
}
/// <summary>
/// TestAsync summary
/// </summary>
/// <returns>TestAsync return</returns>
public static async Task<IResult> TestAsync()
{
    return TypedResults.Conflict();
}

This results in the following openapi .json contents. as you can see, the "TestAsync summary" message is not output

"/dashboard/v1/Test": {
    "get": {
    "tags": [
        "DashboardApiInit"
    ],
    "summary": "Test summary",
    "responses": {
        "200": {
        "description": "OK"
        }
    }
    }
},
"/dashboard/v1/TestAsync": {
    "get": {
    "tags": [
        "DashboardApiInit"
    ],
    "responses": {
        "200": {
        "description": "OK"
        }
    }
    }
},

Expected Behavior

async methods should have xml docs utilized properly

Steps To Reproduce

see above

Exceptions (if any)

none

.NET Version

10.0.100-preview.3.25201.16

Anything else?

Microsoft.AspNetCore.OpenApi v10.0.0-preview.3.25172.1

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions