Migrating
While we try to avoid breaking changes, sometimes it's unavoidable in order to offer you the latest features. This page lists changes that require updates to your code. If you run into an issue with migration, please open an issue.
@next
These changes haven't been released yet. However, you can migrate your code today to save time on migration once they're released.
Deprecated exports from index.ts
Currently, index.ts
file exports all generated artifacts. We will be slowly moving away from this practice.
export { ApiError } from './core/ApiError';
export { CancelablePromise, CancelError } from './core/CancelablePromise';
export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI';
export * from './models';
export * from './schemas';
export * from './services';
Any non-core related imports should be imported as
import type { Model } from 'client/models';
import { $Schema } from 'client/schemas';
import { DefaultService } from 'client/services';
You don't have to update imports from core
directory. These will be addressed in later releases.
Deprecated useOptions
This config option is deprecated and will be removed.
Deprecated postfixServices
This config option is deprecated and will be removed.
Deprecated request
This config option is deprecated and will be removed.
Deprecated name
This config option is deprecated and will be removed.
v0.39.0
Single enums.gen.ts
file
Enums are now exported from a separate file. If you use imports from models.ts
, you can change them to enums.gen.ts
.
import { Enum } from 'client/models'
import { Enum } from 'client/enums.gen'
Renamed models.ts
file
models.ts
is now called models.gen.ts
. If you use imports from models.ts
, you should be able to easily find and replace all instances.
import type { Model } from 'client/models'
import type { Model } from 'client/models.gen'
Renamed schemas.ts
file
schemas.ts
is now called schemas.gen.ts
. If you use imports from schemas.ts
, you should be able to easily find and replace all instances.
import { $Schema } from 'client/schemas'
import { $Schema } from 'client/schemas.gen'
Renamed services.ts
file
services.ts
is now called services.gen.ts
. If you use imports from services.ts
, you should be able to easily find and replace all instances.
import { DefaultService } from 'client/services'
import { DefaultService } from 'client/services.gen'
Deprecated exports from index.ts
Until this release, index.ts
file exported all generated artifacts. Starting from this release, enums are no longer exported from index.ts
. Models, schemas, and services will continue to be exported from index.ts
to avoid a huge migration lift, but we recommend migrating to import groups per artifact type.
import { Enum, type Model, $Schema, DefaultService } from 'client'
import { Enum } from 'client/enums.gen'
import type { Model } from 'client/models.gen'
import { $Schema } from 'client/schemas.gen'
import { DefaultService } from 'client/services.gen'
v0.38.0
Renamed write
This config option is now called dryRun
(file) or --dry-run
(CLI). To restore existing functionality, invert the value, ie. write: true
is dryRun: false
and write: false
is dryRun: true
.
v0.36.0
JSON Schema 2020-12
Schemas are exported directly from OpenAPI specification. This means your schemas might change depending on which OpenAPI version you're using. If this release caused a field to be removed, consult the JSON Schema documentation on how to obtain the same value from JSON Schema (eg. required properties).
Renamed exportSchemas
This config option is now called schemas
.
v0.35.0
Removed postfixModels
This config option has been removed.
v0.34.0
Single services.ts
file
Services are now exported from a single file. If you used imports from individual service files, these will need to be updated to refer to the single services.ts
file.
v0.31.1
Merged enums options
useLegacyEnums
config option is now enums: 'typescript'
and existing enums: true
option is now enums: 'javascript'
.
v0.31.0
Single models.ts
file
TypeScript interfaces are now exported from a single file. If you used imports from individual model files, these will need to be updated to refer to the single models.ts
file.
Single schemas.ts
file
Schemas are now exported from a single file. If you used imports from individual schema files, these will need to be updated to refer to the single schemas.ts
file.
v0.27.38
useOptions: true
By default, generated clients will use a single object argument to pass values to API calls. This is a significant change from the previous default of unspecified array of arguments. If migrating your application in one go isn't feasible, we recommend deprecating your old client and generating a new client.
import { DefaultService } from 'client/services' // <-- old client with array arguments
import { DefaultService } from 'client_v2/services' // <-- new client with options argument
This way, you can gradually switch over to the new syntax as you update parts of your code. Once you've removed all instances of client
imports, you can safely delete the old client
folder and find and replace all client_v2
calls to client
.
v0.27.36
exportSchemas: true
By default, we will create schemas from your OpenAPI specification. Use exportSchemas: false
to preserve the old behavior.
v0.27.32
Renamed Config
interface
This interface is now called UserConfig
.
v0.27.29
Renamed openapi
CLI command
This command is now called openapi-ts
.
v0.27.26
Removed indent
This config option has been removed. Use a code formatter to modify the generated files code style according to your preferences.
v0.27.24
Removed useUnionTypes
This config option has been removed. Generated types will behave the same as useUnionTypes: true
before.
OpenAPI TypeScript Codegen
openapi-ts
was originally forked from Ferdi Koomen's openapi-typescript-codegen. Therefore, we want you to be able to migrate your projects. Migration should be relatively straightforward if you follow the release notes on this page. Start here and scroll up to the release you're migrating to.