Beta You're reading the docs for Kubb v5, which is currently in beta. View the stable v4 docs
Skip to content

Migration: @kubb/plugin-cypress

Part of the v4 → v5 migration guide. For the full option reference, see @kubb/plugin-cypress.

resolver.resolveName replaces transformers.name.

Removed: paramsType, pathParamsType, paramsCasing

These three options are gone. Each request helper now takes a single grouped options object shaped as { body, path, query, headers } with camelCase property names. The request still sends the original parameter names from the spec, and Kubb writes that mapping for you.

Diff
diff
  pluginCypress({
-   paramsType: 'object',
-   pathParamsType: 'object',
-   paramsCasing: 'camelcase',
  })

The helper signature changes from positional arguments to one object. The first argument is typed Omit<XxxRequestConfig, 'url'>, the RequestConfig type @kubb/plugin-ts generates. When an operation has a required parameter in a group, that group (path, query, or headers) is required too. The trailing options argument is unchanged.

typescript
showPetById(2, { limit: 10 }) 
showPetById({ path: { petId: 2 }, query: { limit: 10 } }) 
typescript
export function showPetById(petId: number, query?: ShowPetByIdQueryParams, options = {}) {}
export function showPetById({ path, query }: Omit<ShowPetByIdRequestConfig, 'url'>, options = {}) {}

Generated output

Two things change. HTTP method constants are now uppercase ('post' becomes 'POST'), and imports follow the new *Data / *Response naming.

Diff
diff
- import type { AddPetMutationRequest, AddPetMutationResponse } from '../../models/AddPet.ts'
- export function addPet(data: AddPetMutationRequest): Cypress.Chainable<AddPetMutationResponse> {
-   return cy.request<AddPetMutationResponse>({
-     method: 'post',
-     url: 'http://localhost:3000/pet',
+ import type { AddPetData, AddPetResponse } from '../../models.ts'
+ export function addPet(data: AddPetData): Cypress.Chainable<AddPetResponse> {
+   return cy.request<AddPetResponse>({
+     method: 'POST',
+     url: `http://localhost:3000/pet`,