You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Columns not in the model cause Patch based on NewtonsoftJson to crash #51
When you send a json to patch, when the json has fields missing from the model, when it is a class, the exception "System.InvalidOperationException : Sequence contains no matching element" is thrown.
To reproduce it, go to the unit test Morcatko.AspNetCore.JsonMergePatch.Tests.NewtonsoftJson.Patching.Attributes.CannotPatchSubObject and change
"{'obj_property': { 'id': 3 }}");
to
"{'obj_other_property': { 'id': 3 }}");
I tracked it down to Morcatko.AspNetCore.JsonMergePatch.Internal.ReflectionHelper.GetJsonProperty which calls Single on properties list and the list is missing the specified property.
I think it would be useful to be able to patch a json with a document that has a random json inside - as when you have a document DB as a storage, you don't always need to have a strongly typed structure to store it.
Activity
Morcatko commentedon Apr 29, 2022
I guess it makes sense to ignore it in some cases. I think it should be optional - fail by default, but option to ignore it.
Feel free to create a PR.