OpenApi analyzers do not recognize returns in ternary expressions
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
I enabled web API analyzers per [the docs](https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/analyzers) and was surprised to see no output. Long story short, the analyzer does not recognize returns in ternary expressions. All my controllers return like this:
```C#
return result != null ? Ok(result) : NotFound();
```
If I change this to an `if` expression, the analyzer highlights `NotFound()` and emits a warning as expected. But even then, it still does not warn that I have not documented what `Ok()` returns. I'm not sure if it's supposed to.
This may have been the issue underlying #26341.
### Expected Behavior
_No response_
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
6.0.400
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.