-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
SystemTextJsonValidationMetadataProvider passes null
values to the JsonNamingPolicy
#47835
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsDescriptionCompared to JsonCamelCaseNamingPolicy which has a check for IsNullOrEmpty on the name, new newly added support for snake_case and kebab-case doesn't have this. Reproduction StepsSend in an array of strings to the endpoint and it'll crash.
Expected behaviorReturn the passed in string array Actual behavior
Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Tagging @dotnet/aspnet-team since the stacktrace seems to suggest that MVC components are passing |
Fixing what appears to be a negation bug causing null names to be passed to the underlying `JsonNamingPolicy`.
The issue is due to the SystemTextJsonValidationMetadataProvider class in aspnetcore is suppressing null warnings for aspnetcore/src/Mvc/Mvc.Core/src/ModelBinding/Metadata/SystemTextJsonValidationMetadataProvider.cs Line 60 in 01ee72d
I've posted a PR that should fix the issue. |
Reopening and transfering the issue, since it's caused by an aspnetcore component. |
null
values to the JsonNamingPolicy
Description
Compared to JsonCamelCaseNamingPolicy which has a check for IsNullOrEmpty on the name, new newly added support for snake_case and kebab-case doesn't have this.
Tried to use the new snake_case naming policy with SystemTextJsonValidationMetadataProvider which crashes when you pass in an array.
Reproduction Steps
Send in an array of strings to the endpoint and it'll crash.
Expected behavior
Return the passed in string array
Actual behavior
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: