Migration: @kubb/plugin-faker
Part of the v4 → v5 migration guide. See the full option reference in @kubb/plugin-faker.
dateType, integerType, unknownType, and emptySchemaType moved to adapterOas. See Migration: @kubb/adapter-oas. resolver.resolveName replaces transformers.name.
Removed: paramsCasing
typescript
pluginFaker({ paramsCasing: 'camelcase' })Properties inside the generated path, query, and header mocks are now always camelCase, so drop the option. This keeps the mocks assignable to the types from @kubb/plugin-ts, which also camelCases parameters.
Generated output
Stricter return type and intermediate variable
The create prefix stays (createPet is still createPet), matching the naming plugin-msw uses. The return type and internal structure change.
diff
- export function createPet(data?: Partial<Pet>): Pet {
- return {
- ...{
- id: faker.number.int(),
- ...
- },
- ...(data || {}),
- }
- }
+ export function createPet(data?: Partial<Pet>): Required<Pet> {
+ const defaultFakeData = {
+ id: faker.number.int(),
+ ...
+ }
+ return {
+ ...defaultFakeData,
+ ...(data || {}),
+ } as Required<Pet>
+ }Required<Pet> guarantees callers see populated fields even when the schema marks them optional.