-
Notifications
You must be signed in to change notification settings - Fork 179
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
FakeStream implementation #435
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #435 +/- ##
============================================
- Coverage 93.07% 93.04% -0.04%
- Complexity 2067 2084 +17
============================================
Files 229 231 +2
Lines 4263 4315 +52
Branches 432 441 +9
============================================
+ Hits 3968 4015 +47
- Misses 183 185 +2
- Partials 112 115 +3 ☔ View full report in Codecov by Sentry. |
@snuyanzin can you help in answering some of the above? I'm not sure far you got with your template refactoring. |
Hi @NarekDW great to see here and thanks for the contribution. I will try to have a deeper look later |
Hi @snuyanzin glad to see you 😊
Correct me if I’m wrong please. |
Not really. Initialization issue could be easily workarounded e.g. public static class Builder<T> {
private final List<Supplier<T>> suppliers;
private int minLength = -1; // negative means same as maxLength
private int maxLength = -1;
private double nullRate = 0d;
private BaseProviders faker;
...
public FakeStream<T> buildStream() {
...
}
public FakeCollection<T> buildCollection() {
maxLength = maxLength == -1 ? 10 : maxLength;
...
}
}
Didn't get this problem. In |
@snuyanzin Ok, got it. Let me try to apply that interface. |
…hem to util folder + add CSV and Json creation support from FakeSequence
697545a
to
bc796dc
Compare
# Conflicts: # src/main/java/net/datafaker/providers/base/BaseFaker.java # src/test/java/net/datafaker/fileformats/CsvTest.java # src/test/java/net/datafaker/util/FakeCollectionTest.java
Could you review please? |
thanks, in general it looks good
It's better to have some more self-explanatory names e.g. |
Done. Changed the folder name from |
public abstract FakeSequence<T> build(); | ||
|
||
/** | ||
* @param <S> [Stream<T>, List<T>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is a reason of ci failure, also fails locally with mvn clean install
@NarekDW fyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, my bad, fixed
Merged |
@NarekDW This is a really great contribution! Love it! Just wondering: would it be possible for you to add something to our documentation, the markdown files I mean? If you don't have time, no problem, I'm happy to port some of your unit tests to the public website (I saw you added something to the README already) and publish it here or so: |
@bodiam Yep, I can do that, but I'm not able to edit the page, which you shared (when I click on the edit button I get 404 not found). |
this page is a result of generation based on input here https://github.com/datafaker-net/datafaker/blob/main/docs/documentation/collections.md |
Thanks, let me take a look. |
Thanks! And sorry about that 404, I've probably configured something wrong, thanks for reporting! |
Please review - #443 |
This is the FakeStream simple implementation.
But I have a few doubts here:
Format.toCsv(FakeStream.Builder...)
andFormat.toJson(FakeStream.Builder...)
as it (Csv and Json classes in particular) was designed for FakeCollection only and it will take much effort (and much redundant and similar code) to add such an ability. What do you think, how could we improve the code and avoid of writing a lot of similar code? Probably to add some new level of abstraction? Or adding some converter function, which could convert FakeStream to FakeCollection and the pass collection to the functions like
Format.toCsv(FakeStream.Builder...)
andFormat.toJson(FakeStream.Builder...)
?