Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer to warn against using dynamic objects in WebAPI actions #88

Open
yaakov-h opened this issue Aug 20, 2019 · 0 comments
Open

Analyzer to warn against using dynamic objects in WebAPI actions #88

yaakov-h opened this issue Aug 20, 2019 · 0 comments
Assignees

Comments

@yaakov-h
Copy link
Member

yaakov-h commented Aug 20, 2019

Using weakly typed objects such as JObject (from Newtonsoft.Json) in a WebAPI should result in an error or warning.

Example:

[HttpPost]
[Route("eTailAPI/CarrierBooking/BookLastMileCarrier")]
public string BookLastMileCarrier([FromBody] JObject data)
{
    // ...
}

Any method with [HttpPost], [HttpPut] etc. attributes in a subclass of Controller (ASP.NET MVC / ASP.NET Core) or ApiController (ASP.NET WebAPI) should be detected.

Possibly also any public instance method even without those attributes.

The error should span the parameter declaration.

No code-fix applicable.

Corresponding WTG Work Item: WI00253834

@yaakov-h yaakov-h added this to the 2.0.8 milestone Aug 20, 2019
@yaakov-h yaakov-h self-assigned this Aug 20, 2019
@brian-reichle brian-reichle removed this from the 2.0.8 milestone Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants