Skip to content

Commit

Permalink
Add new data providers
Browse files Browse the repository at this point in the history
Also adds 'ja' dicts for 'sport' and 'touhou'

Close #200
  • Loading branch information
serpro69 authored Oct 6, 2023
1 parent 811a249 commit 1199fd5
Show file tree
Hide file tree
Showing 20 changed files with 2,201 additions and 9 deletions.
22 changes: 15 additions & 7 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.[1.15.0] - UNRELEASED
.[1.15.0] - 2023-10-06
[%collapsible]
====
[discrete]
Expand All @@ -11,8 +11,21 @@
*** `Faker().internet.safeDomainSuffix()`
*** `Faker().southPark.episodes()`
** Updates to existing localized dictionaries

* https://github.com/serpro69/kotlin-faker/pull/197[#197] [cli] Render sub-providers functions in cli output
* https://github.com/serpro69/kotlin-faker/pull/200[#200] [core] Add new data providers

++++
<details><summary><h3>New Data Providers</h3></summary>
<p>
++++
* `archer`
* `final_fantasy_xiv`
* `mitch_hedberg`
* `train_station`
++++
</p>
</details>
++++

[discrete]
=== Changed
Expand All @@ -25,11 +38,6 @@
* https://github.com/serpro69/kotlin-faker/pull/188[#188] [core] Fix postcode for en-GB locale
* https://github.com/serpro69/kotlin-faker/pull/193[#193] [core] Fix localized postcodes with regex patterns

[discrete]
=== Other

* ...

