Snowfakery icon indicating copy to clipboard operation
Snowfakery copied to clipboard

Consistent addresses

Open prescod opened this issue 4 years ago • 1 comments

Snowfakery should have a built-in mechanism for generating consistent addresses.

For example, one potential syntax could be:

- object: BillingAddress
  vars:
    snowfakery_address_country:
        random_choice:
            - United Kingdom
            - United States
            - Canada
  fields:
    BillingStreet:
      fake: street_address
    BillingCity:
      fake: city
    BillingState:
      fake: state
    BillingPostalCode:
      fake: postalcode
    BillingCountry:
      fake: country

This would override the behaviour of faker to hard-code country, select state in an "intelligent" way, and set the locale for all of the rest.

prescod avatar Jan 27 '21 11:01 prescod

Love the concept and would find this very useful. Have you considered calling the variable something like: snowfakery_locale_address which would make it a little clearer what you're actually swapping and leave room for future additions within the pattern if the need arises to swap the locale provider for other groups of fields. For example one could imagine an EDA admin might want to have a bunch of international students and so would benefit from a separate snowfakery_locale_name to generate non-English names but still use US addresses.

acrosman avatar Jan 30 '21 19:01 acrosman