Skip to content

Microsoft.Extensions.ApiDescription.Server - Altering Endpoint defined in another project does not re-build document #62274

Open
@MattParkerDev

Description

@MattParkerDev

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

  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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPIfeature-openapi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions