Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle Faker #475

Closed
thePantz opened this issue Feb 19, 2020 · 7 comments
Closed

Vehicle Faker #475

thePantz opened this issue Feb 19, 2020 · 7 comments

Comments

@thePantz
Copy link

thePantz commented Feb 19, 2020

Problem
I want a faker that generates vehicle data such as:

  • Make
  • Model
  • Year
  • VIN
  • Mileage

Solution

  • Implement the missing Vehicle class
  • .yml file already exists

Additional Details

It appears that the work for this was done in PR #436 but is not in master. Is this a mistake? In a future release? or was there a decision to remove this?

@thePantz
Copy link
Author

thePantz commented Feb 28, 2020

Working on a new PR. I will reuse most of the previous PR but I have some thoughts:

  • the .yml file has an entry for manufacturer and make. These are interchangeable in my opinion, I'm considering removing one entirely.
  • Previous PR uses the following code to generate a model, This should return null if the make is not found instead of a validation message imo
    public String model(String make) {
        ArrayList<String> arr = (ArrayList<String>) faker.fakeValuesService().fetchObject("vehicle.makes");
        if (arr.contains(make))
            return faker.fakeValuesService().fetchString(String.format("vehicle.models_by_make.%s", make));
        else
            return "Only Supports models of the following make: " + arr;
    }
  • The previous PR uses the following code to generate a license plate, This should return null if the state is blank/null imo. I want to create an overload of licensePlate that takes no parameter that will handle the 'else' case
 public String licensePlate(String stateAbbreviation) {
        String key;
        if (!StringUtils.isBlank(stateAbbreviation)) {
            key = "vehicle.license_plate_by_state." + stateAbbreviation;
            return faker.regexify(faker.bothify(faker.fakeValuesService().fetchObject(key).toString()));
        } else {
            key = "vehicle.license_plate";
            return faker.regexify(faker.bothify(faker.fakeValuesService().fetchObject(key).toString()));
        }
    }

@thePantz thePantz mentioned this issue Feb 28, 2020
@wimdeblauwe
Copy link

I could use this. Any plans to put this in a next release?

@dgautier
Copy link

I sure could use it too.

@thePantz
Copy link
Author

Still willing to merge this in. The PR has been sitting here for over a year and I have not been contacted by anyone to explain why

@boxcee
Copy link

boxcee commented Nov 10, 2021

@thePantz explain what exactly?

EDIT: Understanding now. You are the author of the PR, not a contributor.

@thePantz
Copy link
Author

The good folks at https://github.com/datafaker-net/datafaker (fork of this repo) have added a vehicle faker among many others. I suggest we all move there

@bodiam
Copy link

bodiam commented Oct 12, 2022

I'm happy to hear that 2 years after the original report we can still add some value with Datafaker.

FYI, using Datafaker, it's also possible to create your own custom fakers of data, should there be a special case not supported by any of the current fakers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants