@kubb/plugin-faker 5.1.2 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +18 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +189 -0
- package/package.json +8 -5
package/OVERVIEW.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Faker
|
|
2
|
+
|
|
3
|
+
Generates a Faker.js mock-data factory for every schema in your OpenAPI spec. Use the factories in tests, Storybook, and local development without a running backend. Each factory accepts partial data that overrides the generated values.
|
|
4
|
+
|
|
5
|
+
`@kubb/plugin-msw` can use these factories to fill mock responses.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
- Add `@kubb/plugin-ts` for the factory return types.
|
|
10
|
+
- Install `@faker-js/faker` v9 or higher in the app that uses the generated code.
|
|
11
|
+
|
|
12
|
+
## Options worth knowing
|
|
13
|
+
|
|
14
|
+
- `seed` passes a fixed seed to `faker.seed(...)`, so every run returns the same data.
|
|
15
|
+
- `locale` sets the Faker locale. The default is `en`.
|
|
16
|
+
- `dateParser` formats date and time strings with `faker` (default), `dayjs`, or `moment`. Install the library you pick.
|
|
17
|
+
- `regexGenerator` turns a `pattern` into a string with `faker` (default) or `randexp`.
|
|
18
|
+
- `typeMode` sets the factory types: `inferred` (default) derives them from the generated values, `schema` uses the declared model type.
|
package/dist/index.cjs
CHANGED
|
@@ -1497,8 +1497,14 @@ const fakerGenerator = (0, kubb_kit.defineGenerator)({
|
|
|
1497
1497
|
}
|
|
1498
1498
|
});
|
|
1499
1499
|
//#endregion
|
|
1500
|
+
//#region kubb-extension.json
|
|
1501
|
+
var compatibility = {
|
|
1502
|
+
"kubb": ">=5.8.0",
|
|
1503
|
+
"node": ">=22"
|
|
1504
|
+
};
|
|
1505
|
+
//#endregion
|
|
1500
1506
|
//#region package.json
|
|
1501
|
-
var version = "5.1.
|
|
1507
|
+
var version = "5.1.3";
|
|
1502
1508
|
//#endregion
|
|
1503
1509
|
//#region src/resolvers/resolverFaker.ts
|
|
1504
1510
|
/**
|
|
@@ -1557,7 +1563,7 @@ const pluginFaker = (0, kubb_kit.definePlugin)({
|
|
|
1557
1563
|
meta: {
|
|
1558
1564
|
name: pluginFakerName,
|
|
1559
1565
|
version,
|
|
1560
|
-
compatibility
|
|
1566
|
+
compatibility
|
|
1561
1567
|
},
|
|
1562
1568
|
dependencies: { [_kubb_plugin_ts.pluginTsName]: {} },
|
|
1563
1569
|
setup(options) {
|