You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the country names and other similar data in Faker originate from another source, it would be good to indicate this. This isn't just nitpicking - in one of our app's forms, a "Country" select is populated with ISO data, and tests ended up randomly failing when test schema were generated using Faker because e.g. "Svalbard & Jan Mayen Islands" was not a selectable option.
Thanks!
The text was updated successfully, but these errors were encountered:
I agree, source will be a good to have. Speaking of your specific example, I feel like this would not be right to adjust it to your need, say we have someone else who want to use different list. My suggestion will be to add country/1, with default to :iso3166_1 and list from ISO. In this case you'll be able to use "correct" list in your app, but we leave place fore extensibility. we can also make it default for country/0. WDYT? PR would be much appreciated.
@igas Sounds good, thanks! I'll work on a PR. Do you know the source of the current country list so that it can be passed as an argument to country/1? In the interest of not breaking any current functionality, do you think it would be best to go with
defmoduleFaker.Address.Endodefcountry(data_source\\:current)defcountry(:current)do# current listenddefcountry(:iso3166_1)do# iso listendend
Also, do you have any tips for testing this? I don't see a way to seed Faker's random number generator to make list sampling deterministic. Otherwise, I can only think of something indirect like
refutecountry(:iso3166_1)=="Svalbard & Jan Mayen Islands"refutecountry(:current)=="Svalbard and Jan Mayen"# ORrefute"Svalbard & Jan Mayen Islands"inEnum.map(1..big_number->fn_->country(:iso3166_1)end)
Hi,
Thanks to all the contributors for their work on this resource!
I would like to suggest that it may be a good idea to specify which standards were used as source(s) of data in the library. For instance, in the English version of the
Address
module the country list contains "Svalbard & Jan Mayen Islands". However, ISO3166-1 defines this geographic entity as "Svalbard and Jan Mayen". There is also "Antarctica (the territory South of 60 deg S)", which is simply "Antarctica" as per ISO.If the country names and other similar data in Faker originate from another source, it would be good to indicate this. This isn't just nitpicking - in one of our app's forms, a "Country" select is populated with ISO data, and tests ended up randomly failing when test schema were generated using Faker because e.g. "Svalbard & Jan Mayen Islands" was not a selectable option.
Thanks!
The text was updated successfully, but these errors were encountered: