{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/bolt/issues/154","repository_url":"https://api.github.com/repos/firebase/bolt","labels_url":"https://api.github.com/repos/firebase/bolt/issues/154/labels{/name}","comments_url":"https://api.github.com/repos/firebase/bolt/issues/154/comments","events_url":"https://api.github.com/repos/firebase/bolt/issues/154/events","html_url":"https://github.com/firebase/bolt/issues/154","id":162339234,"number":154,"title":"Apply validation rules on remove","user":{"login":"brommer","id":4571686,"avatar_url":"https://avatars.githubusercontent.com/u/4571686?v=3","gravatar_id":"","url":"https://api.github.com/users/brommer","html_url":"https://github.com/brommer","followers_url":"https://api.github.com/users/brommer/followers","following_url":"https://api.github.com/users/brommer/following{/other_user}","gists_url":"https://api.github.com/users/brommer/gists{/gist_id}","starred_url":"https://api.github.com/users/brommer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brommer/subscriptions","organizations_url":"https://api.github.com/users/brommer/orgs","repos_url":"https://api.github.com/users/brommer/repos","events_url":"https://api.github.com/users/brommer/events{/privacy}","received_events_url":"https://api.github.com/users/brommer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-26T18:03:08Z","updated_at":"2016-07-09T23:31:32Z","closed_at":null,"body":"I know that validation rules intentionally are not applied during remove(). However, I am running into following issue because of that. \r\n\r\nI need multi path updates to ensure consistency of my data. So I am writing to \"/a\" and \"/b\" within one update() command, which means I am sending an object to \"/\" which includes \"/a\" and \"/b\". On a write, my rules are checking the consistency of the data as well. So it is not possible to write to \"/a\" first and then to \"/b\". \r\nFor that reason, I need to define my \".write\" rule for \"/\" and additional validation rules for children of \"/\". That works fine. \r\nHowever, now, I want to prevent deletion of e.g. children of \"/a\". Since my write rule is defined for \"/\", I had to update it such that it checks whether any existing child of \"/\" or children of the children are becoming null during a write. Without the need of multi location updates, it would be possible to put write rules to the children instead of the root. However, since the update() command writes to \"/\" directly, I need to specify a lot more rules for the root write rule. \r\n\r\nIt would be nice to either apply validation rules during remove or to specify an additional element which is similar to validate and will be checked during removal only.\r\n\r\nOr do you see any other solution? \r\n\r\nBtw, I hope it is correct to post this topic within this project. "},"comment":{"url":"https://api.github.com/repos/firebase/bolt/issues/comments/231561514","html_url":"https://github.com/firebase/bolt/issues/154#issuecomment-231561514","issue_url":"https://api.github.com/repos/firebase/bolt/issues/154","id":231561514,"user":{"login":"brommer","id":4571686,"avatar_url":"https://avatars.githubusercontent.com/u/4571686?v=3","gravatar_id":"","url":"https://api.github.com/users/brommer","html_url":"https://github.com/brommer","followers_url":"https://api.github.com/users/brommer/followers","following_url":"https://api.github.com/users/brommer/following{/other_user}","gists_url":"https://api.github.com/users/brommer/gists{/gist_id}","starred_url":"https://api.github.com/users/brommer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brommer/subscriptions","organizations_url":"https://api.github.com/users/brommer/orgs","repos_url":"https://api.github.com/users/brommer/repos","events_url":"https://api.github.com/users/brommer/events{/privacy}","received_events_url":"https://api.github.com/users/brommer/received_events","type":"User","site_admin":false},"created_at":"2016-07-09T23:31:32Z","updated_at":"2016-07-09T23:31:32Z","body":"Found a solution to the problem. I was confusing the levels of the rules in relation to the paths used in the multi update() call. Moving down the write rules in the hierarchy and using validate rules in higher levels works fine. "}}
{"actor":{"display_login":"brommer"}}