firestore.rules
), and developers often implement custom rules alongside type validations, Typesync inserts only the necessary validator functions, without overriding your custom rules. You can specify where these validators are added within the file using the --startMarker
and --endMarker
options. For a detailed guide, see the full example below.
x
is a list
with the x is list
predicate, determining whether it’s a list of strings is
not possible since loop constructs are not available in Security Rules.
Typesync will provide the most stringent validation possible within these
constraints.definition/models.json
'definition/**/*.yml'
//
(see example).//
(see example)."{modelName}"
substring (this is a literal value).Example values:"isValid{modelName}"
-> produces validators like isValidUser
, isValidProject
, isValidAccount
etc."is{modelName}"
-> produces validators like isUser
, isProject
, isAccount
etc.models.yml
and a Security Rules file named firestore.rules
.
typesync-start
and typesync-end
markers in the firestore.rules
file, you can run the following command:
isValidUserRole()
and isValidUser()
validators into the file. You can then use these validators as needed in your custom rules.