-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Steps to reproduce
Setup the hook like this on a service:
before: {
patch: [preventChanges(true, ['quotas'])]
}
Expected behavior
If quotas
is actually a nested object and I perform a patch like this using the mongo adapter service.patch(id, { 'quotas.members': 200 })
, I expect the hook to raise an error.
Actual behavior
The hook does not filter data properties targetting a prevented field when using dot notation, neither raises an error.
It is not necessarily a bug as one could probably avoid this by registering all available nested properties like this:
before: {
patch: [preventChanges(true, ['quotas.members'])]
}
However, in some cases, it is not possible to know all properties upfront. Moreover, it seems to me a convenient way (or shortcut) to discard all properties of a nested object.
We implemented it on our side for now if it can help and seems relevent for this module as well. If so we could try to make a PR but welcome any feedback first.