bentonam / fakeit

Generates JSON documents based on models defined in YAML and adds them to a Couchbase Bucket
MIT License
86 stars 21 forks source link

Automatically resolve dependencies and inputs #101

Closed tjbenton closed 7 years ago

tjbenton commented 7 years ago

Currently this is how it works.

fakeit \
  --models 'models/airlines.yaml,models/countries.yaml,models/regions.yaml,models/users.yaml,models/airline_reviews.yaml' \
  --input 'input/airlines.csv,input/countries.csv,input/regions.csv' \
  --exclude 'Countries,Regions,Users,Airlines'

Here's the table break down

Model Other model dependencies required inputs Ouput
models/airlines.yaml models/countries.yaml input/airlines.csv :x:
models/countries.yaml - input/countries.csv :x:
models/regions.yaml - input/regions.csv :x:
models/users.yaml models/regions.yaml - :x:
models/airline_reviews.yaml models/airlines.yaml, models/users.yaml - :white_check_mark:

It's awesome that we can generate a crap ton of data easily, but not awesome that I as a developer have to remember each model that is ultimately required and each input that all those required models need to function correctly. This is something that should be done for the user without them having to do it.

If a file requires an input of data then it needs to be specified in the options for that model, and we should resolve it automagically for them. Also if a model requires other models those should also be resolved automatically instead of having to pass in data.

Doing these two things will reduce the total amount of options you have to pass to generate data dramatically.