====
.[1.14.0] - 2023-03-19
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
"name": "getAquaTeenHungerForce",
"parameterTypes": []
},
{
"name": "getArcher",
"parameterTypes": []
},
{
"name": "getArtist",
"parameterTypes": []
Expand Down Expand Up @@ -318,6 +322,10 @@
"name": "getFile",
"parameterTypes": []
},
{
"name": "getFinalFantasyXIV",
"parameterTypes": []
},
{
"name": "getFinalSpace",
"parameterTypes": []
Expand Down Expand Up @@ -510,6 +518,10 @@
"name": "getMinecraft",
"parameterTypes": []
},
{
"name": "getMitchHedberg",
"parameterTypes": []
},
{
"name": "getMoney",
"parameterTypes": []
Expand Down Expand Up @@ -782,6 +794,10 @@
"name": "getTouhou",
"parameterTypes": []
},
{
"name": "getTrainStation",
"parameterTypes": []
},
{
"name": "getTron",
"parameterTypes": []
Expand Down Expand Up @@ -1002,6 +1018,23 @@
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.Archer",
"methods": [
{
"name": "characters",
"parameterTypes": []
},
{
"name": "locations",
"parameterTypes": []
},
{
"name": "quotes",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.Artist",
"methods": [
Expand Down Expand Up @@ -2713,6 +2746,31 @@
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.FinalFantasyXIV",
"methods": [
{
"name": "characters",
"parameterTypes": []
},
{
"name": "dataCenters",
"parameterTypes": []
},
{
"name": "jobs",
"parameterTypes": []
},
{
"name": "races",
"parameterTypes": []
},
{
"name": "zones",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.FinalSpace",
"methods": [
Expand Down Expand Up @@ -3837,6 +3895,15 @@
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.MitchHedberg",
"methods": [
{
"name": "quote",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.Money",
"allDeclaredFields": true,
Expand Down Expand Up @@ -5316,6 +5383,79 @@
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.TrainStation",
"methods": [
{
"name": "getGermany",
"parameterTypes": []
},
{
"name": "getSpain",
"parameterTypes": []
},
{
"name": "getUnitedKingdom",
"parameterTypes": []
},
{
"name": "getUnitedStates",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.TrainStationGermany",
"methods": [
{
"name": "metro",
"parameterTypes": []
},
{
"name": "railway",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.TrainStationSpain",
"methods": [
{
"name": "metro",
"parameterTypes": []
},
{
"name": "railway",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.TrainStationUnitedKingdom",
"methods": [
{
"name": "metro",
"parameterTypes": []
},
{
"name": "railway",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.TrainStationUnitedStates",
"methods": [
{
"name": "metro",
"parameterTypes": []
},
{
"name": "railway",
"parameterTypes": []
}
]
},
{
"name": "io.github.serpro69.kfaker.provider.Tron",
"methods": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import io.github.serpro69.kfaker.provider.Airport
import io.github.serpro69.kfaker.provider.Dota
import io.kotest.core.spec.style.DescribeSpec
import io.kotest.matchers.collections.shouldContainExactly
import io.kotest.matchers.sequences.shouldContainExactly
import kotlin.reflect.KClass

class IntrospectorTest : DescribeSpec() {
Expand All @@ -31,6 +30,7 @@ class IntrospectorTest : DescribeSpec() {
"App",
"Appliance",
"AquaTeenHungerForce",
"Archer",
"Artist",
"Australia",
"Avatar",
Expand Down Expand Up @@ -99,6 +99,7 @@ class IntrospectorTest : DescribeSpec() {
"Fallout",
"FamilyGuy",
"File",
"FinalFantasyXIV",
"FinalSpace",
"Finance",
"FmaBrotherhood",
Expand Down Expand Up @@ -147,6 +148,7 @@ class IntrospectorTest : DescribeSpec() {
"MichaelScott",
"Military",
"Minecraft",
"MitchHedberg",
"Money",
"Mountain",
"Mountaineering",
Expand Down Expand Up @@ -215,6 +217,7 @@ class IntrospectorTest : DescribeSpec() {
"TheThickOfIt",
"Tolkien",
"Touhou",
"TrainStation",
"Tron",
"TwinPeaks",
"UmphreysMcgee",
Expand Down Expand Up @@ -249,6 +252,7 @@ class IntrospectorTest : DescribeSpec() {
"app",
"appliance",
"aquaTeenHungerForce",
"archer",
"artist",
"australia",
"avatar",
Expand Down Expand Up @@ -317,6 +321,7 @@ class IntrospectorTest : DescribeSpec() {
"fallout",
"familyGuy",
"file",
"finalFantasyXIV",
"finalSpace",
"finance",
"fmaBrotherhood",
Expand Down Expand Up @@ -365,6 +370,7 @@ class IntrospectorTest : DescribeSpec() {
"michaelScott",
"military",
"minecraft",
"mitchHedberg",
"money",
"mountain",
"mountaineering",
Expand Down Expand Up @@ -433,6 +439,7 @@ class IntrospectorTest : DescribeSpec() {
"theThickOfIt",
"tolkien",
"touhou",
"trainStation",
"tron",
"twinPeaks",
"umphreysMcgee",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.full.isSubtypeOf
import kotlin.reflect.full.starProjectedType

@Suppress("UNCHECKED_CAST")
class FakerIT : DescribeSpec({
describe("every public function in each provider is invoked without exceptions") {
val faker = Faker()
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/kotlin/io/github/serpro69/kfaker/Faker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
val app: App by lazy { App(fakerService) }
val appliance: Appliance by lazy { Appliance(fakerService) }
val aquaTeenHungerForce: AquaTeenHungerForce by lazy { AquaTeenHungerForce(fakerService) }
val archer: Archer by lazy { Archer(fakerService) }
val artist: Artist by lazy { Artist(fakerService) }
val australia: Australia by lazy { Australia(fakerService) }
val avatar: Avatar by lazy { Avatar(fakerService) }
Expand Down Expand Up @@ -111,6 +112,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
val fallout: Fallout by lazy { Fallout(fakerService) }
val familyGuy: FamilyGuy by lazy { FamilyGuy(fakerService) }
val file: File by lazy { File(fakerService) }
val finalFantasyXIV: FinalFantasyXIV by lazy { FinalFantasyXIV(fakerService) }
val finalSpace: FinalSpace by lazy { FinalSpace(fakerService) }
val finance: Finance by lazy { Finance(fakerService) }
val fmaBrotherhood: FmaBrotherhood by lazy { FmaBrotherhood(fakerService) }
Expand Down Expand Up @@ -161,6 +163,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
val michaelScott: MichaelScott by lazy { MichaelScott(fakerService) }
val military: Military by lazy { Military(fakerService) }
val minecraft: Minecraft by lazy { Minecraft(fakerService) }
val mitchHedberg: MitchHedberg by lazy { MitchHedberg(fakerService) }
val money: Money by lazy { Money(fakerService) }
val mountain: Mountain by lazy { Mountain(fakerService) }
val mountaineering: Mountaineering by lazy { Mountaineering(fakerService) }
Expand Down Expand Up @@ -231,6 +234,7 @@ class Faker @JvmOverloads constructor(internal val config: FakerConfig = fakerCo
val theThickOfIt: TheThickOfIt by lazy { TheThickOfIt(fakerService) }
val tolkien: Tolkien by lazy { Tolkien(fakerService) }
val touhou: Touhou by lazy { Touhou(fakerService) }
val trainStation: TrainStation by lazy { TrainStation(fakerService) }
val tron: Tron by lazy { Tron(fakerService) }
val twinPeaks: TwinPeaks by lazy { TwinPeaks(fakerService) }
val umphreysMcgee: UmphreysMcgee by lazy { UmphreysMcgee(fakerService) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ internal enum class YamlCategory : Category {
APP,
APPLIANCE,
AQUA_TEEN_HUNGER_FORCE,
ARCHER,
ARTIST,
AUSTRALIA,
AVATAR,
Expand Down Expand Up @@ -186,6 +187,7 @@ internal enum class YamlCategory : Category {
THE_OFFICE,
THE_THICK_OF_IT,
TOLKIEN,
TRAIN_STATION,
TRON,
TWIN_PEAKS,
UMPHREYS_MCGEE,
Expand Down
24 changes: 24 additions & 0 deletions core/src/main/kotlin/io/github/serpro69/kfaker/provider/Archer.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.github.serpro69.kfaker.provider

import io.github.serpro69.kfaker.*
import io.github.serpro69.kfaker.dictionary.*
import io.github.serpro69.kfaker.provider.unique.LocalUniqueDataProvider
import io.github.serpro69.kfaker.provider.unique.UniqueProviderDelegate

/**
* [FakeDataProvider] implementation for [YamlCategory.ARCHER] category.
*/
@Suppress("unused")
class Archer internal constructor(fakerService: FakerService) : YamlFakeDataProvider<Archer>(fakerService) {
override val yamlCategory = YamlCategory.ARCHER
override val localUniqueDataProvider = LocalUniqueDataProvider<Archer>()
override val unique by UniqueProviderDelegate(localUniqueDataProvider)

init {
fakerService.load(yamlCategory)
}

fun characters() = resolve("characters")
fun locations() = resolve("locations")
fun quotes() = resolve("quotes")
}
Loading

0 comments on commit 1199fd5

Please sign in to comment.