FirebaseExtended / bolt

Bolt Compiler (Firebase Security and Modeling)
Apache License 2.0
897 stars 107 forks source link

Using bolt to generate mock/seed data #129

Open alexklibisz opened 8 years ago

alexklibisz commented 8 years ago

This is more of a question or feature request than an issue: Do you see any way or is it possibly on the roadmap to generate mock/seed data from bolt definitions? For example, when I change my rules in my dev environment I'd like to already have some mock data that adheres to those rules to run tests or continue iterating quickly, instead of creating new data manually or with separate scripts. I think this would be a nice workflow.

mckoss commented 8 years ago

Neat idea!

mm-gmbd commented 8 years ago

I had this same thought -- thanks for bringing it up @alexklibisz!

At first, I dismissed it because something didn't seem right about the rules generating test data for... themselves. However, I think if the data was generated solely from the Type definitions (i.e. the data validation rather than the read/write access), then this would probably be okay.

Something like mustache or handlebars could be a nice option for allowing the developer to make a quick template for formatting the mock data in whatever way he/she may see fit...

mm-gmbd commented 8 years ago

Another feature I had considered would be either auto-generating Type definitions from JSON Schema (i.e. potentially from something like a Swagger document), or compiling Type definitions into JSON Schema. This would be sweet for keeping Rules/Data Seeding/API all in sync :)