Aurelia validation Assistance with custom rule

I want to be able to use validation to check if my form object - in this case “client” has any changes before it is sent back to the API.

From the API I retrieve a “client” object then set another object equal to it. Then when the user clicks the "save button I wanted validation to do simple comparison and if they are different (someone has changed a value) return true - otherwise there are no changes and no reason to send to the API.

When I retrieve the client from the API I also set another object to the same value so they are identical.

When the user clicks on the save button I want validation to equate the two objects.

My problem is that I am unsure if my custom validation is written correctly. This is how it is now.

(value, obj, fetchedEntity) =>
    fetchedEntity != value,
'No changes detected'


I know I written the valdation rule for this incorrectly and would like to know how I should instead write it.

I have a parameter “a” which is of the type ClientDetails. What I want is for the validation to use the entire client object and not one field.

How do I write a custom rule correctly to compare objects and how would I use that custom rule where I pass the entire object to the rule.


Have a look at the docs