Code Monkey home page Code Monkey logo

Comments (3)

bchavez avatar bchavez commented on June 2, 2024 2

Hey, very great find and great investigation work @dangerman. 👍 Thank you for this.

If we already have a data_extend for iban formats, which it looks like we do; then yes, I would accept a PR/patch for this specific CR (Costa Rica) IBAN issue that updates data_extend:en/iban/cr.

You're absolutely correct on the proposed fix:

  • patch data_extend
  • write a unit test Bogus.Tests/GitHubIssues/Issue538.cs

and running gulp importLocales should gather all the JSON; merge data_extend, and finally write the necessary BSON resource files for Bogus.dll.

Just a few more points:

  • Reference this GH issue number #538 in your PR.
  • Keep the PR/change-set strictly focused on this kind of change (ie: don't include any code reformatting); keep the PR/changes strictly on topic. If you'd like to change something else off-topic; feel free to set up a new GH issue or PR for those off-topic changes and we can discuss. 👍

The README.md section for Building From Source should have the latest docs on the build basics for the Bogus repo (including node js dependencies etc):

Roadmap wise, right now Bogus is basically around fakerjs v5 API + dataset parity. Longer term, we'll be catching up to v8 API + datasets; which is why some of these datasets might be outdated and as we catch up; hopefully a lot of these issues will be resolved automatically.

from bogus.

dangerman avatar dangerman commented on June 2, 2024 1

I looked into this and it seems like it's a bug that was already fixed in faker.js a couple years ago: faker-js/faker#643

In summary:

The Costa Rican IBAN format is missing an extra 0 (reserve number) before the banking code.
(For reference: https://bank-code.net/iban/structure/costa-rica-international-bank-account-number)

Locale data

Bogus IBAN generation appears to use the iban_formats from the locale data:

public string Iban(bool formatted = false, string countryCode = null)
{
var arr = this.GetArray("iban_formats");

And according to the documentation, this comes from:

  • the faker.js locale data from the faker submodule (from like 3 years ago, before the fix)
  • and the locales in data_extend, which take priority.

Proposed fix

We've already got iban_formats in the data_extend en locale, so we can just update it there and run gulp importLocales, right?

{
"country": "CR",
"total": 21,
"bban": [
{
"type": "n",
"count": 3
},
{
"type": "n",
"count": 14
}
],
"format": "CRkk bbbc cccc cccc cccc c"
},

@bchavez is it alright if I raise a PR with:

  • a fix in the en locale in data_extend
  • a test in Bogus.Tests/GitHubIssues?

from bogus.

bchavez avatar bchavez commented on June 2, 2024

Thank you @dangerman for the PR; excellent and super great work.

The CR IBAN fix is now available in Bogus v35.5.1:

Thanks again for the bug report and PR fix. 👍 🚀

from bogus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.