Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add support for copy constructors to Microsoft.OpenApi.Models objects #832

Copy link
Copy link
@captainsafia

Description

@captainsafia
Issue body actions

As outlined in dotnet/aspnetcore#40676 and implemented in dotnet/aspnetcore#41238, we're introducing support for a new Microsoft.AspNetCore.OpenApi package that acts as a link between Microsoft.OpenApi and route handler endpoints.

This package exposes a WithOpenApi extension method that users can invoke on their endpoints to mutate the OpenApiOperation that we generate by default from the handler's MethodInfo with their own annotation. For example,

app.MapGet("/foo", () => {})
.WithOpenApi(generatedOperation => {
  generatedOperation.OperationId = "MadeByMe";
  return generatedOperation;
});

One of the things we thought would be compelling was support for a copy constructor for OpenApiOperation so that users can invoke the following and have their modification automatically merged into the generated operation.

app.MapGet("/foo", () => {})
.WithOpenApi(generatedOperation => new(generatedOperation) {
  OperationId = "MadeByMe"
});
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

priority:p1High priority but not blocking. Causes major but not critical loss of functionality SLA <=7daysHigh priority but not blocking. Causes major but not critical loss of functionality SLA <=7daystype:enhancementEnhancement request targeting an existing experienceEnhancement request targeting an existing experience

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.