Skip to content

Copilot backlog handling: Fix authorIdauthor route parameter name mismatch in custom-model-binding article#36793

Merged
wadepickett merged 6 commits intomainfrom
copilot/fix-authorid-route-parameter
Feb 26, 2026
Merged

Copilot backlog handling: Fix authorIdauthor route parameter name mismatch in custom-model-binding article#36793
wadepickett merged 6 commits intomainfrom
copilot/fix-authorid-route-parameter

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

  • Fix authorId → author route parameter name mismatch in article text (both moniker sections)
  • Update ms.date metadata to 02/23/2026
  • Add ai-usage: ai-assisted metadata to frontmatter
Original prompt

This section details on the original issue you should resolve

<issue_title>Possible error in route parameter name "authorId"</issue_title>
<issue_description>I didn't understand why the example in "Custom model binder sample" section employed "authorId" route template parameter whereas action method's signature awaits parameter named "author":

[HttpGet("get/{authorId}")]
public IActionResult Get(Author author)
{
    if (author == null)
    {
        return NotFound();
    }
    
    return Ok(author);
}

I downloaded source files from the link provided in the abstract, ran them with the Aid of Visual Studio 2017 v.15.9 and noticed that this endpoint didn't work as the bindingContext.ModelName was equal to "".
When I renamed the route variable from "authorId" to "author" the endpoint started to work. This is how action method looks after renaming:

[HttpGet("get/{author}")]
public IActionResult Get(Author author)
{
    return Ok(author);
}

Could you possibly update this article if there is an error with route parameter naming?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Comments on the Issue (you are @copilot in this section)

@brunolins16 I had a long discussion about this doc, specifically the polymorphic binder sample, and indeed the docs are confusing and not clear about binding from body.

#26626

Related to usage of author or authorId the first example looks wrong should be author, in the route, while the second example explicit talks about a scenario where we want to keep the parameter name and a different route parameter name.

I can send an PR with a quick fix while we decided to improve the doc here. </comment_new>
<comment_new>@wadepickett

🤖 AI Triage Summary

📌 Note to community: This is an automated preliminary analysis to help our documentation team quickly review, determine scope and prioritize this issue. This report is not a resolution or answer to your question—it's an internal triage tool that identifies potentially relevant docs, code samples, and versions to look into. A team member will review this issue and respond. Thank you for your contribution!


This preliminary assessment report was run by: @wadepickett
Date: 2026-02-23
Issue: 10341
Model: GitHub Copilot


Issue Analysis: Route Parameter Name Mismatch in Custom Model Binder Sample

✅ Issue Validation

Status: Valid and actionable

📋 Issue Summary

The issue reports a mismatch between the route template parameter name and the action method parameter name in the "Custom model binder sample" section of the Custom Model Binding article. The original documentation showed [HttpGet("get/{authorId}")] with a method signature of Get(Author author), causing bindingContext.ModelName to be empty and the model binder to fail.

The code sample files have since been corrected — both the 3.x and 2.x BoundAuthorsController.cs files now use {author} in the route template, matching the action parameter name. However, the article's explanatory text still contains references to authorId as the "default" name, which is inconsistent with the corrected samples and creates confusion for readers.

Multiple community members and Microsoft contributors confirmed the issue:

  • @brunolins16 (Member) confirmed in Oct 2022: "the first example looks wrong should be author in the route" and offered to send a PR.
  • @mkArtakMSFT (Contributor) agreed the default guidance should name the route parameter to match the model action parameter.
  • This issue is tracked in container issue #16319.
  • Related issue: #26626 (Polymorphic model binding limitations).

📁 Potentially Affected Files

These files have been identified as possibly related to this issue and may need review.

File Path Lines Section
Main article [aspnetcore/mvc/advanced/custom-model-binding.md](https://github.com/dotnet/AspNetCore.Docs/blob/87dab80208cfcc3e51da1e0684a833127c385447/aspnetcore/mvc/ad...

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
aspnetcore/mvc/advanced/custom-model-binding.md Custom Model Binding in ASP.NET Core

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix route parameter name for author in action method Fix authorIdauthor route parameter name mismatch in custom-model-binding article Feb 23, 2026
Copilot AI requested a review from wadepickett February 23, 2026 18:01
@wadepickett wadepickett marked this pull request as ready for review February 23, 2026 18:01
@wadepickett
Copy link
Copy Markdown
Contributor

@copilot, ai-usage: ai-assisted metadata is not present in the frontmatter of the article. Per the copilot-instructions: "Metadata ai-usage: ai-assisted if any AI assistance was used." Since this PR was authored by Copilot (AI), this metadata should arguably be added. Please add it.

…tter

Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 23, 2026

@copilot, ai-usage: ai-assisted metadata is not present in the frontmatter of the article. Per the copilot-instructions: "Metadata ai-usage: ai-assisted if any AI assistance was used...

Added ai-usage: ai-assisted to the frontmatter in commit 527de73.

Edit pass on AI gen content for the PR.  Clarified a few sectons and updated to latest standardization on notes and few others from the original doc.
Copy link
Copy Markdown
Contributor

@wadepickett wadepickett left a comment

Choose a reason for hiding this comment

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

Approved after making some correctons and clarifications.

@wadepickett wadepickett changed the title Fix authorIdauthor route parameter name mismatch in custom-model-binding article Freshness: Fix authorIdauthor route parameter name mismatch in custom-model-binding article Feb 23, 2026
@wadepickett wadepickett changed the title Freshness: Fix authorIdauthor route parameter name mismatch in custom-model-binding article Copilot backlog handling: Fix authorIdauthor route parameter name mismatch in custom-model-binding article Feb 23, 2026
Fixes per review feedback.
@wadepickett wadepickett self-requested a review February 26, 2026 21:17
@wadepickett wadepickett merged commit a56e782 into main Feb 26, 2026
4 checks passed
@wadepickett wadepickett deleted the copilot/fix-authorid-route-parameter branch February 26, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible error in route parameter name "authorId"

3 participants