dotnet / dotnet/aspnetcore

Analyzer: Warn when validation attribute is applied on minimal API parameter which is bound from service

Open
#67,586 0 comments 0 reactions 0 assignees View on GitHub
analyzer area-minimal feature-validation
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Today, we don't perform validation for minimal API parameters which the parameter is bound from service. We should have an analyzer to warn for silently skipped validation attributes in this case.

Alternatively, we could decide to run the validation.

### Describe the solution you'd like

Either let the validation run, or write an analyzer to warn on skipped validation.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named. Start by locating the minimal API parameter-binding and validation analyzer code, then reproduce a service-bound parameter with a validation attribute; the issue is done only after the intended behavior is decided and either validation runs or a warning is emitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.