bijoutrouvaille / fireward

A concise and readable language for Firestore security rules, similar to Firebase Bolt.
MIT License
238 stars 4 forks source link

Syntax errors with paths #12

Closed JakeHedman closed 4 years ago

JakeHedman commented 4 years ago

Functions returning a path causes function `somePath` is missing a closing `}`:

function somePath() {
  return /foo/bar
}

Using dot notation inside $() in paths causes missing closing paren on $(:

function userExists() {
  return exists(/users/$(request.auth.uid))
}

Would it be useful to add a few large rules files to the test suite as a "smoke test" just to make sure fireward doesn't crash on weird but valid rules? I'm currently using a hacky jest script locally.

bijoutrouvaille commented 4 years ago

Thank you for the report @JakeHedman, and apologies for a late reply. I think the smoke test is a good idea. I'll try to get to it within the next couple of days.

bijoutrouvaille commented 4 years ago

Fixed the second case (v 1.1.3). The first case needs a little more research. The documentation is not very clear as to when the path is to be parenthesized.

This will work:

function somePath() {
  return (/foo/bar)
}
bijoutrouvaille commented 4 years ago

make smoke-test will try to compile examples/smoke-test.ward