-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Microsoft.AspNetCore.Mvc.JsonOptions uses default instead of OC JOptions settings #16831
Comments
@wAsnk feel free to submit a PR |
If I'll have spare time I'll do it and if someone else won't do it in the meantime. |
I will submit a PR tonight |
I am not sure it is the best idea to change the global JsonOptions for OC project as it could impact users negatively. In the minimal API where you are returning content item, I would just return the result differently. instead of returning Same goes to here: https://github.com/OrchardCMS/OrchardCore/blob/main/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/DeleteEndpoint.cs#L47 and Also, the |
@wAsnk can you please share with us a content item that caused an exception in the minimalApi? It would be great if you have a repo to ensure it is properly fixed. |
@MikeAlhayek I think setting globally the JsonOptions should be either for both or neither. But neither looks like the better solution. Btw this wasn't my root problem, it was just a sidequest for me apparently.... My original problem was that I had a |
Thanks @wAsnk I also added a default output formatter to provide a way to deserialize Document and Entity by default. |
Fixed by #16837. |
Describe the bug
Only
Microsoft.AspNetCore.Http.Json.JsonOptions
is configured here with the OC Json settings, whileMicrosoft.AspNetCore.Mvc.JsonOptions
is kept as default, causing not minimal Apis using the defaultMicrosoft.AspNetCore.Mvc.JsonOptions
during model binding deserialization.Expected behavior
Both
JsonOption
s should use the same settings, a similar configuration merge should be done forMicrosoft.AspNetCore.Mvc.JsonOptions
to ensure same behavior.The text was updated successfully, but these errors were encountered: