3

I'm just starting with PATCH requests in Asp.NET core with JsonPatchDocument<TModel>.

This class has the cool feature that I can add Operations like:

patchDoc.Replace(i=>i.IntegerProperty, 3);
patchDoc.Replace(i=>i.AnotherProperty, "AnotherStringValue");

Now, I can send this to my Asp.Net service and get a nice JsonPatchDocument<TModel> deserialized into my controller method.

But I'd like to validate that, for instance, "AnotherStringValue" satisfies a certain Regex.

Is there anyway I can find all operations that pertain to a certain member expression, like for instance patchDoc.FindOperationsFor(i=>i.AnotherProperty)? Or is there a way to translate a member expression into a path string?

Volker
  • 1,753
  • 2
  • 18
  • 28

0 Answers0