Skip to content

Migration: @kubb/plugin-cypress

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

resolver.name replaces transformers.name. The generators option is gone.

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 }. Its path, query, and headers members are the @kubb/plugin-ts *Options sub-types, so their property names are the ones from the OpenAPI document.

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

The helper signature changes from positional arguments to one object. The first argument is the grouped options type that @kubb/plugin-ts generates for the operation (for example ShowPetByIdOptions). When an operation has a required parameter in a group, that group (path, query, or headers) is required too. The trailing options argument, typed Partial<Cypress.RequestOptions>, is unchanged.

diff
showPetById(2, { limit: 10 })
showPetById({ path: { petId: 2 }, query: { limit: 10 } })
diff
export function showPetById(petId: number, query?: ShowPetByIdQueryParams, options = {}) {}
export function showPetById({ path, query }: ShowPetByIdOptions, options: Partial<Cypress.RequestOptions> = {}) {}

Removed: dataReturnType

dataReturnType is gone. Every helper now yields the response body, typed Cypress.Chainable<T>, so the 'data' and 'full' choice no longer applies.

Diff
diff
  pluginCypress({
   dataReturnType: 'data',
  })

baseURL stays the same, and exclude, include, and override keep their v4 shape. Cypress has no validator option, unlike the client plugins.

Generated output

Two things change. HTTP method constants are now uppercase ('post' becomes 'POST'), and imports follow the new *Options / *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 { AddPetOptions, AddPetResponse } from '../../models.ts'
 export function addPet({ body }: AddPetOptions, options: Partial<Cypress.RequestOptions> = {}): Cypress.Chainable<AddPetResponse> {
   return cy.request<AddPetResponse>({
     method: 'POST',
     url: `http://localhost:3000/pet`,