FirebaseExtended / protobuf-rules-gen

This is an experimental protoc plugin that generates Firebase Rules for Cloud Firestore based on Google's Protocol Buffer format. This allows you to easily validate your data in a platform independent manner.
Apache License 2.0
197 stars 13 forks source link

Multi type support (int32 or float) #20

Closed k0ff33 closed 6 years ago

k0ff33 commented 6 years ago

I'm wondering if it's possible to specify a property to have multiple accepted types. In my case I need to allow both int32 and float types because of the way how JS treats numbers in general.

When writing security rules manually I was doing a simple OR like: && (resource.weight is float || resource.weight is int)

But I guess that's not possible (yet) in the plugin?

rockwotj commented 6 years ago

I'm going to change float and double types in this plugin to allow for whole numbers as well.

rockwotj commented 6 years ago

BTW, you can just do resource.weight is number to get both, instead of the OR