dotnet / dotnet/aspnetcore

MVC App with nullable return type should include 204 No Content response

Open
#58,680 1 comment 2 reactions 0 assignees View on GitHub
area-mvc feature-openapi
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

The MVC Framework converts a 200 response with "null" response body into a 204 No Content response. Currently only the 200 response is shown in the generated OpenAPI.

### Expected Behavior

When the return type of the action method is nullable, the operation should also define a 204 response.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version

9.0.100-rc.1.24452.12

### Anything else?

Discovered while investigating #58617

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.