{"action":"opened","issue":{"url":"https://api.github.com/repos/firebase/bolt/issues/186","repository_url":"https://api.github.com/repos/firebase/bolt","labels_url":"https://api.github.com/repos/firebase/bolt/issues/186/labels{/name}","comments_url":"https://api.github.com/repos/firebase/bolt/issues/186/comments","events_url":"https://api.github.com/repos/firebase/bolt/issues/186/events","html_url":"https://github.com/firebase/bolt/issues/186","id":199071047,"number":186,"title":"Unable to force `.val()` when accessing ref property","user":{"login":"cebartling","id":33961,"avatar_url":"https://avatars.githubusercontent.com/u/33961?v=3","gravatar_id":"","url":"https://api.github.com/users/cebartling","html_url":"https://github.com/cebartling","followers_url":"https://api.github.com/users/cebartling/followers","following_url":"https://api.github.com/users/cebartling/following{/other_user}","gists_url":"https://api.github.com/users/cebartling/gists{/gist_id}","starred_url":"https://api.github.com/users/cebartling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebartling/subscriptions","organizations_url":"https://api.github.com/users/cebartling/orgs","repos_url":"https://api.github.com/users/cebartling/repos","events_url":"https://api.github.com/users/cebartling/events{/privacy}","received_events_url":"https://api.github.com/users/cebartling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-05T22:02:00Z","updated_at":"2017-01-05T22:02:00Z","closed_at":null,"body":"## Input\r\nGiven bolt file containing the following content:\r\n\r\n```\r\nfunction isAssociatedWithSharedAsset(auth, assetId) {\r\n    return root.child('users').child(auth.uid).child('shared_asset_refs').child(assetId) != null;\r\n}\r\n\r\n\r\npath /organizations/{organizationId}/collections/{collectionId} {\r\n    read() {\r\n        isAssociatedWithSharedAsset(auth, this.asset_id)\r\n    }\r\n    write() {\r\n        isAssociatedWithSharedAsset(auth, this.asset_id)\r\n    }\r\n}\r\n```\r\n\r\n## Actual output\r\nCompiling that to the desired JSON format yields:\r\n\r\n```\r\n{\r\n  \"rules\": {\r\n    \"organizations\": {\r\n      \"$organizationId\": {\r\n        \"collections\": {\r\n          \"$collectionId\": {\r\n            \".read\": \"root.child('users').child(auth.uid).child('shared_asset_refs').child(data.child('asset_id')) != null\",\r\n            \".write\": \"newData.parent().parent().parent().parent().child('users').child(auth.uid).child('shared_asset_refs').child(newData.child('asset_id')) != null\"\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThat resulting JSON structure is invalid and will not publish in the Firebase Console. In particular, `.child(data.child('asset_id'))` will not publish in the Firebase Console\r\n\r\n## Desired output\r\n\r\nI was expecting the following JSON structure (Note that the `!= null` not converting to `.exists()` has been separately filed as an issue:\r\n\r\n```\r\n{\r\n  \"rules\": {\r\n    \"organizations\": {\r\n      \"$organizationId\": {\r\n        \"collections\": {\r\n          \"$collectionId\": {\r\n            \".read\": \"root.child('users').child(auth.uid).child('shared_asset_refs').child(data.child('asset_id').val()).exists()\",\r\n            \".write\": \"newData.parent().parent().parent().parent().child('users').child(auth.uid).child('shared_asset_refs').child(newData.child('asset_id').val()).exists()\"\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"cebartling"}}