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

Add a new module supports datafaker #525

Open
seongahjo opened this issue Dec 12, 2022 · 8 comments
Open

Add a new module supports datafaker #525

seongahjo opened this issue Dec 12, 2022 · 8 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@seongahjo
Copy link
Contributor

seongahjo commented Dec 12, 2022

Describe the feature you request

Add a new module supports datafaker

@seongahjo seongahjo added enhancement New feature or request good first issue Good for newcomers labels Dec 12, 2022
@seongahjo seongahjo changed the title Integration with java-faker Add a new module supports java-faker Dec 12, 2022
@armandino
Copy link

I believe java-faker is no longer maintained. There is an actively maintained forked at https://github.com/datafaker-net/datafaker

@bodiam - maybe somebody from the Data Faker team can help with the integration?

@bodiam
Copy link

bodiam commented Jan 16, 2023

Hi there! This library looks interesting, and happy to share some ideas on this.

Is there some api or idea you had in mind?

@seongahjo seongahjo changed the title Add a new module supports java-faker Add a new module supports datafaker Jan 16, 2023
@seongahjo
Copy link
Contributor Author

@bodiam
Hi thank you for your help!
We would discuss how to integrate with datafaker in a weekly meeting and share ideas on this issue.

Thank you for your help too, @armandino

@armandino
Copy link

@seongahjo no worries. Happy to connect two great libraries.

@seongahjo
Copy link
Contributor Author

@bodiam
Hello, we've discussed how to integrate with datafaker.

Is there any way to make a random value which satisfies condition?
For example, we want to make a firstName whose length is 5.

It would be helpful with this feature.

@bodiam
Copy link

bodiam commented Jan 30, 2023

@seongahjo given the nature of the fake values, that would be hard. For example, how would we create a country of 30 characters long? We don't really know the limits even, since they are depending on the Locales.

Yes, it's possible to generate a random string of X characters, but that defeats the purpose of the library.

Can I ask why you'd need such a feature?

@seongahjo
Copy link
Contributor Author

@bodiam
We are supporting Jakarta Bean Validation annotations when generating an object.

If a String field has a @Size annotation, the length of field would be a given value.

For example.

class Foo{
   @Size(3)
   String Bar;
}

A length of Bar always be 3.

We'd like to use datafaker to generate a feasible String field value inferred by a property name or other condition.
The field might have Jakarta Bean Validation annotations.
It would be helpful if datafaker supports filtering by length for an above reason.

@bodiam
Copy link

bodiam commented Jan 31, 2023

It's tricky I think. Some of these fields are populated by regular expressions, or concatenations of different fields.

This might be a silly idea, but how about invoking the faker, potentially several times (100s of times shouldn't be an issue), and record the shortest/longest lengths?

DaraFaker cannot, and will never be able to generate a string of arbitrary length for any propery. For example, a license plate of 25 characters wouldn't make sense, or a full name of 2 characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants