-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.cost: SWill take up to 2 days to completeWill take up to 2 days to completeenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-model-bindingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labelsseverity-minorThis label is used by an internal toolThis label is used by an internal tool
Milestone
Description
I generated a new empty WebApplication, .NET Core 3.1 and added 8.0 and enable to my CSPROJ.
Then I added the following controller code:
[ApiController]
[Route("api/[controller]")]
public class CountriesController : ControllerBase
{
// GET: api/<controller>
[HttpGet]
public IEnumerable<string> GetByLanguage(string language="nl")
{
Console.WriteLine(language);
return new[] { "Nederland", "Duitsland", "Amerika"};
}
}
When I call this endpoint without a language parameter I get a 400 BadRequest with the followin g ProblemDetail:
type: "https://tools.ietf.org/html/rfc7231#section-6.5.1",
title: "One or more validation errors occurred.",
status: 400,
traceId: "|a897675b-4df1a9d8146c8919.",
errors: {
language: [
"The language field is required."
]
}
}
When I remove the [ApiController] attribute I get the normal optional parameter behaviour once more, OR when I remove the Nullable=enabled option from the CSPROJ.
svengeance, richardcox13 and huancz
Metadata
Metadata
Assignees
Labels
affected-fewThis issue impacts only small number of customersThis issue impacts only small number of customersbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.cost: SWill take up to 2 days to completeWill take up to 2 days to completeenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-model-bindingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labelsseverity-minorThis label is used by an internal toolThis label is used by an internal tool