What is the name of the language used for Cloud Firestore security rules?

前端 未结 3 527
感动是毒
感动是毒 2021-02-08 03:21

I would like to know the name of the syntax used for the Cloud Firestore security rules as described at https://firebase.google.com/docs/firestore/security/get-started?authuser=

相关标签:
3条回答
  • 2021-02-08 04:03

    You can find a syntax highlighting plugin for Visual Studio here: https://github.com/toba/vsfire

    I adapted the plugin for Atom: https://github.com/jaysquared/atom-firestore-grammar

    0 讨论(0)
  • 2021-02-08 04:09

    For IntelliJ IDEs, I found the Set File Type Associations immensely useful for adding syntax highlighting to the .rules file.

    You don't need to create an IDE plugin. Just check some boxes, mention some keywords. I chose this:

    Tab 2: true, false

    Tab 3: !==,==,&&,||

    Tab 4: !,(,)

    The result is a rather pleasant, imho:

    What it does not provide is collapsing of rules, scoping of functions (autocomplete), or anything else that needs syntax awareness. But it seems way better than no syntax highlight, at all.

    Edit: Unfortunately, in order to provide a tab/spaces policy for .rules files, "you have to develop your own language plugin." (source) It seems there's still need for a proper language plugin. :(

    0 讨论(0)
  • 2021-02-08 04:16

    Firebase Security Rules is a custom DSL.

    Condition expressions are JS like, and should work with one of those. The path matching framework is less common, but we're working on providing the grammar + additional tooling (syntax highlighting, parsing, type checking, evaluators) in the future.

    For those interested in the history, the semantics are closely related to XACML, we just wanted to provide better (non-XML) syntax.

    0 讨论(0)
提交回复
热议问题