-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-rdg
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
There are a number of ways to make it unnecessary to pass an argument corresponding to a given parameter. We should think about what we want to do in these scenarios with RDG.
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/{purple:int}", HandleRequest);
app.Run();
static string HandleRequest(int purple, int orange = 1) => "Hello World!";
static string HandleRequest(int purple, [System.Runtime.InteropServices.OptionalAttribute] int orange) => "Hello World!";
static string HandleRequest(int purple, params int[] orange) => "Hello World!";
Describe the solution you'd like
I see that parameters can't already be flagged as optional:
// Endpoint Parameter: purple (Type = int, IsOptional = False, IsParsable = True, Source = RouteOrQuery)
Maybe we just need to recognize more forms of optionality?
Additional context
No response
mitchdenny
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.feature-rdg