OData / OData/AspNetCoreOData

Report invalid routes as errors (optionally?) [enhancement]

Open
#321 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

followup
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

When an entire controller is marked with [ODataAttributeRouting], I expect invalid OData routes to be clearly reported, not a warning buried in the log files. I would be fine opting into this with a parameter to the attribute like UseStrict=True, setting ODataOptions.EnableStrictRouting, or something.

I expect this would throw an exception on template parsing errors, and attribute routes that fail to match a prefix. Maybe even an error for any route on such a controller that is not an OData route, and does not have [ODataIgnored], no matter what the reason.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Microsoft.AspNetCore.OData/Routing/Conventions/AttributeRoutingConvention.cs around line 196, where template parsing errors are mentioned. Trace how invalid templates, prefix mismatches, and non-OData routes are currently reported. Define the opt-in behavior and verify that each intended invalid-route case is surfaced as an error rather than only a warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.