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
This issue describes breaking changes that are coming in the next major version of kotlin-faker for easier migration.
Note that this issue serves for informational purposes only, and hence the conversation will be locked. If you've started using the new version of faker and face any problems or have any suggestions - please open a new issue.
Multi-Faker Implementation
Currently, the most notable change is described in #217 and implemented in #219 , which can break compilation for many calls to Faker.
In short, if you've been using a lot of different data providers from Faker, it is likely that some of them won't be there anymore in the "core faker" implementation. This includes data providers in the domains like books, tv shows, movies, music, sports and many others.
To keep using those, you will need to add one or more extra fakers via new dependencies and fix the imports and add new faker objects to access those providers.
Below is the list of all available fakers' dependencies (note that the default faker is needed for others to work as they won't pull it as a transitive dependency):
If you have been using faker {} dsl function to create instances of Faker, each faker implementation also has such a function with the same name. Mind the package names though if using multiple ones in the same file.
Below is a simple example of using all the available fakers:
importio.github.serpro69.kfaker.fakerimportio.github.serpro69.kfaker.books.fakerasbooksimportio.github.serpro69.kfaker.commerce.fakerascommerceimportio.github.serpro69.kfaker.creatures.fakerascreaturesimportio.github.serpro69.kfaker.edu.fakeraseduimportio.github.serpro69.kfaker.games.fakerasgamesimportio.github.serpro69.kfaker.humor.fakerashumorimportio.github.serpro69.kfaker.japmedia.fakerasjapmediaimportio.github.serpro69.kfaker.lorem.fakerasloremimportio.github.serpro69.kfaker.misc.fakerasmiscimportio.github.serpro69.kfaker.movies.fakerasmoviesimportio.github.serpro69.kfaker.music.fakerasmusicimportio.github.serpro69.kfaker.sports.fakerassportsimportio.github.serpro69.kfaker.tech.fakerastechimportio.github.serpro69.kfaker.travel.fakerastravelimportio.github.serpro69.kfaker.tv.fakerastvfunmain() {
val f = faker {}
val books = books { }
val commerce = commerce { }
val creatures = creatures { }
val edu = edu { }
val games = games { }
val humor = humor { }
val japmedia = japmedia { }
val lorem = lorem { }
val misc = misc { }
val movies = movies { }
val music = music { }
val sports = sports { }
val tech = tech { }
val travel = travel { }
val tv = tv { }
repeat(100) {
println(f.name.name())
println(books.book.author())
println(commerce.commerce.vendor())
println(creatures.cat.name())
println(edu.job.field())
println(games.game.title())
println(humor.funnyName.name())
println(japmedia.naruto.eyes())
println(lorem.lorem.words())
println(misc.artist.names())
println(movies.movie.title())
println(music.music.albums())
println(sports.eSport.games())
println(tech.app.name())
println(travel.nation.language())
println(tv.archer.quotes())
}
}
Note
More details on the new Data Providers structure can be found in the docs
The text was updated successfully, but these errors were encountered:
From 637498b (release v2.0.0-rc.2 onwards), each kotlin-faker-* module is versioned separately (ref: #225), and released only when the corresponding submodule has changes between last version and next release. This means that at a given time kotlin-faker-books:2.1.0 and kotlin-faker-tvshows:2.3.0 might be latest versions, respectively, while koltin-faker could also be a different version (minor and patch only!)
After initial release 2.0.0, all the submodules should compatible with the same major version of "core" kotlin-faker library, meaning that e.g. it should be possible to use kotlin-faker:2.\d+.\d+ with kotlin-faker-tvshows:2.3.0 and kotlin-faker-books:2.1.0, and so on.
This issue describes breaking changes that are coming in the next major version of kotlin-faker for easier migration.
Multi-Faker Implementation
Currently, the most notable change is described in #217 and implemented in #219 , which can break compilation for many calls to
Faker
.In short, if you've been using a lot of different data providers from
Faker
, it is likely that some of them won't be there anymore in the "core faker" implementation. This includes data providers in the domains like books, tv shows, movies, music, sports and many others.To keep using those, you will need to add one or more extra fakers via new dependencies and fix the imports and add new faker objects to access those providers.
Below is the list of all available fakers' dependencies (note that the default faker is needed for others to work as they won't pull it as a transitive dependency):
If you have been using
faker {}
dsl function to create instances ofFaker
, each faker implementation also has such a function with the same name. Mind the package names though if using multiple ones in the same file.Below is a simple example of using all the available fakers:
Note
More details on the new Data Providers structure can be found in the docs
The text was updated successfully, but these errors were encountered: