Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ private void Visit(

// We don't want to append the **parameter** name when building a model name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update this comment as well to reflect the updated condition.

And correct me if I'm wrong, I think modelMetadata.ContainerType != null is responsible for appending a property name, so it prevents appending parameter name. But then the other check can append a parameter name but if and only if explicitly given via IModelNameProvider.

var newContainerName = containerName;
if (modelMetadata.ContainerType != null)
if (modelMetadata.ContainerType != null || !string.IsNullOrEmpty(bindingContext.BinderModelName))
{
newContainerName = GetName(containerName, bindingContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ public void GetApiDescription_ParameterDescription_FromQueryEmployee()
var description = Assert.Single(descriptions);
Assert.Single(description.ParameterDescriptions);

var id = Assert.Single(description.ParameterDescriptions, p => p.Name == "Name");
var id = Assert.Single(description.ParameterDescriptions, p => p.Name == "employee.Name");

@Youssef1313 Youssef1313 Aug 12, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if Employee class had a property that had [FromHeader("X-MyCustomHeader")]?

Are we prefixing this as well? And is it expected to be prefixed? Same question applies to FromRoute

In addition, let's make sure we have equivalent tests for both Mvc and minimal API, including tests directed for OpenAPI

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If no scenario here is applicable for minimal API (e.g, an analyzer warning is produced), feel free to skip the minimal API part here.

Assert.Same(BindingSource.Query, id.Source);
Assert.Equal(typeof(string), id.Type);
Comment on lines +1627 to 1629
}
Expand Down
Loading