Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for empty array #55

Closed
paslavsky opened this issue Mar 26, 2021 · 1 comment · Fixed by #59
Closed

Support for empty array #55

paslavsky opened this issue Mar 26, 2021 · 1 comment · Fixed by #59
Assignees

Comments

@paslavsky
Copy link

I wrote function with two arguments and in some cases I want to pass empty array into that function:

rules_version = '2';
service cloud.firestore {
    match /databases/{database}/documents {
        match /{document=**} {
            allow read, write: if false;
        }

        function validateDocument(requiredFields, optionalFields) {
            let allFields = requiredFields.concat(optionalFields) ;
            let fields = request.resource.data.keys() ;
            return fields.hasAll(requiredFields) && fields.hasOnly(allFields);
        }

        match /my-collections/{doc} {
            allow read: if true;
            allow write: if validateDocument(['foo', 'bar'], []);
        }
    }
}

I see the following error in my IDE:

  • <expr> or '[' expected, got ']'
@dalgarins dalgarins self-assigned this Mar 26, 2021
@dalgarins
Copy link
Contributor

Captura de Pantalla 2021-04-12 a la(s) 11 13 41 p  m

Thanks for testing, issue will be fixed on version: 2.5.3

@dalgarins dalgarins linked a pull request Apr 13, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants