dotnet / dotnet/aspnetcore

Microsoft.Extensions.ApiDescription.Server: Aspire Exec support

Open
#62,750 0 comments 2 reactions 0 assignees View on GitHub
area-commandlinetools feature-openapi
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Aspire recently merged [exec support](https://github.com/dotnet/aspire/pull/10240) (also see [here](https://github.com/dotnet/docs-aspire/issues/4026) for pending documentation). This allows tools (such as `dotnet ef`) to run in the context of the AppHost, exposing resources such as ConnectionStrings or environment variables.

I am currently using the `Microsoft.Extensions.ApiDescription.Server` package to generate OpenAPI documents at build-time. It would be great if we could have a way to enable `aspire exec` support for that. This would make the integration & adoption of the OpenAPI package much smoother for Aspire projects as it reduces discrepancies between build- and run-time document generation.

### Describe the solution you'd like

Not sure yet. Maybe something like a `` would work, that optionally prepends an `aspire exec --resource XY -- ...` to the `dotnet-getdocument` command. Resources could be provided via `` or similar.

Maybe there's a more clever way to think about this problem and it could be solved from Aspire or MSBuild entirely.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Microsoft.Extensions.ApiDescription.Server build-time dotnet-getdocument entry point and the Aspire exec support described in the linked Aspire pull request. Clarify how an Aspire resource and command context should be selected; done means build-time OpenAPI generation can run in Aspire context without discrepancies with runtime document generation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
backend-api-design, build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.