-
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
UnmappedMemberHandling not working with Microsoft.AspNetCore.OpenApi #57981
Comments
@JTeeuwissen Thanks for filing this issue! I've included a bug fix for this in a PR I'm working to address other feedback in the area. The fix for this should ship in .NET 9. Once the PR is merged, you should be able to access preview builds of the package to access this fix. I can share instructions on how to do that once it ships if you're interested in using the preview bits. |
* Fix JsonUnmappedMemberHandling attribute handling to close #57981 * Fix enum handling for MVC actions to close #57979 * Fix self-referential schema handling to close #58006 * Fix concurrent request handling for OpenAPI documents (#57972) * fix: Allow concurrent requests * test: Update test * test: Use Parallel.ForEachAsync * feat: Use valueFactory overload * feat: Pass valueFactory directly * Harden self-referencing schema ID check --------- Co-authored-by: Justin Lampe <xC0dex@users.noreply.github.com>
* Fix JsonUnmappedMemberHandling attribute handling to close #57981 * Fix enum handling for MVC actions to close #57979 * Fix self-referential schema handling to close #58006 * Fix concurrent request handling for OpenAPI documents (#57972) * fix: Allow concurrent requests * test: Update test * test: Use Parallel.ForEachAsync * feat: Use valueFactory overload * feat: Pass valueFactory directly * Harden self-referencing schema ID check --------- Co-authored-by: Justin Lampe <xC0dex@users.noreply.github.com>
@JTeeuwissen The fix for this has landed in nightly package version You'll need to use the following
And make sure that you have a reference to the nightly dotnet9 feed in your
Are you able to verify the fix on your end? |
[JsonUnmappedMemberHandling(JsonUnmappedMemberHandling.Disallow)] seems to work but builder.Services.ConfigureHttpJsonOptions(options =>
options.SerializerOptions.UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow); still seemingly does nothing. |
… (#58096) * Fix JsonUnmappedMemberHandling attribute handling to close #57981 * Fix enum handling for MVC actions to close #57979 * Fix self-referential schema handling to close #58006 * Fix concurrent request handling for OpenAPI documents (#57972) * fix: Allow concurrent requests * test: Update test * test: Use Parallel.ForEachAsync * feat: Use valueFactory overload * feat: Pass valueFactory directly * Harden self-referencing schema ID check --------- Co-authored-by: Justin Lampe <xC0dex@users.noreply.github.com>
Is there an existing issue for this?
Describe the bug
In response to: #56318 (comment)
JsonUnmappedMemberHandling.Disallow
does not seem to work.If I enable it for this object
I get
or an exception, depending on the way of configuration.
Expected Behavior
I expect to see
Steps To Reproduce
Exceptions (if any)
presumably because additional properties is expected to be an object, and not
False
..NET Version
9.0.100-rc.1.24452.12
Anything else?
Something like the transformer below provides the expected behavior for my test cases
The text was updated successfully, but these errors were encountered: