diff --git a/.changeset/shaggy-otters-vanish.md b/.changeset/shaggy-otters-vanish.md new file mode 100644 index 000000000..5479d37d4 --- /dev/null +++ b/.changeset/shaggy-otters-vanish.md @@ -0,0 +1,9 @@ +--- +'@example/openapi-ts-fastify': minor +'@hey-api/client-axios': minor +'@hey-api/client-fetch': minor +'@hey-api/openapi-ts': minor +'@hey-api/docs': minor +--- + +feat: change the default parser diff --git a/README.md b/README.md index 4d387a2d7..821300fa9 100644 --- a/README.md +++ b/README.md @@ -178,35 +178,6 @@ Clients are responsible for sending the actual HTTP requests. The `client` value You can learn more on the [Clients](https://heyapi.dev/openapi-ts/clients) page. -### Parser - -If you're NOT using a legacy client, we encourage you to try out the experimental parser. Soon, it will become the default parser, but until it's been tested it's an opt-in feature. To try it out, set the `experimentalParser` flag in your configuration to `true`. - -#### config - -```js -export default { - client: '@hey-api/client-fetch', - experimentalParser: true, - input: 'path/to/openapi.json', - output: 'src/client', -}; -``` - -#### cli - -```sh -npx @hey-api/openapi-ts \ - -c @hey-api/client-fetch \ - -e \ - -i path/to/openapi.json \ - -o src/client -``` - -The experimental parser produces a cleaner output while being faster than the legacy parser. It also supports features such as [Filters](https://heyapi.dev/openapi-ts/configuration#filters) and more are being added. - -The legacy parser will be used with the [legacy clients](https://heyapi.dev/openapi-ts/clients/legacy) regardless of the `experimentalParser` flag value. However, it's unlikely to receive any further updates. - ## Plugins Plugins are responsible for generating artifacts from your input. By default, Hey API will generate TypeScript interfaces and SDK from your OpenAPI specification. You can add, remove, or customize any of the plugins. In fact, we highly encourage you to do so! diff --git a/docs/openapi-ts/clients/axios.md b/docs/openapi-ts/clients/axios.md index 5be1bb649..b71bff747 100644 --- a/docs/openapi-ts/clients/axios.md +++ b/docs/openapi-ts/clients/axios.md @@ -151,10 +151,6 @@ const response = await getFoo({ ## Auth -::: warning -To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). -::: - The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. ```js @@ -179,10 +175,6 @@ client.instance.interceptors.request.use((config) => { ## Build URL -::: warning -To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). -::: - If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. ```ts diff --git a/docs/openapi-ts/clients/fetch.md b/docs/openapi-ts/clients/fetch.md index dd4ac9390..78b86cf05 100644 --- a/docs/openapi-ts/clients/fetch.md +++ b/docs/openapi-ts/clients/fetch.md @@ -190,10 +190,6 @@ const response = await getFoo({ ## Auth -::: warning -To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). -::: - The SDKs include auth mechanisms for every endpoint. You will want to configure the `auth` field to pass the right token for each request. The `auth` field can be a string or a function returning a string representing the token. The returned value will be attached only to requests that require auth. ```js @@ -218,10 +214,6 @@ client.interceptors.request.use((request, options) => { ## Build URL -::: warning -To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). -::: - If you need to access the compiled URL, you can use the `buildUrl()` method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint. ```ts diff --git a/docs/openapi-ts/configuration.md b/docs/openapi-ts/configuration.md index 7fa235a63..c4440a469 100644 --- a/docs/openapi-ts/configuration.md +++ b/docs/openapi-ts/configuration.md @@ -94,35 +94,6 @@ Plugins are responsible for generating artifacts from your input. By default, He You can learn more on the [Output](/openapi-ts/output) page. -## Parser - -If you're NOT using a legacy client, we encourage you to try out the experimental parser. Soon, it will become the default parser, but until it's been tested it's an opt-in feature. To try it out, set the `experimentalParser` flag in your configuration to `true`. - -::: code-group - -```js [config] -export default { - client: '@hey-api/client-fetch', - experimentalParser: true, // [!code ++] - input: 'path/to/openapi.json', - output: 'src/client', -}; -``` - -```sh [cli] -npx @hey-api/openapi-ts \ - -c @hey-api/client-fetch \ - -e \ # [!code ++] - -i path/to/openapi.json \ - -o src/client -``` - -::: - -The experimental parser produces a cleaner output while being faster than the legacy parser. It also supports features such as [Filters](#filters) and more are being added. - -The legacy parser will be used with the [legacy clients](/openapi-ts/clients/legacy) regardless of the `experimentalParser` flag value. However, it's unlikely to receive any further updates. - ## Formatting To format your output folder contents, set `output.format` to a valid formatter. @@ -222,10 +193,6 @@ You can also prevent your output from being linted by adding your output path to ## Filters -::: warning -To use this feature, you must opt in to the [experimental parser](#parser). -::: - If you work with large specifications and want to generate output from their subset, you can use regular expressions to select the relevant definitions. Set `input.include` to match resource references to be included or `input.exclude` to match resource references to be excluded. When both regular expressions match the same definition, `input.exclude` takes precedence over `input.include`. ::: code-group @@ -233,7 +200,6 @@ If you work with large specifications and want to generate output from their sub ```js [include] export default { client: '@hey-api/client-fetch', - experimentalParser: true, // [!code ++] input: { // match only the schema named `foo` and `GET` operation for the `/api/v1/foo` path // [!code ++] include: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code ++] @@ -246,7 +212,6 @@ export default { ```js [exclude] export default { client: '@hey-api/client-fetch', - experimentalParser: true, // [!code ++] input: { // match everything except for the schema named `foo` and `GET` operation for the `/api/v1/foo` path // [!code ++] exclude: '^(#/components/schemas/foo|#/paths/api/v1/foo/get)$', // [!code ++] diff --git a/docs/openapi-ts/custom-plugin.md b/docs/openapi-ts/custom-plugin.md index 855f70ecb..1b8e25dd7 100644 --- a/docs/openapi-ts/custom-plugin.md +++ b/docs/openapi-ts/custom-plugin.md @@ -99,10 +99,6 @@ Re-exporting your plugin from `index.ts` may result in broken output due to nami ## Handler -::: warning -To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). -::: - Notice we defined `_handler` in our `config.ts` file. This method is responsible for generating the actual output. We recommend implementing it in `plugin.ts`. ::: code-group diff --git a/docs/openapi-ts/migrating.md b/docs/openapi-ts/migrating.md index d2bd4c550..75099fbac 100644 --- a/docs/openapi-ts/migrating.md +++ b/docs/openapi-ts/migrating.md @@ -27,6 +27,23 @@ This config option is deprecated and will be removed in favor of [clients](./cli This config option is deprecated and will be removed. +## v0.62.0 + +### Changed parser + +Formerly known as the experimental parser, this is now the default parser. This change should not impact the generated output's functionality. However, there might be cases where this results in breaking changes due to different handling of certain scenarios. If you need to revert to the legacy parser, set the `experimentalParser` flag to `false`. + +```js +export default { + client: '@hey-api/client-fetch', + experimentalParser: false, // [!code ++] + input: 'path/to/openapi.json', + output: 'src/client', +}; +``` + +Note that the legacy parser is no longer supported and will be removed in the v1 release. + ## v0.61.0 ### Added `auth` option diff --git a/docs/openapi-ts/plugins/fastify.md b/docs/openapi-ts/plugins/fastify.md index 744b07b0f..fd1fd1011 100644 --- a/docs/openapi-ts/plugins/fastify.md +++ b/docs/openapi-ts/plugins/fastify.md @@ -23,10 +23,6 @@ Live demo ## Installation -::: warning -To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). -::: - In your [configuration](/openapi-ts/get-started), add `fastify` to your plugins and you'll be ready to generate Fastify artifacts. :tada: ```js @@ -34,7 +30,6 @@ import { defaultPlugins } from '@hey-api/openapi-ts'; export default { client: '@hey-api/client-fetch', - experimentalParser: true, // [!code ++] input: 'path/to/openapi.json', output: 'src/client', plugins: [ diff --git a/docs/openapi-ts/plugins/zod.md b/docs/openapi-ts/plugins/zod.md index 1a5d9a3fb..4c9c34543 100644 --- a/docs/openapi-ts/plugins/zod.md +++ b/docs/openapi-ts/plugins/zod.md @@ -22,10 +22,6 @@ Live demo ## Installation -::: warning -To use this feature, you must opt in to the [experimental parser](/openapi-ts/configuration#parser). -::: - In your [configuration](/openapi-ts/get-started), add `zod` to your plugins and you'll be ready to generate Zod artifacts. :tada: ```js @@ -33,7 +29,6 @@ import { defaultPlugins } from '@hey-api/openapi-ts'; export default { client: '@hey-api/client-fetch', - experimentalParser: true, // [!code ++] input: 'path/to/openapi.json', output: 'src/client', plugins: [ diff --git a/examples/openapi-ts-fastify/openapi-ts.config.ts b/examples/openapi-ts-fastify/openapi-ts.config.ts index 127760c88..e3d638c8a 100644 --- a/examples/openapi-ts-fastify/openapi-ts.config.ts +++ b/examples/openapi-ts-fastify/openapi-ts.config.ts @@ -2,7 +2,6 @@ import { defineConfig } from '@hey-api/openapi-ts'; export default defineConfig({ client: '@hey-api/client-fetch', - experimentalParser: true, input: 'https://gist.githubusercontent.com/seriousme/55bd4c8ba2e598e416bb5543dcd362dc/raw/cf0b86ba37bb54bf1a6bf047c0ecf2a0ce4c62e0/petstore-v3.1.json', output: { diff --git a/packages/client-axios/src/types.ts b/packages/client-axios/src/types.ts index 49c0619ff..333e77d69 100644 --- a/packages/client-axios/src/types.ts +++ b/packages/client-axios/src/types.ts @@ -17,8 +17,6 @@ type OmitKeys = Pick>; export interface Config extends Omit { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Auth token or a function returning auth token. The resolved value will be * added to the request payload as defined by its `security` array. */ @@ -85,8 +83,6 @@ export interface Config */ responseTransformer?: (data: unknown) => Promise; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * A function validating response data. This is useful if you want to ensure * the response conforms to the desired shape, so it can be safely passed to * the transformers and returned to the user. diff --git a/packages/client-fetch/src/types.ts b/packages/client-fetch/src/types.ts index 9b8d6d852..d23859671 100644 --- a/packages/client-fetch/src/types.ts +++ b/packages/client-fetch/src/types.ts @@ -10,8 +10,6 @@ type OmitKeys = Pick>; export interface Config extends Omit { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Auth token or a function returning auth token. The resolved value will be * added to the request payload as defined by its `security` array. */ @@ -90,8 +88,6 @@ export interface Config */ responseTransformer?: (data: unknown) => Promise; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * A function validating response data. This is useful if you want to ensure * the response conforms to the desired shape, so it can be safely passed to * the transformers and returned to the user. diff --git a/packages/openapi-ts/README.md b/packages/openapi-ts/README.md index 4d387a2d7..821300fa9 100644 --- a/packages/openapi-ts/README.md +++ b/packages/openapi-ts/README.md @@ -178,35 +178,6 @@ Clients are responsible for sending the actual HTTP requests. The `client` value You can learn more on the [Clients](https://heyapi.dev/openapi-ts/clients) page. -### Parser - -If you're NOT using a legacy client, we encourage you to try out the experimental parser. Soon, it will become the default parser, but until it's been tested it's an opt-in feature. To try it out, set the `experimentalParser` flag in your configuration to `true`. - -#### config - -```js -export default { - client: '@hey-api/client-fetch', - experimentalParser: true, - input: 'path/to/openapi.json', - output: 'src/client', -}; -``` - -#### cli - -```sh -npx @hey-api/openapi-ts \ - -c @hey-api/client-fetch \ - -e \ - -i path/to/openapi.json \ - -o src/client -``` - -The experimental parser produces a cleaner output while being faster than the legacy parser. It also supports features such as [Filters](https://heyapi.dev/openapi-ts/configuration#filters) and more are being added. - -The legacy parser will be used with the [legacy clients](https://heyapi.dev/openapi-ts/clients/legacy) regardless of the `experimentalParser` flag value. However, it's unlikely to receive any further updates. - ## Plugins Plugins are responsible for generating artifacts from your input. By default, Hey API will generate TypeScript interfaces and SDK from your OpenAPI specification. You can add, remove, or customize any of the plugins. In fact, we highly encourage you to do so! diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 414163a42..730229715 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -489,7 +489,7 @@ const initConfigs = async (userConfig: UserConfig): Promise => { base, configFile = '', dryRun = false, - experimentalParser = false, + experimentalParser = true, exportCore = true, name, request, diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts index 84a8ccb8b..497e16e3e 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts @@ -16,8 +16,6 @@ export interface Config extends Plugin.Name<'@hey-api/sdk'> { */ asClass?: boolean; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Should the generated functions contain auth mechanisms? You may want to * disable this option if you're handling auth yourself or defining it * globally on the client and want to reduce the size of generated code. @@ -26,6 +24,8 @@ export interface Config extends Plugin.Name<'@hey-api/sdk'> { */ auth?: boolean; /** + * @deprecated + * * **This feature works only with the legacy parser** * * Filter endpoints to be included in the generated SDK. The provided @@ -33,8 +33,6 @@ export interface Config extends Plugin.Name<'@hey-api/sdk'> { * included in the output. The input pattern this string will be tested * against is `{method} {path}`. For example, you can match * `POST /api/v1/foo` with `^POST /api/v1/foo$`. - * - * @deprecated */ filter?: string; /** @@ -96,8 +94,6 @@ export interface Config extends Plugin.Name<'@hey-api/sdk'> { */ transformer?: '@hey-api/transformers' | boolean; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Validate response data against schema before returning. This is useful * if you want to ensure the response conforms to a desired shape. However, * validation adds runtime overhead, so it's not recommended to use unless diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts index cc7a949ec..2c4de9e19 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts @@ -2,8 +2,6 @@ import type { Plugin } from '../../types'; export interface Config extends Plugin.Name<'@hey-api/transformers'> { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Convert long integers into BigInt values? * * @default true diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts index 4db3fa823..1dd7bdc37 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts @@ -11,8 +11,6 @@ export interface Config extends Plugin.Name<'@hey-api/typescript'> { */ enums?: 'javascript' | 'typescript' | 'typescript+namespace' | false; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Defines casing of the enum keys. By default, we use `SCREAMING_SNAKE_CASE`. * This option has effect only when `enums` is defined. * @@ -20,8 +18,6 @@ export interface Config extends Plugin.Name<'@hey-api/typescript'> { */ enumsCase?: StringCase; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * By default, inline enums (enums not defined as reusable components in * the input file) are generated as inlined union types. You can set * `exportInlineEnums` to `true` to treat inline enums as reusable components. @@ -31,19 +27,17 @@ export interface Config extends Plugin.Name<'@hey-api/typescript'> { */ exportInlineEnums?: boolean; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Defines casing of the identifiers. By default, we use `PascalCase`. * * @default 'PascalCase' */ identifierCase?: Exclude; /** + * @deprecated + * * **This feature works only with the legacy parser** * * Include only types matching regular expression. - * - * @deprecated */ include?: string; /** @@ -53,24 +47,24 @@ export interface Config extends Plugin.Name<'@hey-api/typescript'> { */ output?: string; /** + * @deprecated + * * **This feature works only with the legacy parser** * * Use your preferred naming pattern * * @default 'preserve' - * - * @deprecated */ style?: 'PascalCase' | 'preserve'; /** + * @deprecated + * * **This feature works only with the legacy parser** * * Generate a tree of types containing all operations? It will be named * $OpenApiTs. * * @default false - * - * @deprecated */ tree?: boolean; } diff --git a/packages/openapi-ts/src/plugins/types.d.ts b/packages/openapi-ts/src/plugins/types.d.ts index f5d6296b6..396b33364 100644 --- a/packages/openapi-ts/src/plugins/types.d.ts +++ b/packages/openapi-ts/src/plugins/types.d.ts @@ -32,8 +32,6 @@ export interface PluginContext { interface BaseConfig { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Should the exports from the plugin's file be re-exported in the index * barrel file? */ @@ -107,8 +105,9 @@ export namespace Plugin { Pick, 'exportFromIndex' | 'output'>; /** - * Plugin implementation for legacy parser. Use only if you need to support - * OpenAPI 2.0 since that isn't supported by the experimental parser yet. + * @deprecated + * + * Plugin implementation for legacy parser. */ export type LegacyHandler = (args: { client: Client; diff --git a/packages/openapi-ts/src/types/config.ts b/packages/openapi-ts/src/types/config.ts index 0f632e3a4..9a421a659 100644 --- a/packages/openapi-ts/src/types/config.ts +++ b/packages/openapi-ts/src/types/config.ts @@ -63,12 +63,6 @@ export interface ClientConfig { * @default false */ dryRun?: boolean; - /** - * Opt in to the experimental parser? - * - * @default false - */ - experimentalParser?: boolean; /** * Path to the OpenAPI specification. This can be either local or remote path. * Both JSON and YAML file formats are supported. You can also pass the parsed @@ -81,8 +75,6 @@ export interface ClientConfig { | Record | { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Prevent parts matching the regular expression from being processed. * You can select both operations and components by reference within * the bundled input. In case of conflicts, `exclude` takes precedence @@ -94,8 +86,6 @@ export interface ClientConfig { */ exclude?: string; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Process only parts matching the regular expression. You can select both * operations and components by reference within the bundled input. In * case of conflicts, `exclude` takes precedence over `include`. @@ -159,8 +149,6 @@ export interface ClientConfig { | string | { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Defines casing of the output fields. By default, we preserve `input` * values as data transforms incur a performance penalty at runtime. * @@ -202,71 +190,79 @@ export interface ClientConfig { */ plugins?: ReadonlyArray; /** - * Manually set base in OpenAPI config instead of inferring from server value + * Regenerate the client when the input file changes? * + * @default false + */ + watch?: + | boolean + | number + | { + /** + * Regenerate the client when the input file changes? + * + * @default false + */ + enabled?: boolean; + /** + * How often should we attempt to detect the input file change? + * + * @default 1000 + */ + interval?: number; + }; + /** * @deprecated + * + * Manually set base in OpenAPI config instead of inferring from server value */ // eslint-disable-next-line typescript-sort-keys/interface base?: string; /** - * Generate core client classes? + * @deprecated * + * Opt in to the experimental parser? + * + * @default true + */ + experimentalParser?: boolean; + /** * @deprecated * + * Generate core client classes? + * * @default true */ exportCore?: boolean; /** + * @deprecated + * * Custom client class name. Please note this option is deprecated and * will be removed in favor of clients. * * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-name - * - * @deprecated */ name?: string; /** + * @deprecated + * * Path to custom request file. Please note this option is deprecated and * will be removed in favor of clients. * * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-request - * - * @deprecated */ request?: string; /** + * @deprecated + * * Use options or arguments functions. Please note this option is deprecated and * will be removed in favor of clients. * * @link https://heyapi.dev/openapi-ts/migrating.html#deprecated-useoptions * - * @deprecated - * * @default true */ useOptions?: boolean; - /** - * Regenerate the client when the input file changes? - * - * @default false - */ - watch?: - | boolean - | number - | { - /** - * Regenerate the client when the input file changes? - * - * @default false - */ - enabled?: boolean; - /** - * How often should we attempt to detect the input file change? - * - * @default 1000 - */ - interval?: number; - }; } export type UserConfig = ClientConfig; diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/types.ts.snap index 49c0619ff..333e77d69 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/types.ts.snap @@ -17,8 +17,6 @@ type OmitKeys = Pick>; export interface Config extends Omit { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Auth token or a function returning auth token. The resolved value will be * added to the request payload as defined by its `security` array. */ @@ -85,8 +83,6 @@ export interface Config */ responseTransformer?: (data: unknown) => Promise; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * A function validating response data. This is useful if you want to ensure * the response conforms to the desired shape, so it can be safely passed to * the transformers and returned to the user. diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/sdk.gen.ts.snap index 0dd5913af..9979bc332 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/sdk.gen.ts.snap @@ -1,354 +1,383 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser, formDataBodySerializer, urlSearchParamsBodySerializer } from './client'; -import type { ImportData, ImportError, ImportResponse, ApiVVersionODataControllerCountError, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from './client'; +import type { ExportData, ImportData, ImportResponse, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, DummyAData, DummyAResponse, DummyBData, DummyBResponse, CallWithResponseData, CallWithResponseResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithResponsesData, CallWithResponsesResponse, CallWithResponsesError, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, ComplexTypesResponse, MultipartResponseData, MultipartResponseResponse, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); -export const export_ = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-tag' +export const export_ = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-tag', + ...options }); }; -export const import_ = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const import_ = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/no-tag', ...options, - url: '/api/v{api-version}/no-tag' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const apiVVersionODataControllerCount = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple/$count' +export const apiVVersionODataControllerCount = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple/$count', + ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: OptionsLegacyParser) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple:operation' + url: '/api/v{api-version}/simple:operation', + ...options }); }; -export const getCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple' +export const deleteCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const putCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/simple' +export const getCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const postCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/simple' +export const headCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).head({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/simple' +export const optionsCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).options({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).options({ - ...options, - url: '/api/v{api-version}/simple' +export const patchCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).patch({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const headCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).head({ - ...options, - url: '/api/v{api-version}/simple' +export const postCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const patchCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).patch({ - ...options, - url: '/api/v{api-version}/simple' +export const putCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteFoo = (options: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' +export const deleteFoo = (options: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + ...options }); }; -export const callWithDescriptions = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/descriptions/' +export const callWithDescriptions = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/descriptions/', + ...options }); }; /** * @deprecated */ -export const deprecatedCall = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/deprecated' +export const deprecatedCall = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/deprecated', + ...options }); }; -export const callWithParameters = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithParameters = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameterPath}', ...options, - url: '/api/v{api-version}/parameters/{parameterPath}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const callWithWeirdParameterNames = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithWeirdParameterNames = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const getCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const getCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionRequestBody = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postApiVbyApiVersionRequestBody = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/requestBody/', ...options, - url: '/api/v{api-version}/requestBody/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionFormData = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const postApiVbyApiVersionFormData = (options?: Options) => { + return (options?.client ?? client).post({ ...formDataBodySerializer, + url: '/api/v{api-version}/formData/', + ...options, headers: { 'Content-Type': null, ...options?.headers - }, - url: '/api/v{api-version}/formData/' + } }); }; -export const callWithDefaultParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultParameters = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callWithDefaultOptionalParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultOptionalParameters = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callToTestOrderOfParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/defaults' +export const callToTestOrderOfParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const duplicateName = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName1 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName2 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName3 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const callWithNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-content' +export const callWithNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-content', + ...options }); }; -export const callWithResponseAndNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' +export const callWithResponseAndNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); }; -export const dummyA = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' +export const dummyA = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); }; -export const dummyB = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' +export const dummyB = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); }; -export const callWithResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/response' +export const callWithResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithDuplicateResponses = (options?: OptionsLegacyParser) => { +export const callWithDuplicateResponses = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithResponses = (options?: OptionsLegacyParser) => { +export const callWithResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const collectionFormat = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/collectionFormat' +export const collectionFormat = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/collectionFormat', + ...options }); }; -export const types = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/types' +export const types = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/types', + ...options }); }; -export const uploadFile = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const uploadFile = (options: Options) => { + return (options?.client ?? client).post({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/upload', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/upload' + } }); }; -export const fileResponse = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/file/{id}' +export const fileResponse = (options: Options) => { + return (options?.client ?? client).get({ + responseType: 'blob', + url: '/api/v{api-version}/file/{id}', + ...options }); }; -export const complexTypes = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/complex' +export const complexTypes = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/complex', + ...options }); }; -export const multipartRequest = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - ...formDataBodySerializer, - headers: { - 'Content-Type': null, - ...options?.headers - }, - url: '/api/v{api-version}/multipart' +export const multipartResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multipart', + ...options }); }; -export const multipartResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const multipartRequest = (options?: Options) => { + return (options?.client ?? client).post({ + ...formDataBodySerializer, + url: '/api/v{api-version}/multipart', ...options, - url: '/api/v{api-version}/multipart' + headers: { + 'Content-Type': null, + ...options?.headers + } }); }; -export const complexParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ +export const complexParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/complex/{id}', ...options, - url: '/api/v{api-version}/complex/{id}' + headers: { + 'Content-Type': 'application/json-patch+json', + ...options?.headers + } }); }; -export const callWithResultFromHeader = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/header' +export const callWithResultFromHeader = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/header', + ...options }); }; -export const testErrorCode = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/error' +export const testErrorCode = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/error', + ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options }); }; /** * Login User */ -export const putWithFormUrlEncoded = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const putWithFormUrlEncoded = (options: Options) => { + return (options?.client ?? client).put({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + } }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap index 77cbc3d07..6e06eeedb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/types.gen.ts.snap @@ -1,306 +1,255 @@ // This file is auto-generated by @hey-api/openapi-ts -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - /** * Model with number-only name */ export type _400 = string; -export type _default = { - name?: string; -}; - /** - * Model with restricted keyword name + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type _import = string; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; +export type CamelCaseCommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; +export type CommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; +export type CommentWithBackticks = number; /** - * This is a simple array containing an array + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work */ -export type ArrayWithArray = Array>; +export type CommentWithBackticksAndQuotes = number; /** - * This is a simple array with booleans + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ -export type ArrayWithBooleans = Array<(boolean)>; +export type CommentWithSlashes = number; /** - * This is a simple array with numbers + * Testing expression placeholders in string: ${expression} should work */ -export type ArrayWithNumbers = Array<(number)>; +export type CommentWithExpressionPlaceholders = number; /** - * This is a simple array with properties + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; +export type CommentWithQuotes = number; /** - * This is a simple array with references + * Testing reserved characters in string: * inline * and ** inline ** should work */ -export type ArrayWithReferences = Array; +export type CommentWithReservedCharacters = number; /** - * This is a simple array with strings + * This is a simple number */ -export type ArrayWithStrings = Array<(string)>; +export type SimpleInteger = number; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple boolean */ -export type camelCaseCommentWithBreaks = number; +export type SimpleBoolean = boolean; /** - * Some % character + * This is a simple string */ -export type CharactersInDescription = string; +export type SimpleString = string; /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) */ -export type CommentWithBackticks = number; +export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; /** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + * This is a simple file */ -export type CommentWithBackticksAndQuotes = number; +export type SimpleFile = unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple reference */ -export type CommentWithBreaks = number; +export type SimpleReference = ModelWithString; /** - * Testing expression placeholders in string: ${expression} should work + * This is a simple string */ -export type CommentWithExpressionPlaceholders = number; +export type SimpleStringWithPattern = string; /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work + * This is a simple enum with strings */ -export type CommentWithQuotes = number; +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * This is a simple enum with strings */ -export type CommentWithReservedCharacters = number; +export const EnumWithStrings = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'NON_ASCII:_ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' +} as const; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharacters = { + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', + '3_1': 3.1, + '': '' +} as const; /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work + * This is a simple enum with numbers */ -export type CommentWithSlashes = number; +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; /** - * This is a base model with two simple optional properties + * This is a simple enum with numbers */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; +export const EnumWithNumbers = { + 1: 1, + 2: 2, + 3: 3, + '1_1': 1.1, + '1_2': 1.2, + '1_3': 1.3, + 100: 100, + 200: 200, + 300: 300, + '-100': -100, + '-200': -200, + '-300': -300, + '-1_1': -1.1, + '-1_2': -1.2, + '-1_3': -1.3 +} as const; /** - * This is a model that extends the base model + * Success=1,Warning=2,Error=3 */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; +export type EnumFromDescription = number; /** - * This is a model with one property with a 'all of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; +export type EnumWithExtensions = 200 | 400 | 500; /** - * This is a model with one property with a 'any of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export const EnumWithExtensions = { + /** + * Used when the status of something is successful + */ + CUSTOM_SUCCESS: 200, + /** + * Used when the status of something has a warning + */ + CUSTOM_WARNING: 400, + /** + * Used when the status of something has an error + */ + CUSTOM_ERROR: 500 +} as const; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +export const EnumWithXEnumNames = { + ZERO: 0, + ONE: 1, + TWO: 2 +} as const; /** - * This is a model with one property with a 'any of' relationship + * This is a simple array with numbers */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; +export type ArrayWithNumbers = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with booleans */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; +export type ArrayWithBooleans = Array; /** - * This is a model with nested 'any of' property with a type null + * This is a simple array with strings */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; +export type ArrayWithStrings = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with references */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; +export type ArrayWithReferences = Array; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array containing an array */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export type ArrayWithArray = Array>; /** - * This is a model that contains a dictionary of complex arrays (composited) within composition + * This is a simple array with properties */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; +export type ArrayWithProperties = Array<{ + '16x16'?: CamelCaseCommentWithBreaks; + bar?: string; +}>; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; +export type ArrayWithAnyOfProperties = Array<{ + foo?: string; } | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; + bar?: string; +}>; -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); +export type AnyOfAnyAndNull = { + data?: unknown | null; }; /** - * This is a model that contains a simple dictionary within composition + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); +export type AnyOfArrays = { + results?: Array<{ + foo?: string; + } | { + bar?: string; + }>; }; /** - * This is a model with one property with a 'one of' relationship where the options are not $ref + * This is a string dictionary */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); +export type DictionaryWithString = { + [key: string]: string; }; -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -export type ConstValue = "ConstValue"; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: string | number | boolean | undefined; +}; /** - * This is a deprecated model with a deprecated property - * @deprecated + * This is a string reference */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; +export type DictionaryWithReference = { + [key: string]: ModelWithString; }; /** @@ -315,7 +264,7 @@ export type DictionaryWithArray = { */ export type DictionaryWithDictionary = { [key: string]: { - [key: string]: (string); + [key: string]: string; }; }; @@ -329,193 +278,204 @@ export type DictionaryWithProperties = { }; }; -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - /** - * This is a string reference + * This is a model with one number property */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; }; /** - * This is a string dictionary + * This is a model with one boolean property */ -export type DictionaryWithString = { - [key: string]: (string); +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; }; /** - * Success=1,Warning=2,Error=3 + * This is a model with one string property */ -export type EnumFromDescription = number; +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * This is a model with one string property */ -export type EnumWithExtensions = 200 | 400 | 500; +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) */ -export const EnumWithExtensions = { +export type ModelFromZendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { /** - * Used when the status of something is successful + * This is a simple string property */ - CUSTOM_SUCCESS: 200, + nullableProp1?: string; /** - * Used when the status of something has a warning + * This is a simple string property */ - CUSTOM_WARNING: 400, + nullableRequiredProp1: string; /** - * Used when the status of something has an error + * This is a simple string property */ - CUSTOM_ERROR: 500 -} as const; + nullableProp2?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: string | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; /** - * This is a simple enum with numbers + * This is a model with one enum */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: true; +}; /** - * This is a simple enum with numbers + * This is a model with one enum with escaped name */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; /** - * This is a simple enum with strings + * This is a model with one enum */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; /** - * This is a simple enum with strings + * This is a model with nested enums */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: 'Success' | 'Warning' | 'Error'; + }; + dictionaryWithEnumFromDescription?: { + [key: string]: number; + }; + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; + arrayWithDescription?: Array; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; }; /** - * This is a free-form object with additionalProperties: {}. + * This is a model with one property containing a reference */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; +export type ModelWithReference = { + prop?: ModelWithProperties; }; /** - * This is a free-form object with additionalProperties: true. + * This is a model with one property containing an array */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; /** - * This is a free-form object without additionalProperties. + * This is a model with one property containing an array */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; }; }; -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - /** - * This schema was giving PascalCase transformations a hard time + * This is a deprecated model with a deprecated property + * @deprecated */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { +export type DeprecatedModel = { /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + * This is a deprecated property + * @deprecated */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); + prop?: string; }; /** - * This schema was giving PascalCase transformations a hard time + * This is a model with one property containing a circular reference */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; }; /** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type Model_From_Zendesk = string; +export type CompositionWithOneOfAnonymous = { + propA?: { + propA?: string; + } | string | number; +}; /** * Circle */ export type ModelCircle = { - kind: 'circle'; + kind: string; radius?: number; }; @@ -523,365 +483,296 @@ export type ModelCircle = { * Square */ export type ModelSquare = { - kind: 'square'; + kind: string; sideLength?: number; }; /** - * This is a model that extends another model + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & ModelSquare); + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model that extends another model + * This is a model with one property with a 'any of' relationship where the options are not $ref */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; +export type CompositionWithAnyOfAnonymous = { + propA?: { + propA?: string; + } | string | number; }; /** - * This is a model with one property and additionalProperties: true + * This is a model with nested 'any of' property with a type null */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; +export type CompositionWithNestedAnyAndTypeNull = { + propA?: Array | Array; }; -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; +export type _3eNum1Период = 'Bird' | 'Dog'; -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; +export const _3eNum1Период = { + BIRD: 'Bird', + DOG: 'Dog' +} as const; -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; +export type ConstValue = 'ConstValue'; -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: Array<_3eNum1Период | ConstValue> | null; +}; /** - * This is a model with one property containing an array + * This is a model with one property with a 'one of' relationship */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with one property containing an array + * This is a model that contains a simple dictionary within composition */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: boolean | { + [key: string]: number; + }; }; /** - * Some description with `back ticks` + * This is a model that contains a dictionary of simple arrays within composition */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one boolean property + * This is a model that contains a dictionary of complex arrays (composited) within composition */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one property containing a circular reference + * This is a model with one property with a 'all of' relationship */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; +export type CompositionWithAllOfAndNullable = { + propA?: { + boolean?: boolean; + } & ModelWithEnum & ModelWithArray & ModelWithDictionary; }; -export type ModelWithConstantSizeArray = [ - number, - number -]; - /** - * This is a model with one property containing a dictionary + * This is a model with one property with a 'any of' relationship */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; +export type CompositionWithAnyOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with duplicated imports + * This is a base model with two simple optional properties */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; }; /** - * This is a model with duplicated properties + * This is a model that extends the base model */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; +export type CompositionExtendedModel = CompositionBaseModel & { + age: number; + firstName: string; + lastname: string; }; /** - * This is a model with one enum + * This is a model with one nested property */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; }; /** - * This is a simple enum with strings + * This is a model with one nested property */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; /** - * This is a simple enum with strings + * This is a model with duplicated properties */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; /** - * These are the HTTP error code enums + * This is a model with ordered properties */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; /** - * These are the HTTP error code enums + * This is a model with duplicated imports */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; /** - * This is a model with one enum + * This is a model that extends another model */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; }; /** - * This is a model with one enum with escaped name + * This is a model that extends another model */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; }; -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** - * This is a model with one number property + * This is a model that contains a some patterns */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; }; -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; }; -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; +export type Default = { + name?: string; }; -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); +export type Pageable = { + page?: number; + size?: number; + sort?: Array; }; /** - * This is a model with nested enums + * This is a free-form object without additionalProperties. */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; }; /** - * This is a model with one nested property + * This is a free-form object with additionalProperties: true. */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; }; -export type ModelWithNullableObject = { - data?: NullableObject; +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; }; /** - * This is a model with one string property + * This is a model with one property and additionalProperties: true */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; +export type ModelWithAdditionalPropertiesEqTrue = { /** * This is a simple string property */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + prop?: string; + [key: string]: unknown | string | undefined; }; -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; +}) & { + baz: number; + qux: number; }; /** - * Период + * An object that can be null */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NullableObject = { + foo?: string; +} | null; /** - * Период + * Some % character */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; +export type CharactersInDescription = string; -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; +export type ModelWithNullableObject = { + data?: NullableObject; }; export type ModelWithOneOfEnum = { @@ -895,64 +786,38 @@ export type ModelWithOneOfEnum = { foo: 'Quux'; } | { content: [ - (string), - (string) + unknown, + unknown ]; foo: 'Corge'; }; -export type foo = 'Bar'; +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export const ModelWithNestedArrayEnumsDataFoo = { + FOO: 'foo', + BAR: 'bar' +} as const; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const foo = { - BAR: 'Bar' +export const ModelWithNestedArrayEnumsDataBar = { + BAZ: 'baz', + QUX: 'qux' } as const; -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; }; -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; }; -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; }; export type ModelWithReadOnlyAndWriteOnly = { @@ -961,81 +826,116 @@ export type ModelWithReadOnlyAndWriteOnly = { baz: string; }; -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; +export type ModelWithConstantSizeArray = [ + number, + number +]; -/** - * This is a model with one string property - */ -export type ModelWithString = { +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + number | string, + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + number | string, + number | string, + number | string +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + number | Import, + number | Import +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + number & string, + number & string +]; + +export type ModelWithNumericEnumUnion = { /** - * This is a simple string property + * Период */ - prop?: string; + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; }; /** - * This is a model with one string property + * Some description with `back ticks` */ -export type ModelWithStringError = { +export type ModelWithBackticksInDescription = { /** - * This is a simple string property + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
*/ - prop?: string; + template?: string; }; -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); +export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { + baz: number; + qux: number; }; /** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * An object that can be null + * Model used to test deduplication strategy (unused) */ -export type NullableObject = { - foo?: string; -} | null; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; +export type ParameterSimpleParameterUnused = string; /** - * This is a reusable parameter + * Model used to test deduplication strategy */ -export type ParameterSimpleParameter = string; +export type PostServiceWithEmptyTagResponse = string; /** - * Model used to test deduplication strategy (unused) + * Model used to test deduplication strategy */ -export type ParameterSimpleParameterUnused = string; +export type PostServiceWithEmptyTagResponse2 = string; /** - * Parameter with illegal characters + * Model used to test deduplication strategy */ -export type Parameterx_Foo_Bar = ModelWithString; +export type DeleteFooData = string; /** * Model used to test deduplication strategy */ -export type PostServiceWithEmptyTagResponse = string; +export type DeleteFooData2 = string; /** - * Model used to test deduplication strategy + * Model with restricted keyword name */ -export type PostServiceWithEmptyTagResponse2 = string; +export type Import = string; export type SchemaWithFormRestrictedKeys = { description?: string; @@ -1050,71 +950,211 @@ export type SchemaWithFormRestrictedKeys = { 'x-enumNames'?: string; title?: string; }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; + array?: Array; }; /** - * This is a simple boolean + * This schema was giving PascalCase transformations a hard time */ -export type SimpleBoolean = boolean; +export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; /** - * This is a simple file + * This schema was giving PascalCase transformations a hard time */ -export type SimpleFile = (Blob | File); +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: unknown; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: number; +}; + +export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; + +export type GenericSchemaDuplicateIssue1SystemBoolean = { + item?: boolean; + error?: string; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemString = { + item?: string; + error?: string; + readonly hasError?: boolean; +}; /** - * This is a simple number + * This is a reusable parameter */ -export type SimpleInteger = number; +export type SimpleParameter = string; /** - * This is a simple reference + * Parameter with illegal characters */ -export type SimpleReference = ModelWithString; +export type XFooBar = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleString = string; +export type SimpleRequestBody = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleStringWithPattern = (string) | null; +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); + body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnly; }; -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type ImportResponse = ImportResponses[keyof ImportResponses]; -export type ImportError = unknown; +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; -export type ApiVVersionODataControllerCountResponse = (Model_From_Zendesk); +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; -export type ApiVVersionODataControllerCountError = unknown; +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; path: { /** * foo in method */ foo_param: string; }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; }; -export type GetApiVbyApiVersionSimpleOperationResponse = (number); +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; export type DeleteFooData3 = { + body?: never; headers: { /** * Parameter with illegal characters @@ -1122,30 +1162,38 @@ export type DeleteFooData3 = { 'x-Foo-Bar': ModelWithString; }; path: { - /** - * bar in method - */ - BarParam: string; /** * foo in method */ foo_param: string; + /** + * bar in method + */ + BarParam: string; }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; }; export type CallWithDescriptionsData = { + body?: never; + path?: never; query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ parameterWithBackticks?: unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ - parameterWithBreaks?: unknown; + parameterWithSlashes?: unknown; /** * Testing expression placeholders in string: ${expression} should work */ @@ -1158,21 +1206,22 @@ export type CallWithDescriptionsData = { * Testing reserved characters in string: * inline * and ** inline ** should work */ parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; }; + url: '/api/v{api-version}/descriptions/'; }; export type DeprecatedCallData = { + body?: never; headers: { /** * This parameter is deprecated * @deprecated */ - parameter: (DeprecatedModel) | null; + parameter: DeprecatedModel; }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; }; export type CallWithParametersData = { @@ -1181,49 +1230,50 @@ export type CallWithParametersData = { */ body: { [key: string]: unknown; - } | null; + }; headers: { /** * This is the parameter that goes into the header */ - parameterHeader: (string) | null; + parameterHeader: string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + parameterPath: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - parameterPath: (string) | null; + 'api-version': string; }; query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; /** * This is the parameter that goes into the query params */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + cursor: string; }; + url: '/api/v{api-version}/parameters/{parameterPath}'; }; export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the body */ - body: (ModelWithString) | null; + body: ModelWithString; headers: { /** * This is the parameter that goes into the request header */ - 'parameter.header': (string) | null; + 'parameter.header': string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + 'parameter.path.1'?: string; /** * This is the parameter that goes into the path */ @@ -1233,9 +1283,9 @@ export type CallWithWeirdParameterNamesData = { */ 'PARAMETER-PATH-3'?: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - 'parameter.path.1'?: string; + 'api-version': string; }; query: { /** @@ -1245,8 +1295,9 @@ export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the request query params */ - 'parameter-query': (string) | null; + 'parameter-query': string; }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; }; export type GetCallWithOptionalParamData = { @@ -1254,12 +1305,14 @@ export type GetCallWithOptionalParamData = { * This is a required parameter */ body: ModelWithOneOfEnum; + path?: never; query?: { /** * This is an optional parameter */ page?: number; }; + url: '/api/v{api-version}/parameters/'; }; export type PostCallWithOptionalParamData = { @@ -1267,73 +1320,101 @@ export type PostCallWithOptionalParamData = { * This is an optional parameter */ body?: { - offset?: (number) | null; + offset?: number; }; + path?: never; query: { /** * This is a required parameter */ parameter: Pageable; }; + url: '/api/v{api-version}/parameters/'; }; -export type PostCallWithOptionalParamResponse = (number | void); +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type PostCallWithOptionalParamError = unknown; +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleRequestBody; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/requestBody/'; }; export type PostApiVbyApiVersionFormDataData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleFormData; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/formData/'; }; export type CallWithDefaultParametersData = { + body?: never; + path?: never; query?: { /** - * This is a simple boolean with default value + * This is a simple string with default value */ - parameterBoolean?: (boolean) | null; + parameterString?: string; /** - * This is a simple enum with default value + * This is a simple number with default value */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; + parameterNumber?: number; /** - * This is a simple model with default value + * This is a simple boolean with default value */ - parameterModel?: (ModelWithString) | null; + parameterBoolean?: boolean; /** - * This is a simple number with default value + * This is a simple enum with default value */ - parameterNumber?: (number) | null; + parameterEnum?: 'Success' | 'Warning' | 'Error'; /** - * This is a simple string with default value + * This is a simple model with default value */ - parameterString?: (string) | null; + parameterModel?: ModelWithString; }; + url: '/api/v{api-version}/defaults'; }; export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; /** * This is a simple boolean that is optional with default value */ @@ -1346,18 +1427,13 @@ export type CallWithDefaultOptionalParametersData = { * This is a simple model that is optional with default value */ parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; }; + url: '/api/v{api-version}/defaults'; }; export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; query: { /** * This is a optional string with default @@ -1371,14 +1447,6 @@ export type CallToTestOrderOfParamsData = { * This is a optional string with no default */ parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; /** * This is a string with default */ @@ -1391,67 +1459,252 @@ export type CallToTestOrderOfParamsData = { * This is a string with no default */ parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string; }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; }; -export type CallWithNoContentResponseResponse = (void); +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithNoContentResponseError = unknown; +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithResponseAndNoContentResponseResponse = (number | void); +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; -export type CallWithResponseAndNoContentResponseError = unknown; +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; -export type DummyAResponse = (_400); +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; -export type DummyAError = unknown; +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; -export type DummyBResponse = (void); +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type DummyBError = unknown; +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; -export type CallWithResponseResponse = (_import); +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; -export type CallWithResponseError = unknown; +export type DummyAResponses = { + 200: _400; +}; -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; -export type CallWithResponsesError = (ModelWithStringError); +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; export type CollectionFormatData = { + body?: never; + path?: never; query: { /** * This is an array parameter that is sent as csv format (comma-separated values) */ - parameterArrayCSV: Array<(string)> | null; + parameterArrayCSV: Array; /** - * This is an array parameter that is sent as multi format (multiple parameter instances) + * This is an array parameter that is sent as ssv format (space-separated values) */ - parameterArrayMulti: Array<(string)> | null; + parameterArraySSV: Array; /** - * This is an array parameter that is sent as pipes format (pipe-separated values) + * This is an array parameter that is sent as tsv format (tab-separated values) */ - parameterArrayPipes: Array<(string)> | null; + parameterArrayTSV: Array; /** - * This is an array parameter that is sent as ssv format (space-separated values) + * This is an array parameter that is sent as pipes format (pipe-separated values) */ - parameterArraySSV: Array<(string)> | null; + parameterArrayPipes: Array; /** - * This is an array parameter that is sent as tsv format (tab-separated values) + * This is an array parameter that is sent as multi format (multiple parameter instances) */ - parameterArrayTSV: Array<(string)> | null; + parameterArrayMulti: Array; }; + url: '/api/v{api-version}/collectionFormat'; }; export type TypesData = { + body?: never; path?: { /** * This is a number parameter @@ -1460,75 +1713,105 @@ export type TypesData = { }; query: { /** - * This is an array parameter + * This is a number parameter */ - parameterArray: Array<(string)> | null; + parameterNumber: number; /** - * This is a boolean parameter + * This is a string parameter */ - parameterBoolean: (boolean) | null; + parameterString: string; /** - * This is a dictionary parameter + * This is a boolean parameter */ - parameterDictionary: { - [key: string]: unknown; - } | null; + parameterBoolean: boolean; /** - * This is an enum parameter + * This is an object parameter */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; + parameterObject: { + [key: string]: unknown; + }; /** - * This is a number parameter + * This is an array parameter */ - parameterNumber: number; + parameterArray: Array; /** - * This is an object parameter + * This is a dictionary parameter */ - parameterObject: { + parameterDictionary: { [key: string]: unknown; - } | null; + }; /** - * This is a string parameter + * This is an enum parameter */ - parameterString: (string) | null; + parameterEnum: 'Success' | 'Warning' | 'Error'; }; + url: '/api/v{api-version}/types'; }; -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; -export type TypesError = unknown; +export type TypesResponse = TypesResponses[keyof TypesResponses]; export type UploadFileData = { - body: (Blob | File); + body: unknown; path: { /** * api-version should be required in standalone clients */ - 'api-version': (string) | null; + 'api-version': string; }; + query?: never; + url: '/api/v{api-version}/upload'; }; -export type UploadFileResponse = (boolean); +export type UploadFileResponses = { + 200: boolean; +}; -export type UploadFileError = unknown; +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; export type FileResponseData = { + body?: never; path: { + id: string; /** * api-version should be required in standalone clients */ 'api-version': string; - id: string; }; + query?: never; + url: '/api/v{api-version}/file/{id}'; }; -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; +export type FileResponseResponses = { + /** + * Success + */ + 200: unknown; +}; export type ComplexTypesData = { + body?: never; + path?: never; query: { /** * Parameter containing object @@ -1545,86 +1828,182 @@ export type ComplexTypesData = { */ parameterReference: ModelWithString; }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; -export type ComplexTypesResponse = (Array); +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; -export type ComplexTypesError = (unknown); +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; }; -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; }; -}); +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; -export type MultipartResponseError = unknown; +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; export type ComplexParamsData = { body?: { - readonly key: (string) | null; - name: (string) | null; + readonly key: string; + name: string; enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array; + listOfStrings?: Array; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; readonly user?: { readonly id?: number; - readonly name?: (string) | null; + readonly name?: string; }; }; path: { + id: number; /** * api-version should be required in standalone clients */ 'api-version': string; - id: number; }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; }; -export type ComplexParamsResponse = (ModelWithString); +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; -export type ComplexParamsError = unknown; +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; -export type CallWithResultFromHeaderResponse = (string); +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; -export type CallWithResultFromHeaderError = (unknown); +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; export type TestErrorCodeData = { + body?: never; + path?: never; query: { /** * Status code to return */ status: number; }; + url: '/api/v{api-version}/error'; }; -export type TestErrorCodeResponse = (unknown); +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; -export type TestErrorCodeError = (unknown); +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; query: { /** * Dummy input param */ nonAsciiParamæøåÆØÅöôêÊ: number; }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; export type PutWithFormUrlEncodedData = { body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/types.ts.snap index 49c0619ff..333e77d69 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/types.ts.snap @@ -17,8 +17,6 @@ type OmitKeys = Pick>; export interface Config extends Omit { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Auth token or a function returning auth token. The resolved value will be * added to the request payload as defined by its `security` array. */ @@ -85,8 +83,6 @@ export interface Config */ responseTransformer?: (data: unknown) => Promise; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * A function validating response data. This is useful if you want to ensure * the response conforms to the desired shape, so it can be safely passed to * the transformers and returned to the user. diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/sdk.gen.ts.snap index 77a0ad0ae..41f3cd746 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/sdk.gen.ts.snap @@ -1,51 +1,53 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser } from './client'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; +import { createClient, createConfig, type Options } from './client'; +import type { ParentModelWithDatesData, ParentModelWithDatesResponse, ModelWithDatesData, ModelWithDatesResponse, ModelWithDatesArrayData, ModelWithDatesArrayResponse, ArrayOfDatesData, ArrayOfDatesResponse, DateData, DateResponse, MultipleResponsesData, MultipleResponsesResponse } from './types.gen'; +import { modelWithDatesResponseTransformer, modelWithDatesArrayResponseTransformer, arrayOfDatesResponseTransformer, dateResponseTransformer } from './transformers.gen'; export const client = createClient(createConfig()); -export const parentModelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const parentModelWithDates = (options?: Options) => { + return (options?.client ?? client).post({ url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesResponseTransformer, url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDatesArray = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDatesArray = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesArrayResponseTransformer, url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer + ...options }); }; -export const arrayOfDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' +export const arrayOfDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: arrayOfDatesResponseTransformer, + url: '/api/array-of-dates', + ...options }); }; -export const date = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/date' +export const date = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: dateResponseTransformer, + url: '/api/date', + ...options }); }; -export const multipleResponses = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' +export const multipleResponses = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/multiple-responses', + ...options }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/transformers.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/transformers.gen.ts.snap new file mode 100644 index 000000000..699754aca --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/transformers.gen.ts.snap @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ModelWithDatesResponse, ModelWithDatesArrayResponse, ArrayOfDatesResponse, DateResponse } from './types.gen'; + +const modelWithDatesSchemaResponseTransformer = (data: any) => { + data.modified = new Date(data.modified); + if (data.expires) { + data.expires = new Date(data.expires); + } + return data; +}; + +export const modelWithDatesResponseTransformer = async (data: any): Promise => { + data = modelWithDatesSchemaResponseTransformer(data); + return data; +}; + +export const modelWithDatesArrayResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return modelWithDatesSchemaResponseTransformer(item); + }); + return data; +}; + +export const arrayOfDatesResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return new Date(item); + }); + return data; +}; + +export const dateResponseTransformer = async (data: any): Promise => { + data = new Date(data); + return data; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap index 0326edf4c..0c44fd1ac 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/types.gen.ts.snap @@ -1,5 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * This is a model that contains a some dates + */ +export type SimpleModel = { + id: number; + name: string; + readonly enabled: boolean; +}; + /** * This is a model that contains a some dates */ @@ -19,100 +28,113 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; + 'nullable-date'?: Array; simpleItems?: Array; simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; + dates?: Array; + strings?: Array; }; -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; +export type ParentModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; }; -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); +export type ParentModelWithDatesResponses = { + /** + * Success + */ + 200: ParentModelWithDates; + /** + * Success + */ + 201: unknown; +}; -export type ArrayOfDatesError = unknown; +export type ParentModelWithDatesResponse = ParentModelWithDatesResponses[keyof ParentModelWithDatesResponses]; -export type DateResponse = (Date); +export type ModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; +}; -export type DateError = unknown; +export type ModelWithDatesResponses = { + /** + * Success + */ + 200: ModelWithDates; +}; -export type MultipleResponsesResponse = (Array | Array); +export type ModelWithDatesResponse = ModelWithDatesResponses[keyof ModelWithDatesResponses]; -export type MultipleResponsesError = unknown; +export type ModelWithDatesArrayData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates-array'; +}; -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; +export type ModelWithDatesArrayResponses = { + /** + * Success + */ + 200: Array; +}; -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; +export type ModelWithDatesArrayResponse = ModelWithDatesArrayResponses[keyof ModelWithDatesArrayResponses]; -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; +export type ArrayOfDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/array-of-dates'; +}; -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; +export type ArrayOfDatesResponses = { + /** + * Success + */ + 200: Array; }; -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; +export type ArrayOfDatesResponse = ArrayOfDatesResponses[keyof ArrayOfDatesResponses]; + +export type DateData = { + body?: never; + path?: never; + query?: never; + url: '/api/date'; }; -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; +export type DateResponses = { + /** + * Success + */ + 200: Date; }; -export type ModelWithDatesResponseTransformer = (data: any) => Promise; +export type DateResponse = DateResponses[keyof DateResponses]; -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; +export type MultipleResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/multiple-responses'; }; -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; +export type MultipleResponsesResponses = { + /** + * Updated + */ + 200: Array; + /** + * Created + */ + 201: Array; +}; -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file +export type MultipleResponsesResponse = MultipleResponsesResponses[keyof MultipleResponsesResponses]; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/sdk.gen.ts.snap index 3dab33f3b..f0c893d9c 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/sdk.gen.ts.snap @@ -1,450 +1,479 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { CollectionFormatData, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, FileResponseError, FileResponseResponse, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, ApiVVersionODataControllerCountError, ApiVVersionODataControllerCountResponse, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse } from './types.gen'; +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; +import type { ExportData, ImportData, ImportResponse, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, DummyAData, DummyAResponse, DummyBData, DummyBResponse, CallWithResponseData, CallWithResponseResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithResponsesData, CallWithResponsesResponse, CallWithResponsesError, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, ComplexTypesResponse, MultipartResponseData, MultipartResponseResponse, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); -export class CollectionFormatService { - public static collectionFormat(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/collectionFormat' +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-tag', + ...options }); } -} - -export class ComplexService { - public static complexTypes(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ + public static import(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/no-tag', ...options, - url: '/api/v{api-version}/complex' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } - public static complexParams(options: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/complex/{id}' + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple:operation', + ...options }); } } -export class DefaultService { - public static export(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-tag' +export class SimpleService { + public static apiVVersionODataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple/$count', + ...options }); } - public static import(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/no-tag' + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/simple', + ...options }); } - public static getApiVbyApiVersionSimpleOperation(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple:operation' + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple', + ...options }); } -} - -export class DefaultsService { - public static callWithDefaultParameters(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/defaults' + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + url: '/api/v{api-version}/simple', + ...options }); } - public static callWithDefaultOptionalParameters(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/defaults' + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + url: '/api/v{api-version}/simple', + ...options }); } - public static callToTestOrderOfParams(options: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/defaults' + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + url: '/api/v{api-version}/simple', + ...options }); } -} - -export class DeprecatedService { - /** - * @deprecated - */ - public static deprecatedCall(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/deprecated' + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/simple', + ...options }); } -} - -export class DescriptionsService { - public static callWithDescriptions(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/descriptions/' + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/simple', + ...options }); } } -export class DuplicateService { - public static duplicateName(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/duplicate' +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + ...options }); } - public static duplicateName1(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameterPath}', ...options, - url: '/api/v{api-version}/duplicate' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } - public static duplicateName2(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, - url: '/api/v{api-version}/duplicate' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } - public static duplicateName3(options?: OptionsLegacyParser) { - return (options?.client ?? client).delete({ + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/duplicate' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } -} - -export class ErrorService { - public static testErrorCode(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/error' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } } -export class FileResponseService { - public static fileResponse(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/file/{id}' +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/descriptions/', + ...options }); } } -export class FormDataService { - public static postApiVbyApiVersionFormData(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - ...formDataBodySerializer, - headers: { - 'Content-Type': null, - ...options?.headers - }, - url: '/api/v{api-version}/formData/' +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/deprecated', + ...options }); } } -export class HeaderService { - public static callWithResultFromHeader(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/requestBody/', ...options, - url: '/api/v{api-version}/header' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } } -export class MultipartService { - public static multipartRequest(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ ...formDataBodySerializer, + url: '/api/v{api-version}/formData/', + ...options, headers: { 'Content-Type': null, ...options?.headers - }, - url: '/api/v{api-version}/multipart' + } }); } - public static multipartResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multipart' +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/defaults', + ...options }); } -} - -export class MultipleTags1Service { - public static dummyA(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/defaults', + ...options }); } - public static dummyB(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/defaults', + ...options }); } } -export class MultipleTags2Service { - public static dummyA(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/duplicate', + ...options }); } - public static dummyB(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/duplicate', + ...options }); } -} - -export class MultipleTags3Service { - public static dummyB(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' + public static duplicateName(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/duplicate', + ...options }); } -} - -export class NoContentService { - public static callWithNoContentResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-content' - }); - } - - public static callWithResponseAndNoContentResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' + public static duplicateName(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/duplicate', + ...options }); } } -export class NonAsciiÆøåÆøÅöôêÊService { - public static nonAsciiæøåÆøÅöôêÊ字符串(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-content', + ...options }); } - /** - * Login User - */ - public static putWithFormUrlEncoded(options: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - ...urlSearchParamsBodySerializer, - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - ...options?.headers - }, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); } } -export class ParametersService { - public static deleteFoo(options: OptionsLegacyParser) { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); } - public static callWithParameters(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/{parameterPath}' + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/response', + ...options }); } - public static callWithWeirdParameterNames(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/response', + ...options }); } - public static getCallWithOptionalParam(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/parameters/' + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/response', + ...options }); } - public static postCallWithOptionalParam(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/' +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); } -} - -export class RequestBodyService { - public static postApiVbyApiVersionRequestBody(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/requestBody/' + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); } } -export class ResponseService { - public static callWithResponseAndNoContentResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); } - public static callWithResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/response' + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); } - public static callWithDuplicateResponses(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/response' +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); } - public static callWithResponses(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/response' +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/collectionFormat', + ...options }); } } -export class SimpleService { - public static apiVVersionODataControllerCount(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple/$count' +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/types', + ...options }); } - public static getCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/upload', ...options, - url: '/api/v{api-version}/simple' + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + } }); } - public static putCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + responseType: 'blob', + url: '/api/v{api-version}/file/{id}', + ...options }); } - public static postCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/complex', + ...options }); } - public static deleteCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).delete({ + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/complex/{id}', ...options, - url: '/api/v{api-version}/simple' + headers: { + 'Content-Type': 'application/json-patch+json', + ...options?.headers + } }); } - public static optionsCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).options({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class MultipartService { + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multipart', + ...options }); } - public static headCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).head({ + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...formDataBodySerializer, + url: '/api/v{api-version}/multipart', ...options, - url: '/api/v{api-version}/simple' + headers: { + 'Content-Type': null, + ...options?.headers + } }); } - public static patchCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).patch({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/header', + ...options }); } } -export class TypesService { - public static types(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/types' +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/error', + ...options }); } } -export class UploadService { - public static uploadFile(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/upload' + } }); } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap index 2a15d5d00..6e06eeedb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class/types.gen.ts.snap @@ -1,306 +1,255 @@ // This file is auto-generated by @hey-api/openapi-ts -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - /** * Model with number-only name */ export type _400 = string; -export type _default = { - name?: string; -}; - /** - * Model with restricted keyword name + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type _import = string; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; +export type CamelCaseCommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; +export type CommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; +export type CommentWithBackticks = number; /** - * This is a simple array containing an array + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work */ -export type ArrayWithArray = Array>; +export type CommentWithBackticksAndQuotes = number; /** - * This is a simple array with booleans + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ -export type ArrayWithBooleans = Array<(boolean)>; +export type CommentWithSlashes = number; /** - * This is a simple array with numbers + * Testing expression placeholders in string: ${expression} should work */ -export type ArrayWithNumbers = Array<(number)>; +export type CommentWithExpressionPlaceholders = number; /** - * This is a simple array with properties + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; +export type CommentWithQuotes = number; /** - * This is a simple array with references + * Testing reserved characters in string: * inline * and ** inline ** should work */ -export type ArrayWithReferences = Array; +export type CommentWithReservedCharacters = number; /** - * This is a simple array with strings + * This is a simple number */ -export type ArrayWithStrings = Array<(string)>; +export type SimpleInteger = number; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple boolean */ -export type camelCaseCommentWithBreaks = number; +export type SimpleBoolean = boolean; /** - * Some % character + * This is a simple string */ -export type CharactersInDescription = string; +export type SimpleString = string; /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) */ -export type CommentWithBackticks = number; +export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; /** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + * This is a simple file */ -export type CommentWithBackticksAndQuotes = number; +export type SimpleFile = unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple reference */ -export type CommentWithBreaks = number; +export type SimpleReference = ModelWithString; /** - * Testing expression placeholders in string: ${expression} should work + * This is a simple string */ -export type CommentWithExpressionPlaceholders = number; +export type SimpleStringWithPattern = string; /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work + * This is a simple enum with strings */ -export type CommentWithQuotes = number; +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * This is a simple enum with strings */ -export type CommentWithReservedCharacters = number; +export const EnumWithStrings = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'NON_ASCII:_ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' +} as const; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharacters = { + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', + '3_1': 3.1, + '': '' +} as const; /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work + * This is a simple enum with numbers */ -export type CommentWithSlashes = number; +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; /** - * This is a base model with two simple optional properties + * This is a simple enum with numbers */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; +export const EnumWithNumbers = { + 1: 1, + 2: 2, + 3: 3, + '1_1': 1.1, + '1_2': 1.2, + '1_3': 1.3, + 100: 100, + 200: 200, + 300: 300, + '-100': -100, + '-200': -200, + '-300': -300, + '-1_1': -1.1, + '-1_2': -1.2, + '-1_3': -1.3 +} as const; /** - * This is a model that extends the base model + * Success=1,Warning=2,Error=3 */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; +export type EnumFromDescription = number; /** - * This is a model with one property with a 'all of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; +export type EnumWithExtensions = 200 | 400 | 500; /** - * This is a model with one property with a 'any of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export const EnumWithExtensions = { + /** + * Used when the status of something is successful + */ + CUSTOM_SUCCESS: 200, + /** + * Used when the status of something has a warning + */ + CUSTOM_WARNING: 400, + /** + * Used when the status of something has an error + */ + CUSTOM_ERROR: 500 +} as const; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +export const EnumWithXEnumNames = { + ZERO: 0, + ONE: 1, + TWO: 2 +} as const; /** - * This is a model with one property with a 'any of' relationship + * This is a simple array with numbers */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; +export type ArrayWithNumbers = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with booleans */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; +export type ArrayWithBooleans = Array; /** - * This is a model with nested 'any of' property with a type null + * This is a simple array with strings */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; +export type ArrayWithStrings = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with references */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; +export type ArrayWithReferences = Array; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array containing an array */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export type ArrayWithArray = Array>; /** - * This is a model that contains a dictionary of complex arrays (composited) within composition + * This is a simple array with properties */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; +export type ArrayWithProperties = Array<{ + '16x16'?: CamelCaseCommentWithBreaks; + bar?: string; +}>; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; +export type ArrayWithAnyOfProperties = Array<{ + foo?: string; } | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; + bar?: string; +}>; -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); +export type AnyOfAnyAndNull = { + data?: unknown | null; }; /** - * This is a model that contains a simple dictionary within composition + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); +export type AnyOfArrays = { + results?: Array<{ + foo?: string; + } | { + bar?: string; + }>; }; /** - * This is a model with one property with a 'one of' relationship where the options are not $ref + * This is a string dictionary */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); +export type DictionaryWithString = { + [key: string]: string; }; -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -export type ConstValue = "ConstValue"; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: string | number | boolean | undefined; +}; /** - * This is a deprecated model with a deprecated property - * @deprecated + * This is a string reference */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; +export type DictionaryWithReference = { + [key: string]: ModelWithString; }; /** @@ -315,7 +264,7 @@ export type DictionaryWithArray = { */ export type DictionaryWithDictionary = { [key: string]: { - [key: string]: (string); + [key: string]: string; }; }; @@ -329,193 +278,204 @@ export type DictionaryWithProperties = { }; }; -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - /** - * This is a string reference + * This is a model with one number property */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; }; /** - * This is a string dictionary + * This is a model with one boolean property */ -export type DictionaryWithString = { - [key: string]: (string); +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; }; /** - * Success=1,Warning=2,Error=3 + * This is a model with one string property */ -export type EnumFromDescription = number; +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * This is a model with one string property */ -export type EnumWithExtensions = 200 | 400 | 500; +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) */ -export const EnumWithExtensions = { +export type ModelFromZendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { /** - * Used when the status of something is successful + * This is a simple string property */ - CUSTOM_SUCCESS: 200, + nullableProp1?: string; /** - * Used when the status of something has a warning + * This is a simple string property */ - CUSTOM_WARNING: 400, + nullableRequiredProp1: string; /** - * Used when the status of something has an error + * This is a simple string property */ - CUSTOM_ERROR: 500 -} as const; + nullableProp2?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: string | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; /** - * This is a simple enum with numbers + * This is a model with one enum */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: true; +}; /** - * This is a simple enum with numbers + * This is a model with one enum with escaped name */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; /** - * This is a simple enum with strings + * This is a model with one enum */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; /** - * This is a simple enum with strings + * This is a model with nested enums */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: 'Success' | 'Warning' | 'Error'; + }; + dictionaryWithEnumFromDescription?: { + [key: string]: number; + }; + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; + arrayWithDescription?: Array; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; }; /** - * This is a free-form object with additionalProperties: {}. + * This is a model with one property containing a reference */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; +export type ModelWithReference = { + prop?: ModelWithProperties; }; /** - * This is a free-form object with additionalProperties: true. + * This is a model with one property containing an array */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; /** - * This is a free-form object without additionalProperties. + * This is a model with one property containing an array */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; }; }; -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - /** - * This schema was giving PascalCase transformations a hard time + * This is a deprecated model with a deprecated property + * @deprecated */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { +export type DeprecatedModel = { /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + * This is a deprecated property + * @deprecated */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); + prop?: string; }; /** - * This schema was giving PascalCase transformations a hard time + * This is a model with one property containing a circular reference */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; }; /** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type Model_From_Zendesk = string; +export type CompositionWithOneOfAnonymous = { + propA?: { + propA?: string; + } | string | number; +}; /** * Circle */ export type ModelCircle = { - kind: 'circle'; + kind: string; radius?: number; }; @@ -523,365 +483,296 @@ export type ModelCircle = { * Square */ export type ModelSquare = { - kind: 'square'; + kind: string; sideLength?: number; }; /** - * This is a model that extends another model + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & ModelSquare); + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model that extends another model + * This is a model with one property with a 'any of' relationship where the options are not $ref */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; +export type CompositionWithAnyOfAnonymous = { + propA?: { + propA?: string; + } | string | number; }; /** - * This is a model with one property and additionalProperties: true + * This is a model with nested 'any of' property with a type null */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; +export type CompositionWithNestedAnyAndTypeNull = { + propA?: Array | Array; }; -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; +export type _3eNum1Период = 'Bird' | 'Dog'; -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; +export const _3eNum1Период = { + BIRD: 'Bird', + DOG: 'Dog' +} as const; -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; +export type ConstValue = 'ConstValue'; -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: Array<_3eNum1Период | ConstValue> | null; +}; /** - * This is a model with one property containing an array + * This is a model with one property with a 'one of' relationship */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with one property containing an array + * This is a model that contains a simple dictionary within composition */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: boolean | { + [key: string]: number; + }; }; /** - * Some description with `back ticks` + * This is a model that contains a dictionary of simple arrays within composition */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one boolean property + * This is a model that contains a dictionary of complex arrays (composited) within composition */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one property containing a circular reference + * This is a model with one property with a 'all of' relationship */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; +export type CompositionWithAllOfAndNullable = { + propA?: { + boolean?: boolean; + } & ModelWithEnum & ModelWithArray & ModelWithDictionary; }; -export type ModelWithConstantSizeArray = [ - number, - number -]; - /** - * This is a model with one property containing a dictionary + * This is a model with one property with a 'any of' relationship */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; +export type CompositionWithAnyOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with duplicated imports + * This is a base model with two simple optional properties */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; }; /** - * This is a model with duplicated properties + * This is a model that extends the base model */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; +export type CompositionExtendedModel = CompositionBaseModel & { + age: number; + firstName: string; + lastname: string; }; /** - * This is a model with one enum + * This is a model with one nested property */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; }; /** - * This is a simple enum with strings + * This is a model with one nested property */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; /** - * This is a simple enum with strings + * This is a model with duplicated properties */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; /** - * These are the HTTP error code enums + * This is a model with ordered properties */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; /** - * These are the HTTP error code enums + * This is a model with duplicated imports */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; /** - * This is a model with one enum + * This is a model that extends another model */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; }; /** - * This is a model with one enum with escaped name + * This is a model that extends another model */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; }; -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** - * This is a model with one number property + * This is a model that contains a some patterns */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; }; -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; }; -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; +export type Default = { + name?: string; }; -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); +export type Pageable = { + page?: number; + size?: number; + sort?: Array; }; /** - * This is a model with nested enums + * This is a free-form object without additionalProperties. */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; }; /** - * This is a model with one nested property + * This is a free-form object with additionalProperties: true. */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; }; -export type ModelWithNullableObject = { - data?: NullableObject; +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; }; /** - * This is a model with one string property + * This is a model with one property and additionalProperties: true */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; +export type ModelWithAdditionalPropertiesEqTrue = { /** * This is a simple string property */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + prop?: string; + [key: string]: unknown | string | undefined; }; -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; +}) & { + baz: number; + qux: number; }; /** - * Период + * An object that can be null */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NullableObject = { + foo?: string; +} | null; /** - * Период + * Some % character */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; +export type CharactersInDescription = string; -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; +export type ModelWithNullableObject = { + data?: NullableObject; }; export type ModelWithOneOfEnum = { @@ -895,64 +786,38 @@ export type ModelWithOneOfEnum = { foo: 'Quux'; } | { content: [ - (string), - (string) + unknown, + unknown ]; foo: 'Corge'; }; -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; +export const ModelWithNestedArrayEnumsDataFoo = { + FOO: 'foo', + BAR: 'bar' +} as const; -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export const ModelWithNestedArrayEnumsDataBar = { + BAZ: 'baz', + QUX: 'qux' +} as const; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; }; -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; +}; -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; }; export type ModelWithReadOnlyAndWriteOnly = { @@ -961,81 +826,116 @@ export type ModelWithReadOnlyAndWriteOnly = { baz: string; }; -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; +export type ModelWithConstantSizeArray = [ + number, + number +]; -/** - * This is a model with one string property - */ -export type ModelWithString = { +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + number | string, + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + number | string, + number | string, + number | string +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + number | Import, + number | Import +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + number & string, + number & string +]; + +export type ModelWithNumericEnumUnion = { /** - * This is a simple string property + * Период */ - prop?: string; + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; }; /** - * This is a model with one string property + * Some description with `back ticks` */ -export type ModelWithStringError = { +export type ModelWithBackticksInDescription = { /** - * This is a simple string property + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
*/ - prop?: string; + template?: string; }; -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); +export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { + baz: number; + qux: number; }; /** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * An object that can be null + * Model used to test deduplication strategy (unused) */ -export type NullableObject = { - foo?: string; -} | null; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; +export type ParameterSimpleParameterUnused = string; /** - * This is a reusable parameter + * Model used to test deduplication strategy */ -export type ParameterSimpleParameter = string; +export type PostServiceWithEmptyTagResponse = string; /** - * Model used to test deduplication strategy (unused) + * Model used to test deduplication strategy */ -export type ParameterSimpleParameterUnused = string; +export type PostServiceWithEmptyTagResponse2 = string; /** - * Parameter with illegal characters + * Model used to test deduplication strategy */ -export type Parameterx_Foo_Bar = ModelWithString; +export type DeleteFooData = string; /** * Model used to test deduplication strategy */ -export type PostServiceWithEmptyTagResponse = string; +export type DeleteFooData2 = string; /** - * Model used to test deduplication strategy + * Model with restricted keyword name */ -export type PostServiceWithEmptyTagResponse2 = string; +export type Import = string; export type SchemaWithFormRestrictedKeys = { description?: string; @@ -1050,244 +950,235 @@ export type SchemaWithFormRestrictedKeys = { 'x-enumNames'?: string; title?: string; }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; + array?: Array; }; /** - * This is a simple boolean + * This schema was giving PascalCase transformations a hard time */ -export type SimpleBoolean = boolean; +export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; /** - * This is a simple file + * This schema was giving PascalCase transformations a hard time */ -export type SimpleFile = (Blob | File); +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: unknown; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: number; +}; + +export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; + +export type GenericSchemaDuplicateIssue1SystemBoolean = { + item?: boolean; + error?: string; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemString = { + item?: string; + error?: string; + readonly hasError?: boolean; +}; /** - * This is a simple number + * This is a reusable parameter */ -export type SimpleInteger = number; +export type SimpleParameter = string; /** - * This is a simple reference + * Parameter with illegal characters */ -export type SimpleReference = ModelWithString; +export type XFooBar = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleString = string; +export type SimpleRequestBody = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleStringWithPattern = (string) | null; +export type SimpleFormData = ModelWithString; -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; }; -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; +export type ImportData = { + body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; }; -export type ComplexTypesResponse = (Array); +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnly; +}; -export type ComplexTypesError = (unknown); +export type ImportResponse = ImportResponses[keyof ImportResponses]; -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; }; -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; }; -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; path: { /** * foo in method */ foo_param: string; }; + query?: never; + url: '/api/v{api-version}/simple:operation'; }; -export type GetApiVbyApiVersionSimpleOperationResponse = (number); +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; }; -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; }; -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type DeleteFooData3 = { + body?: never; + headers: { /** - * This is a string with empty default + * Parameter with illegal characters */ - parameterStringWithEmptyDefault: string; + 'x-Foo-Bar': ModelWithString; + }; + path: { /** - * This is a string with no default + * foo in method */ - parameterStringWithNoDefault: string; - }; -}; - -export type DeprecatedCallData = { - headers: { + foo_param: string; /** - * This parameter is deprecated - * @deprecated + * bar in method */ - parameter: (DeprecatedModel) | null; + BarParam: string; }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; }; export type CallWithDescriptionsData = { + body?: never; + path?: never; query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; /** * Testing multiline comments in string: First line * Second line @@ -1296,135 +1187,41 @@ export type CallWithDescriptionsData = { */ parameterWithBreaks?: unknown; /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ - parameterWithReservedCharacters?: unknown; + parameterWithBackticks?: unknown; /** * Testing slashes in string: \backwards\\\ and /forwards/// should work */ parameterWithSlashes?: unknown; - }; -}; - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type FileResponseData = { - path: { /** - * api-version should be required in standalone clients + * Testing expression placeholders in string: ${expression} should work */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { + parameterWithExpressionPlaceholders?: unknown; /** - * This is a reusable parameter + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ - parameter?: string; - }; -}; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { + parameterWithQuotes?: unknown; /** - * Dummy input param + * Testing reserved characters in string: * inline * and ** inline ** should work */ - nonAsciiParamæøåÆØÅöôêÊ: number; + parameterWithReservedCharacters?: unknown; }; + url: '/api/v{api-version}/descriptions/'; }; -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; - -export type DeleteFooData3 = { +export type DeprecatedCallData = { + body?: never; headers: { /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method + * This parameter is deprecated + * @deprecated */ - foo_param: string; + parameter: DeprecatedModel; }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; }; export type CallWithParametersData = { @@ -1433,49 +1230,50 @@ export type CallWithParametersData = { */ body: { [key: string]: unknown; - } | null; + }; headers: { /** * This is the parameter that goes into the header */ - parameterHeader: (string) | null; + parameterHeader: string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + parameterPath: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - parameterPath: (string) | null; + 'api-version': string; }; query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; /** * This is the parameter that goes into the query params */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + cursor: string; }; + url: '/api/v{api-version}/parameters/{parameterPath}'; }; export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the body */ - body: (ModelWithString) | null; + body: ModelWithString; headers: { /** * This is the parameter that goes into the request header */ - 'parameter.header': (string) | null; + 'parameter.header': string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + 'parameter.path.1'?: string; /** * This is the parameter that goes into the path */ @@ -1485,9 +1283,9 @@ export type CallWithWeirdParameterNamesData = { */ 'PARAMETER-PATH-3'?: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - 'parameter.path.1'?: string; + 'api-version': string; }; query: { /** @@ -1497,8 +1295,9 @@ export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the request query params */ - 'parameter-query': (string) | null; + 'parameter-query': string; }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; }; export type GetCallWithOptionalParamData = { @@ -1506,12 +1305,14 @@ export type GetCallWithOptionalParamData = { * This is a required parameter */ body: ModelWithOneOfEnum; + path?: never; query?: { /** * This is an optional parameter */ page?: number; }; + url: '/api/v{api-version}/parameters/'; }; export type PostCallWithOptionalParamData = { @@ -1519,54 +1320,391 @@ export type PostCallWithOptionalParamData = { * This is an optional parameter */ body?: { - offset?: (number) | null; + offset?: number; }; + path?: never; query: { /** * This is a required parameter */ parameter: Pageable; }; + url: '/api/v{api-version}/parameters/'; }; -export type PostCallWithOptionalParamResponse = (number | void); +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type PostCallWithOptionalParamError = unknown; +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleRequestBody; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/requestBody/'; }; -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type ApiVVersionODataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVVersionODataControllerCountError = unknown; +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: SimpleFormData; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/formData/'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string with default value + */ + parameterString?: string; + /** + * This is a simple number with default value + */ + parameterNumber?: number; + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; + +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + 200: _400; +}; + +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array; + }; + url: '/api/v{api-version}/collectionFormat'; +}; export type TypesData = { + body?: never; path?: { /** * This is a number parameter @@ -1575,56 +1713,297 @@ export type TypesData = { }; query: { /** - * This is an array parameter + * This is a number parameter */ - parameterArray: Array<(string)> | null; + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string; /** * This is a boolean parameter */ - parameterBoolean: (boolean) | null; + parameterBoolean: boolean; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + }; + /** + * This is an array parameter + */ + parameterArray: Array; /** * This is a dictionary parameter */ parameterDictionary: { [key: string]: unknown; - } | null; + }; /** * This is an enum parameter */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type UploadFileData = { + body: unknown; + path: { /** - * This is a number parameter + * api-version should be required in standalone clients */ - parameterNumber: number; + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/upload'; +}; + +export type UploadFileResponses = { + 200: boolean; +}; + +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; + +export type FileResponseData = { + body?: never; + path: { + id: string; /** - * This is an object parameter + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/file/{id}'; +}; + +export type FileResponseResponses = { + /** + * Success + */ + 200: unknown; +}; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object */ parameterObject: { - [key: string]: unknown; - } | null; + first?: { + second?: { + third?: string; + }; + }; + }; /** - * This is a string parameter + * Parameter containing reference */ - parameterString: (string) | null; + parameterReference: ModelWithString; }; + url: '/api/v{api-version}/complex'; }; -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; -export type TypesError = unknown; +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; -export type UploadFileData = { - body: (Blob | File); +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }; +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; + +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type ComplexParamsData = { + body?: { + readonly key: string; + name: string; + enabled?: boolean; + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array; + listOfStrings?: Array; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string; + }; + }; path: { + id: number; /** * api-version should be required in standalone clients */ - 'api-version': (string) | null; + 'api-version': string; }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; }; -export type UploadFileResponse = (boolean); +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; -export type UploadFileError = unknown; \ No newline at end of file +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: number; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/sdk.gen.ts.snap index 675d0e8b7..149c2426e 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/sdk.gen.ts.snap @@ -1,53 +1,55 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; +import { createClient, createConfig, type Options } from '@hey-api/client-axios'; +import type { ParentModelWithDatesData, ParentModelWithDatesResponse, ModelWithDatesData, ModelWithDatesResponse, ModelWithDatesArrayData, ModelWithDatesArrayResponse, ArrayOfDatesData, ArrayOfDatesResponse, DateData, DateResponse, MultipleResponsesData, MultipleResponsesResponse } from './types.gen'; +import { modelWithDatesResponseTransformer, modelWithDatesArrayResponseTransformer, arrayOfDatesResponseTransformer, dateResponseTransformer } from './transformers.gen'; export const client = createClient(createConfig()); export class DefaultService { - public static parentModelWithDates(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, + public static parentModelWithDates(options?: Options) { + return (options?.client ?? client).post({ url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer + ...options }); } - public static modelWithDates(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, + public static modelWithDates(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesResponseTransformer, url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer + ...options }); } - public static modelWithDatesArray(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, + public static modelWithDatesArray(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesArrayResponseTransformer, url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer + ...options }); } - public static arrayOfDates(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' + public static arrayOfDates(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: arrayOfDatesResponseTransformer, + url: '/api/array-of-dates', + ...options }); } - public static date(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/date' + public static date(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: dateResponseTransformer, + url: '/api/date', + ...options }); } - public static multipleResponses(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' + public static multipleResponses(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/multiple-responses', + ...options }); } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/transformers.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/transformers.gen.ts.snap new file mode 100644 index 000000000..699754aca --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/transformers.gen.ts.snap @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ModelWithDatesResponse, ModelWithDatesArrayResponse, ArrayOfDatesResponse, DateResponse } from './types.gen'; + +const modelWithDatesSchemaResponseTransformer = (data: any) => { + data.modified = new Date(data.modified); + if (data.expires) { + data.expires = new Date(data.expires); + } + return data; +}; + +export const modelWithDatesResponseTransformer = async (data: any): Promise => { + data = modelWithDatesSchemaResponseTransformer(data); + return data; +}; + +export const modelWithDatesArrayResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return modelWithDatesSchemaResponseTransformer(item); + }); + return data; +}; + +export const arrayOfDatesResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return new Date(item); + }); + return data; +}; + +export const dateResponseTransformer = async (data: any): Promise => { + data = new Date(data); + return data; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap index 0326edf4c..0c44fd1ac 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-class_transform/types.gen.ts.snap @@ -1,5 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * This is a model that contains a some dates + */ +export type SimpleModel = { + id: number; + name: string; + readonly enabled: boolean; +}; + /** * This is a model that contains a some dates */ @@ -19,100 +28,113 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; + 'nullable-date'?: Array; simpleItems?: Array; simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; + dates?: Array; + strings?: Array; }; -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; +export type ParentModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; }; -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); +export type ParentModelWithDatesResponses = { + /** + * Success + */ + 200: ParentModelWithDates; + /** + * Success + */ + 201: unknown; +}; -export type ArrayOfDatesError = unknown; +export type ParentModelWithDatesResponse = ParentModelWithDatesResponses[keyof ParentModelWithDatesResponses]; -export type DateResponse = (Date); +export type ModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; +}; -export type DateError = unknown; +export type ModelWithDatesResponses = { + /** + * Success + */ + 200: ModelWithDates; +}; -export type MultipleResponsesResponse = (Array | Array); +export type ModelWithDatesResponse = ModelWithDatesResponses[keyof ModelWithDatesResponses]; -export type MultipleResponsesError = unknown; +export type ModelWithDatesArrayData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates-array'; +}; -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; +export type ModelWithDatesArrayResponses = { + /** + * Success + */ + 200: Array; +}; -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; +export type ModelWithDatesArrayResponse = ModelWithDatesArrayResponses[keyof ModelWithDatesArrayResponses]; -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; +export type ArrayOfDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/array-of-dates'; +}; -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; +export type ArrayOfDatesResponses = { + /** + * Success + */ + 200: Array; }; -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; +export type ArrayOfDatesResponse = ArrayOfDatesResponses[keyof ArrayOfDatesResponses]; + +export type DateData = { + body?: never; + path?: never; + query?: never; + url: '/api/date'; }; -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; +export type DateResponses = { + /** + * Success + */ + 200: Date; }; -export type ModelWithDatesResponseTransformer = (data: any) => Promise; +export type DateResponse = DateResponses[keyof DateResponses]; -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; +export type MultipleResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/multiple-responses'; }; -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; +export type MultipleResponsesResponses = { + /** + * Updated + */ + 200: Array; + /** + * Created + */ + 201: Array; +}; -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file +export type MultipleResponsesResponse = MultipleResponsesResponses[keyof MultipleResponsesResponses]; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/sdk.gen.ts.snap index 07780be4a..10ee8bb83 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/sdk.gen.ts.snap @@ -1,354 +1,383 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; -import type { ImportData, ImportError, ImportResponse, ApiVVersionODataControllerCountError, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-axios'; +import type { ExportData, ImportData, ImportResponse, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, DummyAData, DummyAResponse, DummyBData, DummyBResponse, CallWithResponseData, CallWithResponseResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithResponsesData, CallWithResponsesResponse, CallWithResponsesError, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, ComplexTypesResponse, MultipartResponseData, MultipartResponseResponse, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); -export const export_ = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-tag' +export const export_ = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-tag', + ...options }); }; -export const import_ = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const import_ = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/no-tag', ...options, - url: '/api/v{api-version}/no-tag' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const apiVVersionODataControllerCount = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple/$count' +export const apiVVersionODataControllerCount = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple/$count', + ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: OptionsLegacyParser) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple:operation' + url: '/api/v{api-version}/simple:operation', + ...options }); }; -export const getCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple' +export const deleteCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const putCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/simple' +export const getCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const postCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/simple' +export const headCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).head({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/simple' +export const optionsCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).options({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).options({ - ...options, - url: '/api/v{api-version}/simple' +export const patchCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).patch({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const headCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).head({ - ...options, - url: '/api/v{api-version}/simple' +export const postCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const patchCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).patch({ - ...options, - url: '/api/v{api-version}/simple' +export const putCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteFoo = (options: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' +export const deleteFoo = (options: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + ...options }); }; -export const callWithDescriptions = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/descriptions/' +export const callWithDescriptions = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/descriptions/', + ...options }); }; /** * @deprecated */ -export const deprecatedCall = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/deprecated' +export const deprecatedCall = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/deprecated', + ...options }); }; -export const callWithParameters = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithParameters = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameterPath}', ...options, - url: '/api/v{api-version}/parameters/{parameterPath}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const callWithWeirdParameterNames = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithWeirdParameterNames = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const getCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const getCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionRequestBody = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postApiVbyApiVersionRequestBody = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/requestBody/', ...options, - url: '/api/v{api-version}/requestBody/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionFormData = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const postApiVbyApiVersionFormData = (options?: Options) => { + return (options?.client ?? client).post({ ...formDataBodySerializer, + url: '/api/v{api-version}/formData/', + ...options, headers: { 'Content-Type': null, ...options?.headers - }, - url: '/api/v{api-version}/formData/' + } }); }; -export const callWithDefaultParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultParameters = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callWithDefaultOptionalParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultOptionalParameters = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callToTestOrderOfParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/defaults' +export const callToTestOrderOfParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const duplicateName = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName1 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName2 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName3 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const callWithNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-content' +export const callWithNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-content', + ...options }); }; -export const callWithResponseAndNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' +export const callWithResponseAndNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); }; -export const dummyA = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' +export const dummyA = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); }; -export const dummyB = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' +export const dummyB = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); }; -export const callWithResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/response' +export const callWithResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithDuplicateResponses = (options?: OptionsLegacyParser) => { +export const callWithDuplicateResponses = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithResponses = (options?: OptionsLegacyParser) => { +export const callWithResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const collectionFormat = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/collectionFormat' +export const collectionFormat = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/collectionFormat', + ...options }); }; -export const types = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/types' +export const types = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/types', + ...options }); }; -export const uploadFile = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const uploadFile = (options: Options) => { + return (options?.client ?? client).post({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/upload', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/upload' + } }); }; -export const fileResponse = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/file/{id}' +export const fileResponse = (options: Options) => { + return (options?.client ?? client).get({ + responseType: 'blob', + url: '/api/v{api-version}/file/{id}', + ...options }); }; -export const complexTypes = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/complex' +export const complexTypes = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/complex', + ...options }); }; -export const multipartRequest = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - ...formDataBodySerializer, - headers: { - 'Content-Type': null, - ...options?.headers - }, - url: '/api/v{api-version}/multipart' +export const multipartResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multipart', + ...options }); }; -export const multipartResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const multipartRequest = (options?: Options) => { + return (options?.client ?? client).post({ + ...formDataBodySerializer, + url: '/api/v{api-version}/multipart', ...options, - url: '/api/v{api-version}/multipart' + headers: { + 'Content-Type': null, + ...options?.headers + } }); }; -export const complexParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ +export const complexParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/complex/{id}', ...options, - url: '/api/v{api-version}/complex/{id}' + headers: { + 'Content-Type': 'application/json-patch+json', + ...options?.headers + } }); }; -export const callWithResultFromHeader = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/header' +export const callWithResultFromHeader = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/header', + ...options }); }; -export const testErrorCode = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/error' +export const testErrorCode = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/error', + ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options }); }; /** * Login User */ -export const putWithFormUrlEncoded = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const putWithFormUrlEncoded = (options: Options) => { + return (options?.client ?? client).put({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + } }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap index 77cbc3d07..6e06eeedb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios/types.gen.ts.snap @@ -1,306 +1,255 @@ // This file is auto-generated by @hey-api/openapi-ts -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - /** * Model with number-only name */ export type _400 = string; -export type _default = { - name?: string; -}; - /** - * Model with restricted keyword name + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type _import = string; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; +export type CamelCaseCommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; +export type CommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; +export type CommentWithBackticks = number; /** - * This is a simple array containing an array + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work */ -export type ArrayWithArray = Array>; +export type CommentWithBackticksAndQuotes = number; /** - * This is a simple array with booleans + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ -export type ArrayWithBooleans = Array<(boolean)>; +export type CommentWithSlashes = number; /** - * This is a simple array with numbers + * Testing expression placeholders in string: ${expression} should work */ -export type ArrayWithNumbers = Array<(number)>; +export type CommentWithExpressionPlaceholders = number; /** - * This is a simple array with properties + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; +export type CommentWithQuotes = number; /** - * This is a simple array with references + * Testing reserved characters in string: * inline * and ** inline ** should work */ -export type ArrayWithReferences = Array; +export type CommentWithReservedCharacters = number; /** - * This is a simple array with strings + * This is a simple number */ -export type ArrayWithStrings = Array<(string)>; +export type SimpleInteger = number; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple boolean */ -export type camelCaseCommentWithBreaks = number; +export type SimpleBoolean = boolean; /** - * Some % character + * This is a simple string */ -export type CharactersInDescription = string; +export type SimpleString = string; /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) */ -export type CommentWithBackticks = number; +export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; /** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + * This is a simple file */ -export type CommentWithBackticksAndQuotes = number; +export type SimpleFile = unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple reference */ -export type CommentWithBreaks = number; +export type SimpleReference = ModelWithString; /** - * Testing expression placeholders in string: ${expression} should work + * This is a simple string */ -export type CommentWithExpressionPlaceholders = number; +export type SimpleStringWithPattern = string; /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work + * This is a simple enum with strings */ -export type CommentWithQuotes = number; +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * This is a simple enum with strings */ -export type CommentWithReservedCharacters = number; +export const EnumWithStrings = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'NON_ASCII:_ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' +} as const; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharacters = { + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', + '3_1': 3.1, + '': '' +} as const; /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work + * This is a simple enum with numbers */ -export type CommentWithSlashes = number; +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; /** - * This is a base model with two simple optional properties + * This is a simple enum with numbers */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; +export const EnumWithNumbers = { + 1: 1, + 2: 2, + 3: 3, + '1_1': 1.1, + '1_2': 1.2, + '1_3': 1.3, + 100: 100, + 200: 200, + 300: 300, + '-100': -100, + '-200': -200, + '-300': -300, + '-1_1': -1.1, + '-1_2': -1.2, + '-1_3': -1.3 +} as const; /** - * This is a model that extends the base model + * Success=1,Warning=2,Error=3 */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; +export type EnumFromDescription = number; /** - * This is a model with one property with a 'all of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; +export type EnumWithExtensions = 200 | 400 | 500; /** - * This is a model with one property with a 'any of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export const EnumWithExtensions = { + /** + * Used when the status of something is successful + */ + CUSTOM_SUCCESS: 200, + /** + * Used when the status of something has a warning + */ + CUSTOM_WARNING: 400, + /** + * Used when the status of something has an error + */ + CUSTOM_ERROR: 500 +} as const; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +export const EnumWithXEnumNames = { + ZERO: 0, + ONE: 1, + TWO: 2 +} as const; /** - * This is a model with one property with a 'any of' relationship + * This is a simple array with numbers */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; +export type ArrayWithNumbers = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with booleans */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; +export type ArrayWithBooleans = Array; /** - * This is a model with nested 'any of' property with a type null + * This is a simple array with strings */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; +export type ArrayWithStrings = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with references */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; +export type ArrayWithReferences = Array; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array containing an array */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export type ArrayWithArray = Array>; /** - * This is a model that contains a dictionary of complex arrays (composited) within composition + * This is a simple array with properties */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; +export type ArrayWithProperties = Array<{ + '16x16'?: CamelCaseCommentWithBreaks; + bar?: string; +}>; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; +export type ArrayWithAnyOfProperties = Array<{ + foo?: string; } | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; + bar?: string; +}>; -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); +export type AnyOfAnyAndNull = { + data?: unknown | null; }; /** - * This is a model that contains a simple dictionary within composition + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); +export type AnyOfArrays = { + results?: Array<{ + foo?: string; + } | { + bar?: string; + }>; }; /** - * This is a model with one property with a 'one of' relationship where the options are not $ref + * This is a string dictionary */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); +export type DictionaryWithString = { + [key: string]: string; }; -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -export type ConstValue = "ConstValue"; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: string | number | boolean | undefined; +}; /** - * This is a deprecated model with a deprecated property - * @deprecated + * This is a string reference */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; +export type DictionaryWithReference = { + [key: string]: ModelWithString; }; /** @@ -315,7 +264,7 @@ export type DictionaryWithArray = { */ export type DictionaryWithDictionary = { [key: string]: { - [key: string]: (string); + [key: string]: string; }; }; @@ -329,193 +278,204 @@ export type DictionaryWithProperties = { }; }; -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - /** - * This is a string reference + * This is a model with one number property */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; }; /** - * This is a string dictionary + * This is a model with one boolean property */ -export type DictionaryWithString = { - [key: string]: (string); +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; }; /** - * Success=1,Warning=2,Error=3 + * This is a model with one string property */ -export type EnumFromDescription = number; +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * This is a model with one string property */ -export type EnumWithExtensions = 200 | 400 | 500; +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) */ -export const EnumWithExtensions = { +export type ModelFromZendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { /** - * Used when the status of something is successful + * This is a simple string property */ - CUSTOM_SUCCESS: 200, + nullableProp1?: string; /** - * Used when the status of something has a warning + * This is a simple string property */ - CUSTOM_WARNING: 400, + nullableRequiredProp1: string; /** - * Used when the status of something has an error + * This is a simple string property */ - CUSTOM_ERROR: 500 -} as const; + nullableProp2?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: string | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; /** - * This is a simple enum with numbers + * This is a model with one enum */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: true; +}; /** - * This is a simple enum with numbers + * This is a model with one enum with escaped name */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; /** - * This is a simple enum with strings + * This is a model with one enum */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; /** - * This is a simple enum with strings + * This is a model with nested enums */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: 'Success' | 'Warning' | 'Error'; + }; + dictionaryWithEnumFromDescription?: { + [key: string]: number; + }; + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; + arrayWithDescription?: Array; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; }; /** - * This is a free-form object with additionalProperties: {}. + * This is a model with one property containing a reference */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; +export type ModelWithReference = { + prop?: ModelWithProperties; }; /** - * This is a free-form object with additionalProperties: true. + * This is a model with one property containing an array */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; /** - * This is a free-form object without additionalProperties. + * This is a model with one property containing an array */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; }; }; -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - /** - * This schema was giving PascalCase transformations a hard time + * This is a deprecated model with a deprecated property + * @deprecated */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { +export type DeprecatedModel = { /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + * This is a deprecated property + * @deprecated */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); + prop?: string; }; /** - * This schema was giving PascalCase transformations a hard time + * This is a model with one property containing a circular reference */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; }; /** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type Model_From_Zendesk = string; +export type CompositionWithOneOfAnonymous = { + propA?: { + propA?: string; + } | string | number; +}; /** * Circle */ export type ModelCircle = { - kind: 'circle'; + kind: string; radius?: number; }; @@ -523,365 +483,296 @@ export type ModelCircle = { * Square */ export type ModelSquare = { - kind: 'square'; + kind: string; sideLength?: number; }; /** - * This is a model that extends another model + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & ModelSquare); + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model that extends another model + * This is a model with one property with a 'any of' relationship where the options are not $ref */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; +export type CompositionWithAnyOfAnonymous = { + propA?: { + propA?: string; + } | string | number; }; /** - * This is a model with one property and additionalProperties: true + * This is a model with nested 'any of' property with a type null */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; +export type CompositionWithNestedAnyAndTypeNull = { + propA?: Array | Array; }; -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; +export type _3eNum1Период = 'Bird' | 'Dog'; -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; +export const _3eNum1Период = { + BIRD: 'Bird', + DOG: 'Dog' +} as const; -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; +export type ConstValue = 'ConstValue'; -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: Array<_3eNum1Период | ConstValue> | null; +}; /** - * This is a model with one property containing an array + * This is a model with one property with a 'one of' relationship */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with one property containing an array + * This is a model that contains a simple dictionary within composition */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: boolean | { + [key: string]: number; + }; }; /** - * Some description with `back ticks` + * This is a model that contains a dictionary of simple arrays within composition */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one boolean property + * This is a model that contains a dictionary of complex arrays (composited) within composition */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one property containing a circular reference + * This is a model with one property with a 'all of' relationship */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; +export type CompositionWithAllOfAndNullable = { + propA?: { + boolean?: boolean; + } & ModelWithEnum & ModelWithArray & ModelWithDictionary; }; -export type ModelWithConstantSizeArray = [ - number, - number -]; - /** - * This is a model with one property containing a dictionary + * This is a model with one property with a 'any of' relationship */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; +export type CompositionWithAnyOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with duplicated imports + * This is a base model with two simple optional properties */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; }; /** - * This is a model with duplicated properties + * This is a model that extends the base model */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; +export type CompositionExtendedModel = CompositionBaseModel & { + age: number; + firstName: string; + lastname: string; }; /** - * This is a model with one enum + * This is a model with one nested property */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; }; /** - * This is a simple enum with strings + * This is a model with one nested property */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; /** - * This is a simple enum with strings + * This is a model with duplicated properties */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; /** - * These are the HTTP error code enums + * This is a model with ordered properties */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; /** - * These are the HTTP error code enums + * This is a model with duplicated imports */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; /** - * This is a model with one enum + * This is a model that extends another model */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; }; /** - * This is a model with one enum with escaped name + * This is a model that extends another model */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; }; -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** - * This is a model with one number property + * This is a model that contains a some patterns */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; }; -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; }; -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; +export type Default = { + name?: string; }; -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); +export type Pageable = { + page?: number; + size?: number; + sort?: Array; }; /** - * This is a model with nested enums + * This is a free-form object without additionalProperties. */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; }; /** - * This is a model with one nested property + * This is a free-form object with additionalProperties: true. */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; }; -export type ModelWithNullableObject = { - data?: NullableObject; +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; }; /** - * This is a model with one string property + * This is a model with one property and additionalProperties: true */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; +export type ModelWithAdditionalPropertiesEqTrue = { /** * This is a simple string property */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + prop?: string; + [key: string]: unknown | string | undefined; }; -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; +}) & { + baz: number; + qux: number; }; /** - * Период + * An object that can be null */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NullableObject = { + foo?: string; +} | null; /** - * Период + * Some % character */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; +export type CharactersInDescription = string; -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; +export type ModelWithNullableObject = { + data?: NullableObject; }; export type ModelWithOneOfEnum = { @@ -895,64 +786,38 @@ export type ModelWithOneOfEnum = { foo: 'Quux'; } | { content: [ - (string), - (string) + unknown, + unknown ]; foo: 'Corge'; }; -export type foo = 'Bar'; +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export const ModelWithNestedArrayEnumsDataFoo = { + FOO: 'foo', + BAR: 'bar' +} as const; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const foo = { - BAR: 'Bar' +export const ModelWithNestedArrayEnumsDataBar = { + BAZ: 'baz', + QUX: 'qux' } as const; -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; }; -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; }; -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; }; export type ModelWithReadOnlyAndWriteOnly = { @@ -961,81 +826,116 @@ export type ModelWithReadOnlyAndWriteOnly = { baz: string; }; -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; +export type ModelWithConstantSizeArray = [ + number, + number +]; -/** - * This is a model with one string property - */ -export type ModelWithString = { +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + number | string, + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + number | string, + number | string, + number | string +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + number | Import, + number | Import +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + number & string, + number & string +]; + +export type ModelWithNumericEnumUnion = { /** - * This is a simple string property + * Период */ - prop?: string; + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; }; /** - * This is a model with one string property + * Some description with `back ticks` */ -export type ModelWithStringError = { +export type ModelWithBackticksInDescription = { /** - * This is a simple string property + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
*/ - prop?: string; + template?: string; }; -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); +export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { + baz: number; + qux: number; }; /** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * An object that can be null + * Model used to test deduplication strategy (unused) */ -export type NullableObject = { - foo?: string; -} | null; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; +export type ParameterSimpleParameterUnused = string; /** - * This is a reusable parameter + * Model used to test deduplication strategy */ -export type ParameterSimpleParameter = string; +export type PostServiceWithEmptyTagResponse = string; /** - * Model used to test deduplication strategy (unused) + * Model used to test deduplication strategy */ -export type ParameterSimpleParameterUnused = string; +export type PostServiceWithEmptyTagResponse2 = string; /** - * Parameter with illegal characters + * Model used to test deduplication strategy */ -export type Parameterx_Foo_Bar = ModelWithString; +export type DeleteFooData = string; /** * Model used to test deduplication strategy */ -export type PostServiceWithEmptyTagResponse = string; +export type DeleteFooData2 = string; /** - * Model used to test deduplication strategy + * Model with restricted keyword name */ -export type PostServiceWithEmptyTagResponse2 = string; +export type Import = string; export type SchemaWithFormRestrictedKeys = { description?: string; @@ -1050,71 +950,211 @@ export type SchemaWithFormRestrictedKeys = { 'x-enumNames'?: string; title?: string; }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; + array?: Array; }; /** - * This is a simple boolean + * This schema was giving PascalCase transformations a hard time */ -export type SimpleBoolean = boolean; +export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; /** - * This is a simple file + * This schema was giving PascalCase transformations a hard time */ -export type SimpleFile = (Blob | File); +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: unknown; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: number; +}; + +export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; + +export type GenericSchemaDuplicateIssue1SystemBoolean = { + item?: boolean; + error?: string; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemString = { + item?: string; + error?: string; + readonly hasError?: boolean; +}; /** - * This is a simple number + * This is a reusable parameter */ -export type SimpleInteger = number; +export type SimpleParameter = string; /** - * This is a simple reference + * Parameter with illegal characters */ -export type SimpleReference = ModelWithString; +export type XFooBar = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleString = string; +export type SimpleRequestBody = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleStringWithPattern = (string) | null; +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); + body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnly; }; -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type ImportResponse = ImportResponses[keyof ImportResponses]; -export type ImportError = unknown; +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; -export type ApiVVersionODataControllerCountResponse = (Model_From_Zendesk); +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; -export type ApiVVersionODataControllerCountError = unknown; +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; path: { /** * foo in method */ foo_param: string; }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; }; -export type GetApiVbyApiVersionSimpleOperationResponse = (number); +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; export type DeleteFooData3 = { + body?: never; headers: { /** * Parameter with illegal characters @@ -1122,30 +1162,38 @@ export type DeleteFooData3 = { 'x-Foo-Bar': ModelWithString; }; path: { - /** - * bar in method - */ - BarParam: string; /** * foo in method */ foo_param: string; + /** + * bar in method + */ + BarParam: string; }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; }; export type CallWithDescriptionsData = { + body?: never; + path?: never; query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ parameterWithBackticks?: unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ - parameterWithBreaks?: unknown; + parameterWithSlashes?: unknown; /** * Testing expression placeholders in string: ${expression} should work */ @@ -1158,21 +1206,22 @@ export type CallWithDescriptionsData = { * Testing reserved characters in string: * inline * and ** inline ** should work */ parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; }; + url: '/api/v{api-version}/descriptions/'; }; export type DeprecatedCallData = { + body?: never; headers: { /** * This parameter is deprecated * @deprecated */ - parameter: (DeprecatedModel) | null; + parameter: DeprecatedModel; }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; }; export type CallWithParametersData = { @@ -1181,49 +1230,50 @@ export type CallWithParametersData = { */ body: { [key: string]: unknown; - } | null; + }; headers: { /** * This is the parameter that goes into the header */ - parameterHeader: (string) | null; + parameterHeader: string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + parameterPath: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - parameterPath: (string) | null; + 'api-version': string; }; query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; /** * This is the parameter that goes into the query params */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + cursor: string; }; + url: '/api/v{api-version}/parameters/{parameterPath}'; }; export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the body */ - body: (ModelWithString) | null; + body: ModelWithString; headers: { /** * This is the parameter that goes into the request header */ - 'parameter.header': (string) | null; + 'parameter.header': string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + 'parameter.path.1'?: string; /** * This is the parameter that goes into the path */ @@ -1233,9 +1283,9 @@ export type CallWithWeirdParameterNamesData = { */ 'PARAMETER-PATH-3'?: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - 'parameter.path.1'?: string; + 'api-version': string; }; query: { /** @@ -1245,8 +1295,9 @@ export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the request query params */ - 'parameter-query': (string) | null; + 'parameter-query': string; }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; }; export type GetCallWithOptionalParamData = { @@ -1254,12 +1305,14 @@ export type GetCallWithOptionalParamData = { * This is a required parameter */ body: ModelWithOneOfEnum; + path?: never; query?: { /** * This is an optional parameter */ page?: number; }; + url: '/api/v{api-version}/parameters/'; }; export type PostCallWithOptionalParamData = { @@ -1267,73 +1320,101 @@ export type PostCallWithOptionalParamData = { * This is an optional parameter */ body?: { - offset?: (number) | null; + offset?: number; }; + path?: never; query: { /** * This is a required parameter */ parameter: Pageable; }; + url: '/api/v{api-version}/parameters/'; }; -export type PostCallWithOptionalParamResponse = (number | void); +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type PostCallWithOptionalParamError = unknown; +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleRequestBody; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/requestBody/'; }; export type PostApiVbyApiVersionFormDataData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleFormData; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/formData/'; }; export type CallWithDefaultParametersData = { + body?: never; + path?: never; query?: { /** - * This is a simple boolean with default value + * This is a simple string with default value */ - parameterBoolean?: (boolean) | null; + parameterString?: string; /** - * This is a simple enum with default value + * This is a simple number with default value */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; + parameterNumber?: number; /** - * This is a simple model with default value + * This is a simple boolean with default value */ - parameterModel?: (ModelWithString) | null; + parameterBoolean?: boolean; /** - * This is a simple number with default value + * This is a simple enum with default value */ - parameterNumber?: (number) | null; + parameterEnum?: 'Success' | 'Warning' | 'Error'; /** - * This is a simple string with default value + * This is a simple model with default value */ - parameterString?: (string) | null; + parameterModel?: ModelWithString; }; + url: '/api/v{api-version}/defaults'; }; export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; /** * This is a simple boolean that is optional with default value */ @@ -1346,18 +1427,13 @@ export type CallWithDefaultOptionalParametersData = { * This is a simple model that is optional with default value */ parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; }; + url: '/api/v{api-version}/defaults'; }; export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; query: { /** * This is a optional string with default @@ -1371,14 +1447,6 @@ export type CallToTestOrderOfParamsData = { * This is a optional string with no default */ parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; /** * This is a string with default */ @@ -1391,67 +1459,252 @@ export type CallToTestOrderOfParamsData = { * This is a string with no default */ parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string; }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; }; -export type CallWithNoContentResponseResponse = (void); +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithNoContentResponseError = unknown; +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithResponseAndNoContentResponseResponse = (number | void); +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; -export type CallWithResponseAndNoContentResponseError = unknown; +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; -export type DummyAResponse = (_400); +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; -export type DummyAError = unknown; +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; -export type DummyBResponse = (void); +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type DummyBError = unknown; +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; -export type CallWithResponseResponse = (_import); +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; -export type CallWithResponseError = unknown; +export type DummyAResponses = { + 200: _400; +}; -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; -export type CallWithResponsesError = (ModelWithStringError); +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; export type CollectionFormatData = { + body?: never; + path?: never; query: { /** * This is an array parameter that is sent as csv format (comma-separated values) */ - parameterArrayCSV: Array<(string)> | null; + parameterArrayCSV: Array; /** - * This is an array parameter that is sent as multi format (multiple parameter instances) + * This is an array parameter that is sent as ssv format (space-separated values) */ - parameterArrayMulti: Array<(string)> | null; + parameterArraySSV: Array; /** - * This is an array parameter that is sent as pipes format (pipe-separated values) + * This is an array parameter that is sent as tsv format (tab-separated values) */ - parameterArrayPipes: Array<(string)> | null; + parameterArrayTSV: Array; /** - * This is an array parameter that is sent as ssv format (space-separated values) + * This is an array parameter that is sent as pipes format (pipe-separated values) */ - parameterArraySSV: Array<(string)> | null; + parameterArrayPipes: Array; /** - * This is an array parameter that is sent as tsv format (tab-separated values) + * This is an array parameter that is sent as multi format (multiple parameter instances) */ - parameterArrayTSV: Array<(string)> | null; + parameterArrayMulti: Array; }; + url: '/api/v{api-version}/collectionFormat'; }; export type TypesData = { + body?: never; path?: { /** * This is a number parameter @@ -1460,75 +1713,105 @@ export type TypesData = { }; query: { /** - * This is an array parameter + * This is a number parameter */ - parameterArray: Array<(string)> | null; + parameterNumber: number; /** - * This is a boolean parameter + * This is a string parameter */ - parameterBoolean: (boolean) | null; + parameterString: string; /** - * This is a dictionary parameter + * This is a boolean parameter */ - parameterDictionary: { - [key: string]: unknown; - } | null; + parameterBoolean: boolean; /** - * This is an enum parameter + * This is an object parameter */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; + parameterObject: { + [key: string]: unknown; + }; /** - * This is a number parameter + * This is an array parameter */ - parameterNumber: number; + parameterArray: Array; /** - * This is an object parameter + * This is a dictionary parameter */ - parameterObject: { + parameterDictionary: { [key: string]: unknown; - } | null; + }; /** - * This is a string parameter + * This is an enum parameter */ - parameterString: (string) | null; + parameterEnum: 'Success' | 'Warning' | 'Error'; }; + url: '/api/v{api-version}/types'; }; -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; -export type TypesError = unknown; +export type TypesResponse = TypesResponses[keyof TypesResponses]; export type UploadFileData = { - body: (Blob | File); + body: unknown; path: { /** * api-version should be required in standalone clients */ - 'api-version': (string) | null; + 'api-version': string; }; + query?: never; + url: '/api/v{api-version}/upload'; }; -export type UploadFileResponse = (boolean); +export type UploadFileResponses = { + 200: boolean; +}; -export type UploadFileError = unknown; +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; export type FileResponseData = { + body?: never; path: { + id: string; /** * api-version should be required in standalone clients */ 'api-version': string; - id: string; }; + query?: never; + url: '/api/v{api-version}/file/{id}'; }; -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; +export type FileResponseResponses = { + /** + * Success + */ + 200: unknown; +}; export type ComplexTypesData = { + body?: never; + path?: never; query: { /** * Parameter containing object @@ -1545,86 +1828,182 @@ export type ComplexTypesData = { */ parameterReference: ModelWithString; }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; -export type ComplexTypesResponse = (Array); +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; -export type ComplexTypesError = (unknown); +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; }; -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; }; -}); +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; -export type MultipartResponseError = unknown; +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; export type ComplexParamsData = { body?: { - readonly key: (string) | null; - name: (string) | null; + readonly key: string; + name: string; enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array; + listOfStrings?: Array; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; readonly user?: { readonly id?: number; - readonly name?: (string) | null; + readonly name?: string; }; }; path: { + id: number; /** * api-version should be required in standalone clients */ 'api-version': string; - id: number; }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; }; -export type ComplexParamsResponse = (ModelWithString); +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; -export type ComplexParamsError = unknown; +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; -export type CallWithResultFromHeaderResponse = (string); +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; -export type CallWithResultFromHeaderError = (unknown); +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; export type TestErrorCodeData = { + body?: never; + path?: never; query: { /** * Status code to return */ status: number; }; + url: '/api/v{api-version}/error'; }; -export type TestErrorCodeResponse = (unknown); +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; -export type TestErrorCodeError = (unknown); +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; query: { /** * Dummy input param */ nonAsciiParamæøåÆØÅöôêÊ: number; }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; export type PutWithFormUrlEncodedData = { body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/sdk.gen.ts.snap index 23b9c6932..7231fceed 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/sdk.gen.ts.snap @@ -1,51 +1,53 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-axios'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; +import { createClient, createConfig, type Options } from '@hey-api/client-axios'; +import type { ParentModelWithDatesData, ParentModelWithDatesResponse, ModelWithDatesData, ModelWithDatesResponse, ModelWithDatesArrayData, ModelWithDatesArrayResponse, ArrayOfDatesData, ArrayOfDatesResponse, DateData, DateResponse, MultipleResponsesData, MultipleResponsesResponse } from './types.gen'; +import { modelWithDatesResponseTransformer, modelWithDatesArrayResponseTransformer, arrayOfDatesResponseTransformer, dateResponseTransformer } from './transformers.gen'; export const client = createClient(createConfig()); -export const parentModelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const parentModelWithDates = (options?: Options) => { + return (options?.client ?? client).post({ url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesResponseTransformer, url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDatesArray = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDatesArray = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesArrayResponseTransformer, url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer + ...options }); }; -export const arrayOfDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' +export const arrayOfDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: arrayOfDatesResponseTransformer, + url: '/api/array-of-dates', + ...options }); }; -export const date = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/date' +export const date = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: dateResponseTransformer, + url: '/api/date', + ...options }); }; -export const multipleResponses = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' +export const multipleResponses = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/multiple-responses', + ...options }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/transformers.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/transformers.gen.ts.snap new file mode 100644 index 000000000..699754aca --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/transformers.gen.ts.snap @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ModelWithDatesResponse, ModelWithDatesArrayResponse, ArrayOfDatesResponse, DateResponse } from './types.gen'; + +const modelWithDatesSchemaResponseTransformer = (data: any) => { + data.modified = new Date(data.modified); + if (data.expires) { + data.expires = new Date(data.expires); + } + return data; +}; + +export const modelWithDatesResponseTransformer = async (data: any): Promise => { + data = modelWithDatesSchemaResponseTransformer(data); + return data; +}; + +export const modelWithDatesArrayResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return modelWithDatesSchemaResponseTransformer(item); + }); + return data; +}; + +export const arrayOfDatesResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return new Date(item); + }); + return data; +}; + +export const dateResponseTransformer = async (data: any): Promise => { + data = new Date(data); + return data; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap index 0326edf4c..0c44fd1ac 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios_transform/types.gen.ts.snap @@ -1,5 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * This is a model that contains a some dates + */ +export type SimpleModel = { + id: number; + name: string; + readonly enabled: boolean; +}; + /** * This is a model that contains a some dates */ @@ -19,100 +28,113 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; + 'nullable-date'?: Array; simpleItems?: Array; simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; + dates?: Array; + strings?: Array; }; -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; +export type ParentModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; }; -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); +export type ParentModelWithDatesResponses = { + /** + * Success + */ + 200: ParentModelWithDates; + /** + * Success + */ + 201: unknown; +}; -export type ArrayOfDatesError = unknown; +export type ParentModelWithDatesResponse = ParentModelWithDatesResponses[keyof ParentModelWithDatesResponses]; -export type DateResponse = (Date); +export type ModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; +}; -export type DateError = unknown; +export type ModelWithDatesResponses = { + /** + * Success + */ + 200: ModelWithDates; +}; -export type MultipleResponsesResponse = (Array | Array); +export type ModelWithDatesResponse = ModelWithDatesResponses[keyof ModelWithDatesResponses]; -export type MultipleResponsesError = unknown; +export type ModelWithDatesArrayData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates-array'; +}; -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; +export type ModelWithDatesArrayResponses = { + /** + * Success + */ + 200: Array; +}; -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; +export type ModelWithDatesArrayResponse = ModelWithDatesArrayResponses[keyof ModelWithDatesArrayResponses]; -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; +export type ArrayOfDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/array-of-dates'; +}; -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; +export type ArrayOfDatesResponses = { + /** + * Success + */ + 200: Array; }; -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; +export type ArrayOfDatesResponse = ArrayOfDatesResponses[keyof ArrayOfDatesResponses]; + +export type DateData = { + body?: never; + path?: never; + query?: never; + url: '/api/date'; }; -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; +export type DateResponses = { + /** + * Success + */ + 200: Date; }; -export type ModelWithDatesResponseTransformer = (data: any) => Promise; +export type DateResponse = DateResponses[keyof DateResponses]; -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; +export type MultipleResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/multiple-responses'; }; -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; +export type MultipleResponsesResponses = { + /** + * Updated + */ + 200: Array; + /** + * Created + */ + 201: Array; +}; -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file +export type MultipleResponsesResponse = MultipleResponsesResponses[keyof MultipleResponsesResponses]; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap index 9b8d6d852..d23859671 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/types.ts.snap @@ -10,8 +10,6 @@ type OmitKeys = Pick>; export interface Config extends Omit { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Auth token or a function returning auth token. The resolved value will be * added to the request payload as defined by its `security` array. */ @@ -90,8 +88,6 @@ export interface Config */ responseTransformer?: (data: unknown) => Promise; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * A function validating response data. This is useful if you want to ensure * the response conforms to the desired shape, so it can be safely passed to * the transformers and returned to the user. diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/sdk.gen.ts.snap index 0dd5913af..41bad98c7 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/sdk.gen.ts.snap @@ -1,354 +1,382 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser, formDataBodySerializer, urlSearchParamsBodySerializer } from './client'; -import type { ImportData, ImportError, ImportResponse, ApiVVersionODataControllerCountError, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from './client'; +import type { ExportData, ImportData, ImportResponse, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, DummyAData, DummyAResponse, DummyBData, DummyBResponse, CallWithResponseData, CallWithResponseResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithResponsesData, CallWithResponsesResponse, CallWithResponsesError, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, ComplexTypesResponse, MultipartResponseData, MultipartResponseResponse, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); -export const export_ = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-tag' +export const export_ = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-tag', + ...options }); }; -export const import_ = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const import_ = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/no-tag', ...options, - url: '/api/v{api-version}/no-tag' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const apiVVersionODataControllerCount = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple/$count' +export const apiVVersionODataControllerCount = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple/$count', + ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: OptionsLegacyParser) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple:operation' + url: '/api/v{api-version}/simple:operation', + ...options }); }; -export const getCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple' +export const deleteCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const putCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/simple' +export const getCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const postCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/simple' +export const headCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).head({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/simple' +export const optionsCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).options({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).options({ - ...options, - url: '/api/v{api-version}/simple' +export const patchCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).patch({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const headCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).head({ - ...options, - url: '/api/v{api-version}/simple' +export const postCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const patchCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).patch({ - ...options, - url: '/api/v{api-version}/simple' +export const putCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteFoo = (options: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' +export const deleteFoo = (options: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + ...options }); }; -export const callWithDescriptions = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/descriptions/' +export const callWithDescriptions = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/descriptions/', + ...options }); }; /** * @deprecated */ -export const deprecatedCall = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/deprecated' +export const deprecatedCall = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/deprecated', + ...options }); }; -export const callWithParameters = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithParameters = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameterPath}', ...options, - url: '/api/v{api-version}/parameters/{parameterPath}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const callWithWeirdParameterNames = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithWeirdParameterNames = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const getCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const getCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionRequestBody = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postApiVbyApiVersionRequestBody = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/requestBody/', ...options, - url: '/api/v{api-version}/requestBody/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionFormData = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const postApiVbyApiVersionFormData = (options?: Options) => { + return (options?.client ?? client).post({ ...formDataBodySerializer, + url: '/api/v{api-version}/formData/', + ...options, headers: { 'Content-Type': null, ...options?.headers - }, - url: '/api/v{api-version}/formData/' + } }); }; -export const callWithDefaultParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultParameters = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callWithDefaultOptionalParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultOptionalParameters = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callToTestOrderOfParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/defaults' +export const callToTestOrderOfParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const duplicateName = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName1 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName2 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName3 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const callWithNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-content' +export const callWithNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-content', + ...options }); }; -export const callWithResponseAndNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' +export const callWithResponseAndNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); }; -export const dummyA = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' +export const dummyA = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); }; -export const dummyB = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' +export const dummyB = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); }; -export const callWithResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/response' +export const callWithResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithDuplicateResponses = (options?: OptionsLegacyParser) => { +export const callWithDuplicateResponses = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithResponses = (options?: OptionsLegacyParser) => { +export const callWithResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const collectionFormat = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/collectionFormat' +export const collectionFormat = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/collectionFormat', + ...options }); }; -export const types = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/types' +export const types = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/types', + ...options }); }; -export const uploadFile = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const uploadFile = (options: Options) => { + return (options?.client ?? client).post({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/upload', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/upload' + } }); }; -export const fileResponse = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/file/{id}' +export const fileResponse = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/file/{id}', + ...options }); }; -export const complexTypes = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/complex' +export const complexTypes = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/complex', + ...options }); }; -export const multipartRequest = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - ...formDataBodySerializer, - headers: { - 'Content-Type': null, - ...options?.headers - }, - url: '/api/v{api-version}/multipart' +export const multipartResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multipart', + ...options }); }; -export const multipartResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const multipartRequest = (options?: Options) => { + return (options?.client ?? client).post({ + ...formDataBodySerializer, + url: '/api/v{api-version}/multipart', ...options, - url: '/api/v{api-version}/multipart' + headers: { + 'Content-Type': null, + ...options?.headers + } }); }; -export const complexParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ +export const complexParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/complex/{id}', ...options, - url: '/api/v{api-version}/complex/{id}' + headers: { + 'Content-Type': 'application/json-patch+json', + ...options?.headers + } }); }; -export const callWithResultFromHeader = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/header' +export const callWithResultFromHeader = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/header', + ...options }); }; -export const testErrorCode = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/error' +export const testErrorCode = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/error', + ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options }); }; /** * Login User */ -export const putWithFormUrlEncoded = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const putWithFormUrlEncoded = (options: Options) => { + return (options?.client ?? client).put({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + } }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap index 77cbc3d07..6e06eeedb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/types.gen.ts.snap @@ -1,306 +1,255 @@ // This file is auto-generated by @hey-api/openapi-ts -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - /** * Model with number-only name */ export type _400 = string; -export type _default = { - name?: string; -}; - /** - * Model with restricted keyword name + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type _import = string; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; +export type CamelCaseCommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; +export type CommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; +export type CommentWithBackticks = number; /** - * This is a simple array containing an array + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work */ -export type ArrayWithArray = Array>; +export type CommentWithBackticksAndQuotes = number; /** - * This is a simple array with booleans + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ -export type ArrayWithBooleans = Array<(boolean)>; +export type CommentWithSlashes = number; /** - * This is a simple array with numbers + * Testing expression placeholders in string: ${expression} should work */ -export type ArrayWithNumbers = Array<(number)>; +export type CommentWithExpressionPlaceholders = number; /** - * This is a simple array with properties + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; +export type CommentWithQuotes = number; /** - * This is a simple array with references + * Testing reserved characters in string: * inline * and ** inline ** should work */ -export type ArrayWithReferences = Array; +export type CommentWithReservedCharacters = number; /** - * This is a simple array with strings + * This is a simple number */ -export type ArrayWithStrings = Array<(string)>; +export type SimpleInteger = number; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple boolean */ -export type camelCaseCommentWithBreaks = number; +export type SimpleBoolean = boolean; /** - * Some % character + * This is a simple string */ -export type CharactersInDescription = string; +export type SimpleString = string; /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) */ -export type CommentWithBackticks = number; +export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; /** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + * This is a simple file */ -export type CommentWithBackticksAndQuotes = number; +export type SimpleFile = unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple reference */ -export type CommentWithBreaks = number; +export type SimpleReference = ModelWithString; /** - * Testing expression placeholders in string: ${expression} should work + * This is a simple string */ -export type CommentWithExpressionPlaceholders = number; +export type SimpleStringWithPattern = string; /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work + * This is a simple enum with strings */ -export type CommentWithQuotes = number; +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * This is a simple enum with strings */ -export type CommentWithReservedCharacters = number; +export const EnumWithStrings = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'NON_ASCII:_ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' +} as const; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharacters = { + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', + '3_1': 3.1, + '': '' +} as const; /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work + * This is a simple enum with numbers */ -export type CommentWithSlashes = number; +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; /** - * This is a base model with two simple optional properties + * This is a simple enum with numbers */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; +export const EnumWithNumbers = { + 1: 1, + 2: 2, + 3: 3, + '1_1': 1.1, + '1_2': 1.2, + '1_3': 1.3, + 100: 100, + 200: 200, + 300: 300, + '-100': -100, + '-200': -200, + '-300': -300, + '-1_1': -1.1, + '-1_2': -1.2, + '-1_3': -1.3 +} as const; /** - * This is a model that extends the base model + * Success=1,Warning=2,Error=3 */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; +export type EnumFromDescription = number; /** - * This is a model with one property with a 'all of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; +export type EnumWithExtensions = 200 | 400 | 500; /** - * This is a model with one property with a 'any of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export const EnumWithExtensions = { + /** + * Used when the status of something is successful + */ + CUSTOM_SUCCESS: 200, + /** + * Used when the status of something has a warning + */ + CUSTOM_WARNING: 400, + /** + * Used when the status of something has an error + */ + CUSTOM_ERROR: 500 +} as const; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +export const EnumWithXEnumNames = { + ZERO: 0, + ONE: 1, + TWO: 2 +} as const; /** - * This is a model with one property with a 'any of' relationship + * This is a simple array with numbers */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; +export type ArrayWithNumbers = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with booleans */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; +export type ArrayWithBooleans = Array; /** - * This is a model with nested 'any of' property with a type null + * This is a simple array with strings */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; +export type ArrayWithStrings = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with references */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; +export type ArrayWithReferences = Array; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array containing an array */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export type ArrayWithArray = Array>; /** - * This is a model that contains a dictionary of complex arrays (composited) within composition + * This is a simple array with properties */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; +export type ArrayWithProperties = Array<{ + '16x16'?: CamelCaseCommentWithBreaks; + bar?: string; +}>; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; +export type ArrayWithAnyOfProperties = Array<{ + foo?: string; } | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; + bar?: string; +}>; -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); +export type AnyOfAnyAndNull = { + data?: unknown | null; }; /** - * This is a model that contains a simple dictionary within composition + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); +export type AnyOfArrays = { + results?: Array<{ + foo?: string; + } | { + bar?: string; + }>; }; /** - * This is a model with one property with a 'one of' relationship where the options are not $ref + * This is a string dictionary */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); +export type DictionaryWithString = { + [key: string]: string; }; -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -export type ConstValue = "ConstValue"; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: string | number | boolean | undefined; +}; /** - * This is a deprecated model with a deprecated property - * @deprecated + * This is a string reference */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; +export type DictionaryWithReference = { + [key: string]: ModelWithString; }; /** @@ -315,7 +264,7 @@ export type DictionaryWithArray = { */ export type DictionaryWithDictionary = { [key: string]: { - [key: string]: (string); + [key: string]: string; }; }; @@ -329,193 +278,204 @@ export type DictionaryWithProperties = { }; }; -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - /** - * This is a string reference + * This is a model with one number property */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; }; /** - * This is a string dictionary + * This is a model with one boolean property */ -export type DictionaryWithString = { - [key: string]: (string); +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; }; /** - * Success=1,Warning=2,Error=3 + * This is a model with one string property */ -export type EnumFromDescription = number; +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * This is a model with one string property */ -export type EnumWithExtensions = 200 | 400 | 500; +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) */ -export const EnumWithExtensions = { +export type ModelFromZendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { /** - * Used when the status of something is successful + * This is a simple string property */ - CUSTOM_SUCCESS: 200, + nullableProp1?: string; /** - * Used when the status of something has a warning + * This is a simple string property */ - CUSTOM_WARNING: 400, + nullableRequiredProp1: string; /** - * Used when the status of something has an error + * This is a simple string property */ - CUSTOM_ERROR: 500 -} as const; + nullableProp2?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: string | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; /** - * This is a simple enum with numbers + * This is a model with one enum */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: true; +}; /** - * This is a simple enum with numbers + * This is a model with one enum with escaped name */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; /** - * This is a simple enum with strings + * This is a model with one enum */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; /** - * This is a simple enum with strings + * This is a model with nested enums */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: 'Success' | 'Warning' | 'Error'; + }; + dictionaryWithEnumFromDescription?: { + [key: string]: number; + }; + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; + arrayWithDescription?: Array; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; }; /** - * This is a free-form object with additionalProperties: {}. + * This is a model with one property containing a reference */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; +export type ModelWithReference = { + prop?: ModelWithProperties; }; /** - * This is a free-form object with additionalProperties: true. + * This is a model with one property containing an array */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; /** - * This is a free-form object without additionalProperties. + * This is a model with one property containing an array */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; }; }; -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - /** - * This schema was giving PascalCase transformations a hard time + * This is a deprecated model with a deprecated property + * @deprecated */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { +export type DeprecatedModel = { /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + * This is a deprecated property + * @deprecated */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); + prop?: string; }; /** - * This schema was giving PascalCase transformations a hard time + * This is a model with one property containing a circular reference */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; }; /** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type Model_From_Zendesk = string; +export type CompositionWithOneOfAnonymous = { + propA?: { + propA?: string; + } | string | number; +}; /** * Circle */ export type ModelCircle = { - kind: 'circle'; + kind: string; radius?: number; }; @@ -523,365 +483,296 @@ export type ModelCircle = { * Square */ export type ModelSquare = { - kind: 'square'; + kind: string; sideLength?: number; }; /** - * This is a model that extends another model + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & ModelSquare); + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model that extends another model + * This is a model with one property with a 'any of' relationship where the options are not $ref */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; +export type CompositionWithAnyOfAnonymous = { + propA?: { + propA?: string; + } | string | number; }; /** - * This is a model with one property and additionalProperties: true + * This is a model with nested 'any of' property with a type null */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; +export type CompositionWithNestedAnyAndTypeNull = { + propA?: Array | Array; }; -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; +export type _3eNum1Период = 'Bird' | 'Dog'; -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; +export const _3eNum1Период = { + BIRD: 'Bird', + DOG: 'Dog' +} as const; -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; +export type ConstValue = 'ConstValue'; -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: Array<_3eNum1Период | ConstValue> | null; +}; /** - * This is a model with one property containing an array + * This is a model with one property with a 'one of' relationship */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with one property containing an array + * This is a model that contains a simple dictionary within composition */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: boolean | { + [key: string]: number; + }; }; /** - * Some description with `back ticks` + * This is a model that contains a dictionary of simple arrays within composition */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one boolean property + * This is a model that contains a dictionary of complex arrays (composited) within composition */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one property containing a circular reference + * This is a model with one property with a 'all of' relationship */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; +export type CompositionWithAllOfAndNullable = { + propA?: { + boolean?: boolean; + } & ModelWithEnum & ModelWithArray & ModelWithDictionary; }; -export type ModelWithConstantSizeArray = [ - number, - number -]; - /** - * This is a model with one property containing a dictionary + * This is a model with one property with a 'any of' relationship */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; +export type CompositionWithAnyOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with duplicated imports + * This is a base model with two simple optional properties */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; }; /** - * This is a model with duplicated properties + * This is a model that extends the base model */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; +export type CompositionExtendedModel = CompositionBaseModel & { + age: number; + firstName: string; + lastname: string; }; /** - * This is a model with one enum + * This is a model with one nested property */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; }; /** - * This is a simple enum with strings + * This is a model with one nested property */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; /** - * This is a simple enum with strings + * This is a model with duplicated properties */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; /** - * These are the HTTP error code enums + * This is a model with ordered properties */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; /** - * These are the HTTP error code enums + * This is a model with duplicated imports */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; /** - * This is a model with one enum + * This is a model that extends another model */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; }; /** - * This is a model with one enum with escaped name + * This is a model that extends another model */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; }; -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** - * This is a model with one number property + * This is a model that contains a some patterns */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; }; -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; }; -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; +export type Default = { + name?: string; }; -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); +export type Pageable = { + page?: number; + size?: number; + sort?: Array; }; /** - * This is a model with nested enums + * This is a free-form object without additionalProperties. */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; }; /** - * This is a model with one nested property + * This is a free-form object with additionalProperties: true. */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; }; -export type ModelWithNullableObject = { - data?: NullableObject; +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; }; /** - * This is a model with one string property + * This is a model with one property and additionalProperties: true */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; +export type ModelWithAdditionalPropertiesEqTrue = { /** * This is a simple string property */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + prop?: string; + [key: string]: unknown | string | undefined; }; -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; +}) & { + baz: number; + qux: number; }; /** - * Период + * An object that can be null */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NullableObject = { + foo?: string; +} | null; /** - * Период + * Some % character */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; +export type CharactersInDescription = string; -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; +export type ModelWithNullableObject = { + data?: NullableObject; }; export type ModelWithOneOfEnum = { @@ -895,64 +786,38 @@ export type ModelWithOneOfEnum = { foo: 'Quux'; } | { content: [ - (string), - (string) + unknown, + unknown ]; foo: 'Corge'; }; -export type foo = 'Bar'; +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export const ModelWithNestedArrayEnumsDataFoo = { + FOO: 'foo', + BAR: 'bar' +} as const; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const foo = { - BAR: 'Bar' +export const ModelWithNestedArrayEnumsDataBar = { + BAZ: 'baz', + QUX: 'qux' } as const; -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; }; -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; }; -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; }; export type ModelWithReadOnlyAndWriteOnly = { @@ -961,81 +826,116 @@ export type ModelWithReadOnlyAndWriteOnly = { baz: string; }; -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; +export type ModelWithConstantSizeArray = [ + number, + number +]; -/** - * This is a model with one string property - */ -export type ModelWithString = { +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + number | string, + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + number | string, + number | string, + number | string +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + number | Import, + number | Import +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + number & string, + number & string +]; + +export type ModelWithNumericEnumUnion = { /** - * This is a simple string property + * Период */ - prop?: string; + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; }; /** - * This is a model with one string property + * Some description with `back ticks` */ -export type ModelWithStringError = { +export type ModelWithBackticksInDescription = { /** - * This is a simple string property + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
*/ - prop?: string; + template?: string; }; -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); +export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { + baz: number; + qux: number; }; /** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * An object that can be null + * Model used to test deduplication strategy (unused) */ -export type NullableObject = { - foo?: string; -} | null; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; +export type ParameterSimpleParameterUnused = string; /** - * This is a reusable parameter + * Model used to test deduplication strategy */ -export type ParameterSimpleParameter = string; +export type PostServiceWithEmptyTagResponse = string; /** - * Model used to test deduplication strategy (unused) + * Model used to test deduplication strategy */ -export type ParameterSimpleParameterUnused = string; +export type PostServiceWithEmptyTagResponse2 = string; /** - * Parameter with illegal characters + * Model used to test deduplication strategy */ -export type Parameterx_Foo_Bar = ModelWithString; +export type DeleteFooData = string; /** * Model used to test deduplication strategy */ -export type PostServiceWithEmptyTagResponse = string; +export type DeleteFooData2 = string; /** - * Model used to test deduplication strategy + * Model with restricted keyword name */ -export type PostServiceWithEmptyTagResponse2 = string; +export type Import = string; export type SchemaWithFormRestrictedKeys = { description?: string; @@ -1050,71 +950,211 @@ export type SchemaWithFormRestrictedKeys = { 'x-enumNames'?: string; title?: string; }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; + array?: Array; }; /** - * This is a simple boolean + * This schema was giving PascalCase transformations a hard time */ -export type SimpleBoolean = boolean; +export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; /** - * This is a simple file + * This schema was giving PascalCase transformations a hard time */ -export type SimpleFile = (Blob | File); +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: unknown; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: number; +}; + +export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; + +export type GenericSchemaDuplicateIssue1SystemBoolean = { + item?: boolean; + error?: string; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemString = { + item?: string; + error?: string; + readonly hasError?: boolean; +}; /** - * This is a simple number + * This is a reusable parameter */ -export type SimpleInteger = number; +export type SimpleParameter = string; /** - * This is a simple reference + * Parameter with illegal characters */ -export type SimpleReference = ModelWithString; +export type XFooBar = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleString = string; +export type SimpleRequestBody = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleStringWithPattern = (string) | null; +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); + body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnly; }; -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type ImportResponse = ImportResponses[keyof ImportResponses]; -export type ImportError = unknown; +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; -export type ApiVVersionODataControllerCountResponse = (Model_From_Zendesk); +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; -export type ApiVVersionODataControllerCountError = unknown; +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; path: { /** * foo in method */ foo_param: string; }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; }; -export type GetApiVbyApiVersionSimpleOperationResponse = (number); +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; export type DeleteFooData3 = { + body?: never; headers: { /** * Parameter with illegal characters @@ -1122,30 +1162,38 @@ export type DeleteFooData3 = { 'x-Foo-Bar': ModelWithString; }; path: { - /** - * bar in method - */ - BarParam: string; /** * foo in method */ foo_param: string; + /** + * bar in method + */ + BarParam: string; }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; }; export type CallWithDescriptionsData = { + body?: never; + path?: never; query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ parameterWithBackticks?: unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ - parameterWithBreaks?: unknown; + parameterWithSlashes?: unknown; /** * Testing expression placeholders in string: ${expression} should work */ @@ -1158,21 +1206,22 @@ export type CallWithDescriptionsData = { * Testing reserved characters in string: * inline * and ** inline ** should work */ parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; }; + url: '/api/v{api-version}/descriptions/'; }; export type DeprecatedCallData = { + body?: never; headers: { /** * This parameter is deprecated * @deprecated */ - parameter: (DeprecatedModel) | null; + parameter: DeprecatedModel; }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; }; export type CallWithParametersData = { @@ -1181,49 +1230,50 @@ export type CallWithParametersData = { */ body: { [key: string]: unknown; - } | null; + }; headers: { /** * This is the parameter that goes into the header */ - parameterHeader: (string) | null; + parameterHeader: string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + parameterPath: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - parameterPath: (string) | null; + 'api-version': string; }; query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; /** * This is the parameter that goes into the query params */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + cursor: string; }; + url: '/api/v{api-version}/parameters/{parameterPath}'; }; export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the body */ - body: (ModelWithString) | null; + body: ModelWithString; headers: { /** * This is the parameter that goes into the request header */ - 'parameter.header': (string) | null; + 'parameter.header': string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + 'parameter.path.1'?: string; /** * This is the parameter that goes into the path */ @@ -1233,9 +1283,9 @@ export type CallWithWeirdParameterNamesData = { */ 'PARAMETER-PATH-3'?: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - 'parameter.path.1'?: string; + 'api-version': string; }; query: { /** @@ -1245,8 +1295,9 @@ export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the request query params */ - 'parameter-query': (string) | null; + 'parameter-query': string; }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; }; export type GetCallWithOptionalParamData = { @@ -1254,12 +1305,14 @@ export type GetCallWithOptionalParamData = { * This is a required parameter */ body: ModelWithOneOfEnum; + path?: never; query?: { /** * This is an optional parameter */ page?: number; }; + url: '/api/v{api-version}/parameters/'; }; export type PostCallWithOptionalParamData = { @@ -1267,73 +1320,101 @@ export type PostCallWithOptionalParamData = { * This is an optional parameter */ body?: { - offset?: (number) | null; + offset?: number; }; + path?: never; query: { /** * This is a required parameter */ parameter: Pageable; }; + url: '/api/v{api-version}/parameters/'; }; -export type PostCallWithOptionalParamResponse = (number | void); +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type PostCallWithOptionalParamError = unknown; +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleRequestBody; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/requestBody/'; }; export type PostApiVbyApiVersionFormDataData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleFormData; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/formData/'; }; export type CallWithDefaultParametersData = { + body?: never; + path?: never; query?: { /** - * This is a simple boolean with default value + * This is a simple string with default value */ - parameterBoolean?: (boolean) | null; + parameterString?: string; /** - * This is a simple enum with default value + * This is a simple number with default value */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; + parameterNumber?: number; /** - * This is a simple model with default value + * This is a simple boolean with default value */ - parameterModel?: (ModelWithString) | null; + parameterBoolean?: boolean; /** - * This is a simple number with default value + * This is a simple enum with default value */ - parameterNumber?: (number) | null; + parameterEnum?: 'Success' | 'Warning' | 'Error'; /** - * This is a simple string with default value + * This is a simple model with default value */ - parameterString?: (string) | null; + parameterModel?: ModelWithString; }; + url: '/api/v{api-version}/defaults'; }; export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; /** * This is a simple boolean that is optional with default value */ @@ -1346,18 +1427,13 @@ export type CallWithDefaultOptionalParametersData = { * This is a simple model that is optional with default value */ parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; }; + url: '/api/v{api-version}/defaults'; }; export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; query: { /** * This is a optional string with default @@ -1371,14 +1447,6 @@ export type CallToTestOrderOfParamsData = { * This is a optional string with no default */ parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; /** * This is a string with default */ @@ -1391,67 +1459,252 @@ export type CallToTestOrderOfParamsData = { * This is a string with no default */ parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string; }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; }; -export type CallWithNoContentResponseResponse = (void); +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithNoContentResponseError = unknown; +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithResponseAndNoContentResponseResponse = (number | void); +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; -export type CallWithResponseAndNoContentResponseError = unknown; +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; -export type DummyAResponse = (_400); +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; -export type DummyAError = unknown; +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; -export type DummyBResponse = (void); +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type DummyBError = unknown; +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; -export type CallWithResponseResponse = (_import); +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; -export type CallWithResponseError = unknown; +export type DummyAResponses = { + 200: _400; +}; -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; -export type CallWithResponsesError = (ModelWithStringError); +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; export type CollectionFormatData = { + body?: never; + path?: never; query: { /** * This is an array parameter that is sent as csv format (comma-separated values) */ - parameterArrayCSV: Array<(string)> | null; + parameterArrayCSV: Array; /** - * This is an array parameter that is sent as multi format (multiple parameter instances) + * This is an array parameter that is sent as ssv format (space-separated values) */ - parameterArrayMulti: Array<(string)> | null; + parameterArraySSV: Array; /** - * This is an array parameter that is sent as pipes format (pipe-separated values) + * This is an array parameter that is sent as tsv format (tab-separated values) */ - parameterArrayPipes: Array<(string)> | null; + parameterArrayTSV: Array; /** - * This is an array parameter that is sent as ssv format (space-separated values) + * This is an array parameter that is sent as pipes format (pipe-separated values) */ - parameterArraySSV: Array<(string)> | null; + parameterArrayPipes: Array; /** - * This is an array parameter that is sent as tsv format (tab-separated values) + * This is an array parameter that is sent as multi format (multiple parameter instances) */ - parameterArrayTSV: Array<(string)> | null; + parameterArrayMulti: Array; }; + url: '/api/v{api-version}/collectionFormat'; }; export type TypesData = { + body?: never; path?: { /** * This is a number parameter @@ -1460,75 +1713,105 @@ export type TypesData = { }; query: { /** - * This is an array parameter + * This is a number parameter */ - parameterArray: Array<(string)> | null; + parameterNumber: number; /** - * This is a boolean parameter + * This is a string parameter */ - parameterBoolean: (boolean) | null; + parameterString: string; /** - * This is a dictionary parameter + * This is a boolean parameter */ - parameterDictionary: { - [key: string]: unknown; - } | null; + parameterBoolean: boolean; /** - * This is an enum parameter + * This is an object parameter */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; + parameterObject: { + [key: string]: unknown; + }; /** - * This is a number parameter + * This is an array parameter */ - parameterNumber: number; + parameterArray: Array; /** - * This is an object parameter + * This is a dictionary parameter */ - parameterObject: { + parameterDictionary: { [key: string]: unknown; - } | null; + }; /** - * This is a string parameter + * This is an enum parameter */ - parameterString: (string) | null; + parameterEnum: 'Success' | 'Warning' | 'Error'; }; + url: '/api/v{api-version}/types'; }; -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; -export type TypesError = unknown; +export type TypesResponse = TypesResponses[keyof TypesResponses]; export type UploadFileData = { - body: (Blob | File); + body: unknown; path: { /** * api-version should be required in standalone clients */ - 'api-version': (string) | null; + 'api-version': string; }; + query?: never; + url: '/api/v{api-version}/upload'; }; -export type UploadFileResponse = (boolean); +export type UploadFileResponses = { + 200: boolean; +}; -export type UploadFileError = unknown; +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; export type FileResponseData = { + body?: never; path: { + id: string; /** * api-version should be required in standalone clients */ 'api-version': string; - id: string; }; + query?: never; + url: '/api/v{api-version}/file/{id}'; }; -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; +export type FileResponseResponses = { + /** + * Success + */ + 200: unknown; +}; export type ComplexTypesData = { + body?: never; + path?: never; query: { /** * Parameter containing object @@ -1545,86 +1828,182 @@ export type ComplexTypesData = { */ parameterReference: ModelWithString; }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; -export type ComplexTypesResponse = (Array); +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; -export type ComplexTypesError = (unknown); +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; }; -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; }; -}); +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; -export type MultipartResponseError = unknown; +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; export type ComplexParamsData = { body?: { - readonly key: (string) | null; - name: (string) | null; + readonly key: string; + name: string; enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array; + listOfStrings?: Array; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; readonly user?: { readonly id?: number; - readonly name?: (string) | null; + readonly name?: string; }; }; path: { + id: number; /** * api-version should be required in standalone clients */ 'api-version': string; - id: number; }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; }; -export type ComplexParamsResponse = (ModelWithString); +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; -export type ComplexParamsError = unknown; +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; -export type CallWithResultFromHeaderResponse = (string); +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; -export type CallWithResultFromHeaderError = (unknown); +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; export type TestErrorCodeData = { + body?: never; + path?: never; query: { /** * Status code to return */ status: number; }; + url: '/api/v{api-version}/error'; }; -export type TestErrorCodeResponse = (unknown); +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; -export type TestErrorCodeError = (unknown); +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; query: { /** * Dummy input param */ nonAsciiParamæøåÆØÅöôêÊ: number; }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; export type PutWithFormUrlEncodedData = { body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap index 9b8d6d852..d23859671 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/types.ts.snap @@ -10,8 +10,6 @@ type OmitKeys = Pick>; export interface Config extends Omit { /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * Auth token or a function returning auth token. The resolved value will be * added to the request payload as defined by its `security` array. */ @@ -90,8 +88,6 @@ export interface Config */ responseTransformer?: (data: unknown) => Promise; /** - * **This feature works only with the [experimental parser](https://heyapi.dev/openapi-ts/configuration#parser)** - * * A function validating response data. This is useful if you want to ensure * the response conforms to the desired shape, so it can be safely passed to * the transformers and returned to the user. diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/sdk.gen.ts.snap index 77a0ad0ae..41f3cd746 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/sdk.gen.ts.snap @@ -1,51 +1,53 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser } from './client'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; +import { createClient, createConfig, type Options } from './client'; +import type { ParentModelWithDatesData, ParentModelWithDatesResponse, ModelWithDatesData, ModelWithDatesResponse, ModelWithDatesArrayData, ModelWithDatesArrayResponse, ArrayOfDatesData, ArrayOfDatesResponse, DateData, DateResponse, MultipleResponsesData, MultipleResponsesResponse } from './types.gen'; +import { modelWithDatesResponseTransformer, modelWithDatesArrayResponseTransformer, arrayOfDatesResponseTransformer, dateResponseTransformer } from './transformers.gen'; export const client = createClient(createConfig()); -export const parentModelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const parentModelWithDates = (options?: Options) => { + return (options?.client ?? client).post({ url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesResponseTransformer, url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDatesArray = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDatesArray = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesArrayResponseTransformer, url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer + ...options }); }; -export const arrayOfDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' +export const arrayOfDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: arrayOfDatesResponseTransformer, + url: '/api/array-of-dates', + ...options }); }; -export const date = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/date' +export const date = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: dateResponseTransformer, + url: '/api/date', + ...options }); }; -export const multipleResponses = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' +export const multipleResponses = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/multiple-responses', + ...options }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/transformers.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/transformers.gen.ts.snap new file mode 100644 index 000000000..699754aca --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/transformers.gen.ts.snap @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ModelWithDatesResponse, ModelWithDatesArrayResponse, ArrayOfDatesResponse, DateResponse } from './types.gen'; + +const modelWithDatesSchemaResponseTransformer = (data: any) => { + data.modified = new Date(data.modified); + if (data.expires) { + data.expires = new Date(data.expires); + } + return data; +}; + +export const modelWithDatesResponseTransformer = async (data: any): Promise => { + data = modelWithDatesSchemaResponseTransformer(data); + return data; +}; + +export const modelWithDatesArrayResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return modelWithDatesSchemaResponseTransformer(item); + }); + return data; +}; + +export const arrayOfDatesResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return new Date(item); + }); + return data; +}; + +export const dateResponseTransformer = async (data: any): Promise => { + data = new Date(data); + return data; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap index 0326edf4c..0c44fd1ac 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/types.gen.ts.snap @@ -1,5 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * This is a model that contains a some dates + */ +export type SimpleModel = { + id: number; + name: string; + readonly enabled: boolean; +}; + /** * This is a model that contains a some dates */ @@ -19,100 +28,113 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; + 'nullable-date'?: Array; simpleItems?: Array; simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; + dates?: Array; + strings?: Array; }; -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; +export type ParentModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; }; -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); +export type ParentModelWithDatesResponses = { + /** + * Success + */ + 200: ParentModelWithDates; + /** + * Success + */ + 201: unknown; +}; -export type ArrayOfDatesError = unknown; +export type ParentModelWithDatesResponse = ParentModelWithDatesResponses[keyof ParentModelWithDatesResponses]; -export type DateResponse = (Date); +export type ModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; +}; -export type DateError = unknown; +export type ModelWithDatesResponses = { + /** + * Success + */ + 200: ModelWithDates; +}; -export type MultipleResponsesResponse = (Array | Array); +export type ModelWithDatesResponse = ModelWithDatesResponses[keyof ModelWithDatesResponses]; -export type MultipleResponsesError = unknown; +export type ModelWithDatesArrayData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates-array'; +}; -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; +export type ModelWithDatesArrayResponses = { + /** + * Success + */ + 200: Array; +}; -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; +export type ModelWithDatesArrayResponse = ModelWithDatesArrayResponses[keyof ModelWithDatesArrayResponses]; -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; +export type ArrayOfDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/array-of-dates'; +}; -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; +export type ArrayOfDatesResponses = { + /** + * Success + */ + 200: Array; }; -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; +export type ArrayOfDatesResponse = ArrayOfDatesResponses[keyof ArrayOfDatesResponses]; + +export type DateData = { + body?: never; + path?: never; + query?: never; + url: '/api/date'; }; -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; +export type DateResponses = { + /** + * Success + */ + 200: Date; }; -export type ModelWithDatesResponseTransformer = (data: any) => Promise; +export type DateResponse = DateResponses[keyof DateResponses]; -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; +export type MultipleResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/multiple-responses'; }; -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; +export type MultipleResponsesResponses = { + /** + * Updated + */ + 200: Array; + /** + * Created + */ + 201: Array; +}; -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file +export type MultipleResponsesResponse = MultipleResponsesResponses[keyof MultipleResponsesResponses]; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/sdk.gen.ts.snap index b0d51b0dc..e1344e17c 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/sdk.gen.ts.snap @@ -1,450 +1,478 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { CollectionFormatData, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, ImportData, ImportError, ImportResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DeprecatedCallData, CallWithDescriptionsData, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, FileResponseData, FileResponseError, FileResponseResponse, PostApiVbyApiVersionFormDataData, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData, DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, ApiVVersionODataControllerCountError, ApiVVersionODataControllerCountResponse, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse } from './types.gen'; +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ExportData, ImportData, ImportResponse, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, DummyAData, DummyAResponse, DummyBData, DummyBResponse, CallWithResponseData, CallWithResponseResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithResponsesData, CallWithResponsesResponse, CallWithResponsesError, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, ComplexTypesResponse, MultipartResponseData, MultipartResponseResponse, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); -export class CollectionFormatService { - public static collectionFormat(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/collectionFormat' +export class DefaultService { + public static export(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-tag', + ...options }); } -} - -export class ComplexService { - public static complexTypes(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ + public static import(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/no-tag', ...options, - url: '/api/v{api-version}/complex' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } - public static complexParams(options: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/complex/{id}' + public static getApiVbyApiVersionSimpleOperation(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple:operation', + ...options }); } } -export class DefaultService { - public static export(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-tag' +export class SimpleService { + public static apiVVersionODataControllerCount(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple/$count', + ...options }); } - public static import(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/no-tag' + public static deleteCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/simple', + ...options }); } - public static getApiVbyApiVersionSimpleOperation(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple:operation' + public static getCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple', + ...options }); } -} - -export class DefaultsService { - public static callWithDefaultParameters(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/defaults' + public static headCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).head({ + url: '/api/v{api-version}/simple', + ...options }); } - public static callWithDefaultOptionalParameters(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/defaults' + public static optionsCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).options({ + url: '/api/v{api-version}/simple', + ...options }); } - public static callToTestOrderOfParams(options: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/defaults' + public static patchCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).patch({ + url: '/api/v{api-version}/simple', + ...options }); } -} - -export class DeprecatedService { - /** - * @deprecated - */ - public static deprecatedCall(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/deprecated' + public static postCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/simple', + ...options }); } -} - -export class DescriptionsService { - public static callWithDescriptions(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/descriptions/' + public static putCallWithoutParametersAndResponse(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/simple', + ...options }); } } -export class DuplicateService { - public static duplicateName(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/duplicate' +export class ParametersService { + public static deleteFoo(options: Options) { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + ...options }); } - public static duplicateName1(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ + public static callWithParameters(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameterPath}', ...options, - url: '/api/v{api-version}/duplicate' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } - public static duplicateName2(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ + public static callWithWeirdParameterNames(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, - url: '/api/v{api-version}/duplicate' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } - public static duplicateName3(options?: OptionsLegacyParser) { - return (options?.client ?? client).delete({ + public static getCallWithOptionalParam(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/duplicate' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } -} - -export class ErrorService { - public static testErrorCode(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ + public static postCallWithOptionalParam(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/error' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } } -export class FileResponseService { - public static fileResponse(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/file/{id}' +export class DescriptionsService { + public static callWithDescriptions(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/descriptions/', + ...options }); } } -export class FormDataService { - public static postApiVbyApiVersionFormData(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - ...formDataBodySerializer, - headers: { - 'Content-Type': null, - ...options?.headers - }, - url: '/api/v{api-version}/formData/' +export class DeprecatedService { + /** + * @deprecated + */ + public static deprecatedCall(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/deprecated', + ...options }); } } -export class HeaderService { - public static callWithResultFromHeader(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ +export class RequestBodyService { + public static postApiVbyApiVersionRequestBody(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/requestBody/', ...options, - url: '/api/v{api-version}/header' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); } } -export class MultipartService { - public static multipartRequest(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, +export class FormDataService { + public static postApiVbyApiVersionFormData(options?: Options) { + return (options?.client ?? client).post({ ...formDataBodySerializer, + url: '/api/v{api-version}/formData/', + ...options, headers: { 'Content-Type': null, ...options?.headers - }, - url: '/api/v{api-version}/multipart' + } }); } - public static multipartResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multipart' +} + +export class DefaultsService { + public static callWithDefaultParameters(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/defaults', + ...options }); } -} - -export class MultipleTags1Service { - public static dummyA(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' + public static callWithDefaultOptionalParameters(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/defaults', + ...options }); } - public static dummyB(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' + public static callToTestOrderOfParams(options: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/defaults', + ...options }); } } -export class MultipleTags2Service { - public static dummyA(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' +export class DuplicateService { + public static duplicateName(options?: Options) { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/duplicate', + ...options }); } - public static dummyB(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' + public static duplicateName(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/duplicate', + ...options }); } -} - -export class MultipleTags3Service { - public static dummyB(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' + public static duplicateName(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/duplicate', + ...options }); } -} - -export class NoContentService { - public static callWithNoContentResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-content' - }); - } - - public static callWithResponseAndNoContentResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' + public static duplicateName(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/duplicate', + ...options }); } } -export class NonAsciiÆøåÆøÅöôêÊService { - public static nonAsciiæøåÆøÅöôêÊ字符串(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' +export class NoContentService { + public static callWithNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-content', + ...options }); } - /** - * Login User - */ - public static putWithFormUrlEncoded(options: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - ...urlSearchParamsBodySerializer, - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - ...options?.headers - }, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); } } -export class ParametersService { - public static deleteFoo(options: OptionsLegacyParser) { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' +export class ResponseService { + public static callWithResponseAndNoContentResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); } - public static callWithParameters(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/{parameterPath}' + public static callWithResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/response', + ...options }); } - public static callWithWeirdParameterNames(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + public static callWithDuplicateResponses(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/response', + ...options }); } - public static getCallWithOptionalParam(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/parameters/' + public static callWithResponses(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/response', + ...options }); } - public static postCallWithOptionalParam(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/' +} + +export class MultipleTags1Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); } -} - -export class RequestBodyService { - public static postApiVbyApiVersionRequestBody(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/requestBody/' + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); } } -export class ResponseService { - public static callWithResponseAndNoContentResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' +export class MultipleTags2Service { + public static dummyA(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); } - public static callWithResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/response' + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); } - public static callWithDuplicateResponses(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/response' +} + +export class MultipleTags3Service { + public static dummyB(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); } - public static callWithResponses(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/response' +} + +export class CollectionFormatService { + public static collectionFormat(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/collectionFormat', + ...options }); } } -export class SimpleService { - public static apiVVersionODataControllerCount(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple/$count' +export class TypesService { + public static types(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/types', + ...options }); } - public static getCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).get({ +} + +export class UploadService { + public static uploadFile(options: Options) { + return (options?.client ?? client).post({ + ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/upload', ...options, - url: '/api/v{api-version}/simple' + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + ...options?.headers + } }); } - public static putCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class FileResponseService { + public static fileResponse(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/file/{id}', + ...options }); } - public static postCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class ComplexService { + public static complexTypes(options: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/complex', + ...options }); } - public static deleteCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).delete({ + public static complexParams(options: Options) { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/complex/{id}', ...options, - url: '/api/v{api-version}/simple' + headers: { + 'Content-Type': 'application/json-patch+json', + ...options?.headers + } }); } - public static optionsCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).options({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class MultipartService { + public static multipartResponse(options?: Options) { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multipart', + ...options }); } - public static headCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).head({ + public static multipartRequest(options?: Options) { + return (options?.client ?? client).post({ + ...formDataBodySerializer, + url: '/api/v{api-version}/multipart', ...options, - url: '/api/v{api-version}/simple' + headers: { + 'Content-Type': null, + ...options?.headers + } }); } - public static patchCallWithoutParametersAndResponse(options?: OptionsLegacyParser) { - return (options?.client ?? client).patch({ - ...options, - url: '/api/v{api-version}/simple' +} + +export class HeaderService { + public static callWithResultFromHeader(options?: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/header', + ...options }); } } -export class TypesService { - public static types(options: OptionsLegacyParser) { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/types' +export class ErrorService { + public static testErrorCode(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/error', + ...options }); } } -export class UploadService { - public static uploadFile(options: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, +export class NonAsciiÆøåÆøÅöôêÊService { + public static nonAsciiæøåÆøÅöôêÊ字符串(options: Options) { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options + }); + } + + /** + * Login User + */ + public static putWithFormUrlEncoded(options: Options) { + return (options?.client ?? client).put({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/upload' + } }); } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap index 2a15d5d00..6e06eeedb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class/types.gen.ts.snap @@ -1,306 +1,255 @@ // This file is auto-generated by @hey-api/openapi-ts -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - /** * Model with number-only name */ export type _400 = string; -export type _default = { - name?: string; -}; - /** - * Model with restricted keyword name + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type _import = string; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; +export type CamelCaseCommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; +export type CommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; +export type CommentWithBackticks = number; /** - * This is a simple array containing an array + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work */ -export type ArrayWithArray = Array>; +export type CommentWithBackticksAndQuotes = number; /** - * This is a simple array with booleans + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ -export type ArrayWithBooleans = Array<(boolean)>; +export type CommentWithSlashes = number; /** - * This is a simple array with numbers + * Testing expression placeholders in string: ${expression} should work */ -export type ArrayWithNumbers = Array<(number)>; +export type CommentWithExpressionPlaceholders = number; /** - * This is a simple array with properties + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; +export type CommentWithQuotes = number; /** - * This is a simple array with references + * Testing reserved characters in string: * inline * and ** inline ** should work */ -export type ArrayWithReferences = Array; +export type CommentWithReservedCharacters = number; /** - * This is a simple array with strings + * This is a simple number */ -export type ArrayWithStrings = Array<(string)>; +export type SimpleInteger = number; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple boolean */ -export type camelCaseCommentWithBreaks = number; +export type SimpleBoolean = boolean; /** - * Some % character + * This is a simple string */ -export type CharactersInDescription = string; +export type SimpleString = string; /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) */ -export type CommentWithBackticks = number; +export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; /** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + * This is a simple file */ -export type CommentWithBackticksAndQuotes = number; +export type SimpleFile = unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple reference */ -export type CommentWithBreaks = number; +export type SimpleReference = ModelWithString; /** - * Testing expression placeholders in string: ${expression} should work + * This is a simple string */ -export type CommentWithExpressionPlaceholders = number; +export type SimpleStringWithPattern = string; /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work + * This is a simple enum with strings */ -export type CommentWithQuotes = number; +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * This is a simple enum with strings */ -export type CommentWithReservedCharacters = number; +export const EnumWithStrings = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'NON_ASCII:_ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' +} as const; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharacters = { + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', + '3_1': 3.1, + '': '' +} as const; /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work + * This is a simple enum with numbers */ -export type CommentWithSlashes = number; +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; /** - * This is a base model with two simple optional properties + * This is a simple enum with numbers */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; +export const EnumWithNumbers = { + 1: 1, + 2: 2, + 3: 3, + '1_1': 1.1, + '1_2': 1.2, + '1_3': 1.3, + 100: 100, + 200: 200, + 300: 300, + '-100': -100, + '-200': -200, + '-300': -300, + '-1_1': -1.1, + '-1_2': -1.2, + '-1_3': -1.3 +} as const; /** - * This is a model that extends the base model + * Success=1,Warning=2,Error=3 */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; +export type EnumFromDescription = number; /** - * This is a model with one property with a 'all of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; +export type EnumWithExtensions = 200 | 400 | 500; /** - * This is a model with one property with a 'any of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export const EnumWithExtensions = { + /** + * Used when the status of something is successful + */ + CUSTOM_SUCCESS: 200, + /** + * Used when the status of something has a warning + */ + CUSTOM_WARNING: 400, + /** + * Used when the status of something has an error + */ + CUSTOM_ERROR: 500 +} as const; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +export const EnumWithXEnumNames = { + ZERO: 0, + ONE: 1, + TWO: 2 +} as const; /** - * This is a model with one property with a 'any of' relationship + * This is a simple array with numbers */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; +export type ArrayWithNumbers = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with booleans */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; +export type ArrayWithBooleans = Array; /** - * This is a model with nested 'any of' property with a type null + * This is a simple array with strings */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; +export type ArrayWithStrings = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with references */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; +export type ArrayWithReferences = Array; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array containing an array */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export type ArrayWithArray = Array>; /** - * This is a model that contains a dictionary of complex arrays (composited) within composition + * This is a simple array with properties */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; +export type ArrayWithProperties = Array<{ + '16x16'?: CamelCaseCommentWithBreaks; + bar?: string; +}>; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; +export type ArrayWithAnyOfProperties = Array<{ + foo?: string; } | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; + bar?: string; +}>; -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); +export type AnyOfAnyAndNull = { + data?: unknown | null; }; /** - * This is a model that contains a simple dictionary within composition + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); +export type AnyOfArrays = { + results?: Array<{ + foo?: string; + } | { + bar?: string; + }>; }; /** - * This is a model with one property with a 'one of' relationship where the options are not $ref + * This is a string dictionary */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); +export type DictionaryWithString = { + [key: string]: string; }; -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -export type ConstValue = "ConstValue"; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: string | number | boolean | undefined; +}; /** - * This is a deprecated model with a deprecated property - * @deprecated + * This is a string reference */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; +export type DictionaryWithReference = { + [key: string]: ModelWithString; }; /** @@ -315,7 +264,7 @@ export type DictionaryWithArray = { */ export type DictionaryWithDictionary = { [key: string]: { - [key: string]: (string); + [key: string]: string; }; }; @@ -329,193 +278,204 @@ export type DictionaryWithProperties = { }; }; -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - /** - * This is a string reference + * This is a model with one number property */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; }; /** - * This is a string dictionary + * This is a model with one boolean property */ -export type DictionaryWithString = { - [key: string]: (string); +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; }; /** - * Success=1,Warning=2,Error=3 + * This is a model with one string property */ -export type EnumFromDescription = number; +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * This is a model with one string property */ -export type EnumWithExtensions = 200 | 400 | 500; +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) */ -export const EnumWithExtensions = { +export type ModelFromZendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { /** - * Used when the status of something is successful + * This is a simple string property */ - CUSTOM_SUCCESS: 200, + nullableProp1?: string; /** - * Used when the status of something has a warning + * This is a simple string property */ - CUSTOM_WARNING: 400, + nullableRequiredProp1: string; /** - * Used when the status of something has an error + * This is a simple string property */ - CUSTOM_ERROR: 500 -} as const; + nullableProp2?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: string | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; /** - * This is a simple enum with numbers + * This is a model with one enum */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: true; +}; /** - * This is a simple enum with numbers + * This is a model with one enum with escaped name */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; /** - * This is a simple enum with strings + * This is a model with one enum */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; /** - * This is a simple enum with strings + * This is a model with nested enums */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: 'Success' | 'Warning' | 'Error'; + }; + dictionaryWithEnumFromDescription?: { + [key: string]: number; + }; + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; + arrayWithDescription?: Array; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; }; /** - * This is a free-form object with additionalProperties: {}. + * This is a model with one property containing a reference */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; +export type ModelWithReference = { + prop?: ModelWithProperties; }; /** - * This is a free-form object with additionalProperties: true. + * This is a model with one property containing an array */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; /** - * This is a free-form object without additionalProperties. + * This is a model with one property containing an array */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; }; }; -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - /** - * This schema was giving PascalCase transformations a hard time + * This is a deprecated model with a deprecated property + * @deprecated */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { +export type DeprecatedModel = { /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + * This is a deprecated property + * @deprecated */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); + prop?: string; }; /** - * This schema was giving PascalCase transformations a hard time + * This is a model with one property containing a circular reference */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; }; /** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type Model_From_Zendesk = string; +export type CompositionWithOneOfAnonymous = { + propA?: { + propA?: string; + } | string | number; +}; /** * Circle */ export type ModelCircle = { - kind: 'circle'; + kind: string; radius?: number; }; @@ -523,365 +483,296 @@ export type ModelCircle = { * Square */ export type ModelSquare = { - kind: 'square'; + kind: string; sideLength?: number; }; /** - * This is a model that extends another model + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & ModelSquare); + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model that extends another model + * This is a model with one property with a 'any of' relationship where the options are not $ref */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; +export type CompositionWithAnyOfAnonymous = { + propA?: { + propA?: string; + } | string | number; }; /** - * This is a model with one property and additionalProperties: true + * This is a model with nested 'any of' property with a type null */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; +export type CompositionWithNestedAnyAndTypeNull = { + propA?: Array | Array; }; -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; +export type _3eNum1Период = 'Bird' | 'Dog'; -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; +export const _3eNum1Период = { + BIRD: 'Bird', + DOG: 'Dog' +} as const; -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; +export type ConstValue = 'ConstValue'; -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: Array<_3eNum1Период | ConstValue> | null; +}; /** - * This is a model with one property containing an array + * This is a model with one property with a 'one of' relationship */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with one property containing an array + * This is a model that contains a simple dictionary within composition */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: boolean | { + [key: string]: number; + }; }; /** - * Some description with `back ticks` + * This is a model that contains a dictionary of simple arrays within composition */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one boolean property + * This is a model that contains a dictionary of complex arrays (composited) within composition */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one property containing a circular reference + * This is a model with one property with a 'all of' relationship */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; +export type CompositionWithAllOfAndNullable = { + propA?: { + boolean?: boolean; + } & ModelWithEnum & ModelWithArray & ModelWithDictionary; }; -export type ModelWithConstantSizeArray = [ - number, - number -]; - /** - * This is a model with one property containing a dictionary + * This is a model with one property with a 'any of' relationship */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; +export type CompositionWithAnyOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with duplicated imports + * This is a base model with two simple optional properties */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; }; /** - * This is a model with duplicated properties + * This is a model that extends the base model */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; +export type CompositionExtendedModel = CompositionBaseModel & { + age: number; + firstName: string; + lastname: string; }; /** - * This is a model with one enum + * This is a model with one nested property */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; }; /** - * This is a simple enum with strings + * This is a model with one nested property */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; /** - * This is a simple enum with strings + * This is a model with duplicated properties */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; /** - * These are the HTTP error code enums + * This is a model with ordered properties */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; /** - * These are the HTTP error code enums + * This is a model with duplicated imports */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; /** - * This is a model with one enum + * This is a model that extends another model */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; }; /** - * This is a model with one enum with escaped name + * This is a model that extends another model */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; }; -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** - * This is a model with one number property + * This is a model that contains a some patterns */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; }; -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; }; -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; +export type Default = { + name?: string; }; -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); +export type Pageable = { + page?: number; + size?: number; + sort?: Array; }; /** - * This is a model with nested enums + * This is a free-form object without additionalProperties. */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; }; /** - * This is a model with one nested property + * This is a free-form object with additionalProperties: true. */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; }; -export type ModelWithNullableObject = { - data?: NullableObject; +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; }; /** - * This is a model with one string property + * This is a model with one property and additionalProperties: true */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; +export type ModelWithAdditionalPropertiesEqTrue = { /** * This is a simple string property */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + prop?: string; + [key: string]: unknown | string | undefined; }; -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; +}) & { + baz: number; + qux: number; }; /** - * Период + * An object that can be null */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NullableObject = { + foo?: string; +} | null; /** - * Период + * Some % character */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; +export type CharactersInDescription = string; -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; +export type ModelWithNullableObject = { + data?: NullableObject; }; export type ModelWithOneOfEnum = { @@ -895,64 +786,38 @@ export type ModelWithOneOfEnum = { foo: 'Quux'; } | { content: [ - (string), - (string) + unknown, + unknown ]; foo: 'Corge'; }; -export type foo = 'Bar'; - -export const foo = { - BAR: 'Bar' -} as const; +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; +export const ModelWithNestedArrayEnumsDataFoo = { + FOO: 'foo', + BAR: 'bar' +} as const; -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export const ModelWithNestedArrayEnumsDataBar = { + BAZ: 'baz', + QUX: 'qux' +} as const; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; }; -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; +}; -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; }; export type ModelWithReadOnlyAndWriteOnly = { @@ -961,81 +826,116 @@ export type ModelWithReadOnlyAndWriteOnly = { baz: string; }; -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; +export type ModelWithConstantSizeArray = [ + number, + number +]; -/** - * This is a model with one string property - */ -export type ModelWithString = { +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + number | string, + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + number | string, + number | string, + number | string +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + number | Import, + number | Import +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + number & string, + number & string +]; + +export type ModelWithNumericEnumUnion = { /** - * This is a simple string property + * Период */ - prop?: string; + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; }; /** - * This is a model with one string property + * Some description with `back ticks` */ -export type ModelWithStringError = { +export type ModelWithBackticksInDescription = { /** - * This is a simple string property + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
*/ - prop?: string; + template?: string; }; -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); +export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { + baz: number; + qux: number; }; /** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * An object that can be null + * Model used to test deduplication strategy (unused) */ -export type NullableObject = { - foo?: string; -} | null; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; +export type ParameterSimpleParameterUnused = string; /** - * This is a reusable parameter + * Model used to test deduplication strategy */ -export type ParameterSimpleParameter = string; +export type PostServiceWithEmptyTagResponse = string; /** - * Model used to test deduplication strategy (unused) + * Model used to test deduplication strategy */ -export type ParameterSimpleParameterUnused = string; +export type PostServiceWithEmptyTagResponse2 = string; /** - * Parameter with illegal characters + * Model used to test deduplication strategy */ -export type Parameterx_Foo_Bar = ModelWithString; +export type DeleteFooData = string; /** * Model used to test deduplication strategy */ -export type PostServiceWithEmptyTagResponse = string; +export type DeleteFooData2 = string; /** - * Model used to test deduplication strategy + * Model with restricted keyword name */ -export type PostServiceWithEmptyTagResponse2 = string; +export type Import = string; export type SchemaWithFormRestrictedKeys = { description?: string; @@ -1050,244 +950,235 @@ export type SchemaWithFormRestrictedKeys = { 'x-enumNames'?: string; title?: string; }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; + array?: Array; }; /** - * This is a simple boolean + * This schema was giving PascalCase transformations a hard time */ -export type SimpleBoolean = boolean; +export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; /** - * This is a simple file + * This schema was giving PascalCase transformations a hard time */ -export type SimpleFile = (Blob | File); +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: unknown; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: number; +}; + +export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; + +export type GenericSchemaDuplicateIssue1SystemBoolean = { + item?: boolean; + error?: string; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemString = { + item?: string; + error?: string; + readonly hasError?: boolean; +}; /** - * This is a simple number + * This is a reusable parameter */ -export type SimpleInteger = number; +export type SimpleParameter = string; /** - * This is a simple reference + * Parameter with illegal characters */ -export type SimpleReference = ModelWithString; +export type XFooBar = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleString = string; +export type SimpleRequestBody = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleStringWithPattern = (string) | null; +export type SimpleFormData = ModelWithString; -export type CollectionFormatData = { - query: { - /** - * This is an array parameter that is sent as csv format (comma-separated values) - */ - parameterArrayCSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array<(string)> | null; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array<(string)> | null; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySSV: Array<(string)> | null; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTSV: Array<(string)> | null; - }; +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; }; -export type ComplexTypesData = { - query: { - /** - * Parameter containing object - */ - parameterObject: { - first?: { - second?: { - third?: string; - }; - }; - }; - /** - * Parameter containing reference - */ - parameterReference: ModelWithString; - }; +export type ImportData = { + body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; }; -export type ComplexTypesResponse = (Array); +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnly; +}; -export type ComplexTypesError = (unknown); +export type ImportResponse = ImportResponses[keyof ImportResponses]; -export type ComplexParamsData = { - body?: { - readonly key: (string) | null; - name: (string) | null; - enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); - readonly user?: { - readonly id?: number; - readonly name?: (string) | null; - }; - }; - path: { - /** - * api-version should be required in standalone clients - */ - 'api-version': string; - id: number; - }; +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; }; -export type ComplexParamsResponse = (ModelWithString); - -export type ComplexParamsError = unknown; - -export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; }; -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); - -export type ImportError = unknown; +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; path: { /** * foo in method */ foo_param: string; }; + query?: never; + url: '/api/v{api-version}/simple:operation'; }; -export type GetApiVbyApiVersionSimpleOperationResponse = (number); +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; -export type CallWithDefaultParametersData = { - query?: { - /** - * This is a simple boolean with default value - */ - parameterBoolean?: (boolean) | null; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: (ModelWithString) | null; - /** - * This is a simple number with default value - */ - parameterNumber?: (number) | null; - /** - * This is a simple string with default value - */ - parameterString?: (string) | null; - }; +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; }; -export type CallWithDefaultOptionalParametersData = { - query?: { - /** - * This is a simple boolean that is optional with default value - */ - parameterBoolean?: boolean; - /** - * This is a simple enum that is optional with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model that is optional with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; - }; +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; }; -export type CallToTestOrderOfParamsData = { - query: { - /** - * This is a optional string with default - */ - parameterOptionalStringWithDefault?: string; - /** - * This is a optional string with empty default - */ - parameterOptionalStringWithEmptyDefault?: string; - /** - * This is a optional string with no default - */ - parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; - /** - * This is a string with default - */ - parameterStringWithDefault: string; +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type DeleteFooData3 = { + body?: never; + headers: { /** - * This is a string with empty default + * Parameter with illegal characters */ - parameterStringWithEmptyDefault: string; + 'x-Foo-Bar': ModelWithString; + }; + path: { /** - * This is a string with no default + * foo in method */ - parameterStringWithNoDefault: string; - }; -}; - -export type DeprecatedCallData = { - headers: { + foo_param: string; /** - * This parameter is deprecated - * @deprecated + * bar in method */ - parameter: (DeprecatedModel) | null; + BarParam: string; }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; }; export type CallWithDescriptionsData = { + body?: never; + path?: never; query?: { - /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work - */ - parameterWithBackticks?: unknown; /** * Testing multiline comments in string: First line * Second line @@ -1296,135 +1187,41 @@ export type CallWithDescriptionsData = { */ parameterWithBreaks?: unknown; /** - * Testing expression placeholders in string: ${expression} should work - */ - parameterWithExpressionPlaceholders?: unknown; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: unknown; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ - parameterWithReservedCharacters?: unknown; + parameterWithBackticks?: unknown; /** * Testing slashes in string: \backwards\\\ and /forwards/// should work */ parameterWithSlashes?: unknown; - }; -}; - -export type TestErrorCodeData = { - query: { - /** - * Status code to return - */ - status: number; - }; -}; - -export type TestErrorCodeResponse = (unknown); - -export type TestErrorCodeError = (unknown); - -export type FileResponseData = { - path: { /** - * api-version should be required in standalone clients + * Testing expression placeholders in string: ${expression} should work */ - 'api-version': string; - id: string; - }; -}; - -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; - -export type PostApiVbyApiVersionFormDataData = { - /** - * A reusable request body - */ - body?: ModelWithString; - query?: { + parameterWithExpressionPlaceholders?: unknown; /** - * This is a reusable parameter + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ - parameter?: string; - }; -}; - -export type CallWithResultFromHeaderResponse = (string); - -export type CallWithResultFromHeaderError = (unknown); - -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; -}; - -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; - }; -}); - -export type MultipartResponseError = unknown; - -export type DummyAResponse = (_400); - -export type DummyAError = unknown; - -export type DummyBResponse = (void); - -export type DummyBError = unknown; - -export type CallWithNoContentResponseResponse = (void); - -export type CallWithNoContentResponseError = unknown; - -export type CallWithResponseAndNoContentResponseResponse = (number | void); - -export type CallWithResponseAndNoContentResponseError = unknown; - -export type NonAsciiæøåÆøÅöôêÊ字符串Data = { - query: { + parameterWithQuotes?: unknown; /** - * Dummy input param + * Testing reserved characters in string: * inline * and ** inline ** should work */ - nonAsciiParamæøåÆØÅöôêÊ: number; + parameterWithReservedCharacters?: unknown; }; + url: '/api/v{api-version}/descriptions/'; }; -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); - -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; - -export type PutWithFormUrlEncodedData = { - body: ArrayWithStrings; -}; - -export type DeleteFooData3 = { +export type DeprecatedCallData = { + body?: never; headers: { /** - * Parameter with illegal characters - */ - 'x-Foo-Bar': ModelWithString; - }; - path: { - /** - * bar in method - */ - BarParam: string; - /** - * foo in method + * This parameter is deprecated + * @deprecated */ - foo_param: string; + parameter: DeprecatedModel; }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; }; export type CallWithParametersData = { @@ -1433,49 +1230,50 @@ export type CallWithParametersData = { */ body: { [key: string]: unknown; - } | null; + }; headers: { /** * This is the parameter that goes into the header */ - parameterHeader: (string) | null; + parameterHeader: string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + parameterPath: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - parameterPath: (string) | null; + 'api-version': string; }; query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; /** * This is the parameter that goes into the query params */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + cursor: string; }; + url: '/api/v{api-version}/parameters/{parameterPath}'; }; export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the body */ - body: (ModelWithString) | null; + body: ModelWithString; headers: { /** * This is the parameter that goes into the request header */ - 'parameter.header': (string) | null; + 'parameter.header': string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + 'parameter.path.1'?: string; /** * This is the parameter that goes into the path */ @@ -1485,9 +1283,9 @@ export type CallWithWeirdParameterNamesData = { */ 'PARAMETER-PATH-3'?: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - 'parameter.path.1'?: string; + 'api-version': string; }; query: { /** @@ -1497,8 +1295,9 @@ export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the request query params */ - 'parameter-query': (string) | null; + 'parameter-query': string; }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; }; export type GetCallWithOptionalParamData = { @@ -1506,12 +1305,14 @@ export type GetCallWithOptionalParamData = { * This is a required parameter */ body: ModelWithOneOfEnum; + path?: never; query?: { /** * This is an optional parameter */ page?: number; }; + url: '/api/v{api-version}/parameters/'; }; export type PostCallWithOptionalParamData = { @@ -1519,54 +1320,391 @@ export type PostCallWithOptionalParamData = { * This is an optional parameter */ body?: { - offset?: (number) | null; + offset?: number; }; + path?: never; query: { /** * This is a required parameter */ parameter: Pageable; }; + url: '/api/v{api-version}/parameters/'; }; -export type PostCallWithOptionalParamResponse = (number | void); +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type PostCallWithOptionalParamError = unknown; +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleRequestBody; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/requestBody/'; }; -export type CallWithResponseResponse = (_import); - -export type CallWithResponseError = unknown; - -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); - -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); - -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); - -export type CallWithResponsesError = (ModelWithStringError); - -export type ApiVVersionODataControllerCountResponse = (Model_From_Zendesk); - -export type ApiVVersionODataControllerCountError = unknown; +export type PostApiVbyApiVersionFormDataData = { + /** + * A reusable request body + */ + body?: SimpleFormData; + path?: never; + query?: { + /** + * This is a reusable parameter + */ + parameter?: string; + }; + url: '/api/v{api-version}/formData/'; +}; + +export type CallWithDefaultParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string with default value + */ + parameterString?: string; + /** + * This is a simple number with default value + */ + parameterNumber?: number; + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; + query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; + query: { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string with default + */ + parameterStringWithDefault: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string; + }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; + +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; + +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; + +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; + +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; + +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; + +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; + +export type DummyAResponses = { + 200: _400; +}; + +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; + +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; + +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; + +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; + +export type CollectionFormatData = { + body?: never; + path?: never; + query: { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCSV: Array; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySSV: Array; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTSV: Array; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array; + }; + url: '/api/v{api-version}/collectionFormat'; +}; export type TypesData = { + body?: never; path?: { /** * This is a number parameter @@ -1575,56 +1713,297 @@ export type TypesData = { }; query: { /** - * This is an array parameter + * This is a number parameter */ - parameterArray: Array<(string)> | null; + parameterNumber: number; + /** + * This is a string parameter + */ + parameterString: string; /** * This is a boolean parameter */ - parameterBoolean: (boolean) | null; + parameterBoolean: boolean; + /** + * This is an object parameter + */ + parameterObject: { + [key: string]: unknown; + }; + /** + * This is an array parameter + */ + parameterArray: Array; /** * This is a dictionary parameter */ parameterDictionary: { [key: string]: unknown; - } | null; + }; /** * This is an enum parameter */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; + parameterEnum: 'Success' | 'Warning' | 'Error'; + }; + url: '/api/v{api-version}/types'; +}; + +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; + +export type TypesResponse = TypesResponses[keyof TypesResponses]; + +export type UploadFileData = { + body: unknown; + path: { /** - * This is a number parameter + * api-version should be required in standalone clients */ - parameterNumber: number; + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/upload'; +}; + +export type UploadFileResponses = { + 200: boolean; +}; + +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; + +export type FileResponseData = { + body?: never; + path: { + id: string; /** - * This is an object parameter + * api-version should be required in standalone clients + */ + 'api-version': string; + }; + query?: never; + url: '/api/v{api-version}/file/{id}'; +}; + +export type FileResponseResponses = { + /** + * Success + */ + 200: unknown; +}; + +export type ComplexTypesData = { + body?: never; + path?: never; + query: { + /** + * Parameter containing object */ parameterObject: { - [key: string]: unknown; - } | null; + first?: { + second?: { + third?: string; + }; + }; + }; /** - * This is a string parameter + * Parameter containing reference */ - parameterString: (string) | null; + parameterReference: ModelWithString; }; + url: '/api/v{api-version}/complex'; }; -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; -export type TypesError = unknown; +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; -export type UploadFileData = { - body: (Blob | File); +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; + +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; + }; +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; + +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; + +export type ComplexParamsData = { + body?: { + readonly key: string; + name: string; + enabled?: boolean; + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array; + listOfStrings?: Array; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string; + }; + }; path: { + id: number; /** * api-version should be required in standalone clients */ - 'api-version': (string) | null; + 'api-version': string; }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; }; -export type UploadFileResponse = (boolean); +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; -export type UploadFileError = unknown; \ No newline at end of file +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; + +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; + +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; + +export type TestErrorCodeData = { + body?: never; + path?: never; + query: { + /** + * Status code to return + */ + status: number; + }; + url: '/api/v{api-version}/error'; +}; + +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; + +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; + query: { + /** + * Dummy input param + */ + nonAsciiParamæøåÆØÅöôêÊ: number; + }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; + +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; + +export type PutWithFormUrlEncodedData = { + body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/sdk.gen.ts.snap index 51aa8edfd..5efe17ca7 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/sdk.gen.ts.snap @@ -1,53 +1,55 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; +import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; +import type { ParentModelWithDatesData, ParentModelWithDatesResponse, ModelWithDatesData, ModelWithDatesResponse, ModelWithDatesArrayData, ModelWithDatesArrayResponse, ArrayOfDatesData, ArrayOfDatesResponse, DateData, DateResponse, MultipleResponsesData, MultipleResponsesResponse } from './types.gen'; +import { modelWithDatesResponseTransformer, modelWithDatesArrayResponseTransformer, arrayOfDatesResponseTransformer, dateResponseTransformer } from './transformers.gen'; export const client = createClient(createConfig()); export class DefaultService { - public static parentModelWithDates(options?: OptionsLegacyParser) { - return (options?.client ?? client).post({ - ...options, + public static parentModelWithDates(options?: Options) { + return (options?.client ?? client).post({ url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer + ...options }); } - public static modelWithDates(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, + public static modelWithDates(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesResponseTransformer, url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer + ...options }); } - public static modelWithDatesArray(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, + public static modelWithDatesArray(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesArrayResponseTransformer, url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer + ...options }); } - public static arrayOfDates(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' + public static arrayOfDates(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: arrayOfDatesResponseTransformer, + url: '/api/array-of-dates', + ...options }); } - public static date(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/date' + public static date(options?: Options) { + return (options?.client ?? client).put({ + responseTransformer: dateResponseTransformer, + url: '/api/date', + ...options }); } - public static multipleResponses(options?: OptionsLegacyParser) { - return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' + public static multipleResponses(options?: Options) { + return (options?.client ?? client).put({ + url: '/api/multiple-responses', + ...options }); } diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/transformers.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/transformers.gen.ts.snap new file mode 100644 index 000000000..699754aca --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/transformers.gen.ts.snap @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ModelWithDatesResponse, ModelWithDatesArrayResponse, ArrayOfDatesResponse, DateResponse } from './types.gen'; + +const modelWithDatesSchemaResponseTransformer = (data: any) => { + data.modified = new Date(data.modified); + if (data.expires) { + data.expires = new Date(data.expires); + } + return data; +}; + +export const modelWithDatesResponseTransformer = async (data: any): Promise => { + data = modelWithDatesSchemaResponseTransformer(data); + return data; +}; + +export const modelWithDatesArrayResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return modelWithDatesSchemaResponseTransformer(item); + }); + return data; +}; + +export const arrayOfDatesResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return new Date(item); + }); + return data; +}; + +export const dateResponseTransformer = async (data: any): Promise => { + data = new Date(data); + return data; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap index 0326edf4c..0c44fd1ac 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-class_transform/types.gen.ts.snap @@ -1,5 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * This is a model that contains a some dates + */ +export type SimpleModel = { + id: number; + name: string; + readonly enabled: boolean; +}; + /** * This is a model that contains a some dates */ @@ -19,100 +28,113 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; + 'nullable-date'?: Array; simpleItems?: Array; simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; + dates?: Array; + strings?: Array; }; -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; +export type ParentModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; }; -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); +export type ParentModelWithDatesResponses = { + /** + * Success + */ + 200: ParentModelWithDates; + /** + * Success + */ + 201: unknown; +}; -export type ArrayOfDatesError = unknown; +export type ParentModelWithDatesResponse = ParentModelWithDatesResponses[keyof ParentModelWithDatesResponses]; -export type DateResponse = (Date); +export type ModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; +}; -export type DateError = unknown; +export type ModelWithDatesResponses = { + /** + * Success + */ + 200: ModelWithDates; +}; -export type MultipleResponsesResponse = (Array | Array); +export type ModelWithDatesResponse = ModelWithDatesResponses[keyof ModelWithDatesResponses]; -export type MultipleResponsesError = unknown; +export type ModelWithDatesArrayData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates-array'; +}; -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; +export type ModelWithDatesArrayResponses = { + /** + * Success + */ + 200: Array; +}; -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; +export type ModelWithDatesArrayResponse = ModelWithDatesArrayResponses[keyof ModelWithDatesArrayResponses]; -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; +export type ArrayOfDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/array-of-dates'; +}; -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; +export type ArrayOfDatesResponses = { + /** + * Success + */ + 200: Array; }; -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; +export type ArrayOfDatesResponse = ArrayOfDatesResponses[keyof ArrayOfDatesResponses]; + +export type DateData = { + body?: never; + path?: never; + query?: never; + url: '/api/date'; }; -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; +export type DateResponses = { + /** + * Success + */ + 200: Date; }; -export type ModelWithDatesResponseTransformer = (data: any) => Promise; +export type DateResponse = DateResponses[keyof DateResponses]; -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; +export type MultipleResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/multiple-responses'; }; -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; +export type MultipleResponsesResponses = { + /** + * Updated + */ + 200: Array; + /** + * Created + */ + 201: Array; +}; -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file +export type MultipleResponsesResponse = MultipleResponsesResponses[keyof MultipleResponsesResponses]; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/sdk.gen.ts.snap index b765dc9f2..0e25ad7cc 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/sdk.gen.ts.snap @@ -1,354 +1,382 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; -import type { ImportData, ImportError, ImportResponse, ApiVVersionODataControllerCountError, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationResponse, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamError, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, CallWithNoContentResponseError, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseError, CallWithResponseAndNoContentResponseResponse, DummyAError, DummyAResponse, DummyBError, DummyBResponse, CallWithResponseError, CallWithResponseResponse, CallWithDuplicateResponsesError, CallWithDuplicateResponsesResponse, CallWithResponsesError, CallWithResponsesResponse, CollectionFormatData, TypesData, TypesError, TypesResponse, UploadFileData, UploadFileError, UploadFileResponse, FileResponseData, FileResponseError, FileResponseResponse, ComplexTypesData, ComplexTypesError, ComplexTypesResponse, MultipartRequestData, MultipartResponseError, MultipartResponseResponse, ComplexParamsData, ComplexParamsError, ComplexParamsResponse, CallWithResultFromHeaderError, CallWithResultFromHeaderResponse, TestErrorCodeData, TestErrorCodeError, TestErrorCodeResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Error, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; +import { createClient, createConfig, type Options, formDataBodySerializer, urlSearchParamsBodySerializer } from '@hey-api/client-fetch'; +import type { ExportData, ImportData, ImportResponse, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, DummyAData, DummyAResponse, DummyBData, DummyBResponse, CallWithResponseData, CallWithResponseResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesError, CallWithResponsesData, CallWithResponsesResponse, CallWithResponsesError, CollectionFormatData, TypesData, TypesResponse, UploadFileData, UploadFileResponse, FileResponseData, ComplexTypesData, ComplexTypesResponse, MultipartResponseData, MultipartResponseResponse, MultipartRequestData, ComplexParamsData, ComplexParamsResponse, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from './types.gen'; export const client = createClient(createConfig()); -export const export_ = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-tag' +export const export_ = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-tag', + ...options }); }; -export const import_ = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const import_ = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/no-tag', ...options, - url: '/api/v{api-version}/no-tag' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const apiVVersionODataControllerCount = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple/$count' +export const apiVVersionODataControllerCount = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple/$count', + ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: OptionsLegacyParser) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple:operation' + url: '/api/v{api-version}/simple:operation', + ...options }); }; -export const getCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/simple' +export const deleteCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const putCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/simple' +export const getCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const postCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/simple' +export const headCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).head({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/simple' +export const optionsCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).options({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).options({ - ...options, - url: '/api/v{api-version}/simple' +export const patchCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).patch({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const headCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).head({ - ...options, - url: '/api/v{api-version}/simple' +export const postCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const patchCallWithoutParametersAndResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).patch({ - ...options, - url: '/api/v{api-version}/simple' +export const putCallWithoutParametersAndResponse = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/simple', + ...options }); }; -export const deleteFoo = (options: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}' +export const deleteFoo = (options: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', + ...options }); }; -export const callWithDescriptions = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/descriptions/' +export const callWithDescriptions = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/descriptions/', + ...options }); }; /** * @deprecated */ -export const deprecatedCall = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/parameters/deprecated' +export const deprecatedCall = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/deprecated', + ...options }); }; -export const callWithParameters = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithParameters = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameterPath}', ...options, - url: '/api/v{api-version}/parameters/{parameterPath}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const callWithWeirdParameterNames = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const callWithWeirdParameterNames = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, - url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const getCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const getCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postCallWithOptionalParam = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postCallWithOptionalParam = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/parameters/', ...options, - url: '/api/v{api-version}/parameters/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionRequestBody = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ +export const postApiVbyApiVersionRequestBody = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/requestBody/', ...options, - url: '/api/v{api-version}/requestBody/' + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } }); }; -export const postApiVbyApiVersionFormData = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const postApiVbyApiVersionFormData = (options?: Options) => { + return (options?.client ?? client).post({ ...formDataBodySerializer, + url: '/api/v{api-version}/formData/', + ...options, headers: { 'Content-Type': null, ...options?.headers - }, - url: '/api/v{api-version}/formData/' + } }); }; -export const callWithDefaultParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultParameters = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callWithDefaultOptionalParameters = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/defaults' +export const callWithDefaultOptionalParameters = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const callToTestOrderOfParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/defaults' +export const callToTestOrderOfParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/defaults', + ...options }); }; -export const duplicateName = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).delete({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName1 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName2 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const duplicateName3 = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).delete({ - ...options, - url: '/api/v{api-version}/duplicate' +export const duplicateName = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/duplicate', + ...options }); }; -export const callWithNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/no-content' +export const callWithNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/no-content', + ...options }); }; -export const callWithResponseAndNoContentResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/response-and-no-content' +export const callWithResponseAndNoContentResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + ...options }); }; -export const dummyA = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/a' +export const dummyA = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/a', + ...options }); }; -export const dummyB = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/multiple-tags/b' +export const dummyB = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multiple-tags/b', + ...options }); }; -export const callWithResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/response' +export const callWithResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithDuplicateResponses = (options?: OptionsLegacyParser) => { +export const callWithDuplicateResponses = (options?: Options) => { return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const callWithResponses = (options?: OptionsLegacyParser) => { +export const callWithResponses = (options?: Options) => { return (options?.client ?? client).put({ - ...options, - url: '/api/v{api-version}/response' + url: '/api/v{api-version}/response', + ...options }); }; -export const collectionFormat = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/collectionFormat' +export const collectionFormat = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/collectionFormat', + ...options }); }; -export const types = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/types' +export const types = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/types', + ...options }); }; -export const uploadFile = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const uploadFile = (options: Options) => { + return (options?.client ?? client).post({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/upload', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/upload' + } }); }; -export const fileResponse = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/file/{id}' +export const fileResponse = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/file/{id}', + ...options }); }; -export const complexTypes = (options: OptionsLegacyParser) => { - return (options?.client ?? client).get({ - ...options, - url: '/api/v{api-version}/complex' +export const complexTypes = (options: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/complex', + ...options }); }; -export const multipartRequest = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - ...formDataBodySerializer, - headers: { - 'Content-Type': null, - ...options?.headers - }, - url: '/api/v{api-version}/multipart' +export const multipartResponse = (options?: Options) => { + return (options?.client ?? client).get({ + url: '/api/v{api-version}/multipart', + ...options }); }; -export const multipartResponse = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).get({ +export const multipartRequest = (options?: Options) => { + return (options?.client ?? client).post({ + ...formDataBodySerializer, + url: '/api/v{api-version}/multipart', ...options, - url: '/api/v{api-version}/multipart' + headers: { + 'Content-Type': null, + ...options?.headers + } }); }; -export const complexParams = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ +export const complexParams = (options: Options) => { + return (options?.client ?? client).put({ + url: '/api/v{api-version}/complex/{id}', ...options, - url: '/api/v{api-version}/complex/{id}' + headers: { + 'Content-Type': 'application/json-patch+json', + ...options?.headers + } }); }; -export const callWithResultFromHeader = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/header' +export const callWithResultFromHeader = (options?: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/header', + ...options }); }; -export const testErrorCode = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/error' +export const testErrorCode = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/error', + ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { + return (options?.client ?? client).post({ + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options }); }; /** * Login User */ -export const putWithFormUrlEncoded = (options: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const putWithFormUrlEncoded = (options: Options) => { + return (options?.client ?? client).put({ ...urlSearchParamsBodySerializer, + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + ...options, headers: { 'Content-Type': 'application/x-www-form-urlencoded', ...options?.headers - }, - url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串' + } }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap index 77cbc3d07..6e06eeedb 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch/types.gen.ts.snap @@ -1,306 +1,255 @@ // This file is auto-generated by @hey-api/openapi-ts -export type _3e_num_1Период = 'Bird' | 'Dog'; - -export const _3e_num_1Период = { - BIRD: 'Bird', - DOG: 'Dog' -} as const; - /** * Model with number-only name */ export type _400 = string; -export type _default = { - name?: string; -}; - /** - * Model with restricted keyword name + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type _import = string; - -export type AdditionalPropertiesIntegerIssue = { - value: number; - [key: string]: (number) | undefined; -}; - -export type AdditionalPropertiesUnknownIssue = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue2 = { - [key: string]: (string | number); -}; - -export type AdditionalPropertiesUnknownIssue3 = string & { - entries: { - [key: string]: AdditionalPropertiesUnknownIssue; - }; -}; - -export type AnyOfAnyAndNull = { - data?: (unknown | null); -}; +export type CamelCaseCommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing multiline comments in string: First line + * Second line + * + * Fourth line */ -export type AnyOfArrays = { - results?: Array<({ - foo?: string; -} | { - bar?: string; -})>; -}; +export type CommentWithBreaks = number; /** - * This is a simple array with any of properties + * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ -export type ArrayWithAnyOfProperties = Array<({ - foo?: string; -} | { - bar?: string; -})>; +export type CommentWithBackticks = number; /** - * This is a simple array containing an array + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work */ -export type ArrayWithArray = Array>; +export type CommentWithBackticksAndQuotes = number; /** - * This is a simple array with booleans + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ -export type ArrayWithBooleans = Array<(boolean)>; +export type CommentWithSlashes = number; /** - * This is a simple array with numbers + * Testing expression placeholders in string: ${expression} should work */ -export type ArrayWithNumbers = Array<(number)>; +export type CommentWithExpressionPlaceholders = number; /** - * This is a simple array with properties + * Testing quotes in string: 'single quote''' and "double quotes""" should work */ -export type ArrayWithProperties = Array<{ - '16x16'?: camelCaseCommentWithBreaks; - bar?: string; -}>; +export type CommentWithQuotes = number; /** - * This is a simple array with references + * Testing reserved characters in string: * inline * and ** inline ** should work */ -export type ArrayWithReferences = Array; +export type CommentWithReservedCharacters = number; /** - * This is a simple array with strings + * This is a simple number */ -export type ArrayWithStrings = Array<(string)>; +export type SimpleInteger = number; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple boolean */ -export type camelCaseCommentWithBreaks = number; +export type SimpleBoolean = boolean; /** - * Some % character + * This is a simple string */ -export type CharactersInDescription = string; +export type SimpleString = string; /** - * Testing backticks in string: `backticks` and ```multiple backticks``` should work + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) */ -export type CommentWithBackticks = number; +export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; /** - * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work + * This is a simple file */ -export type CommentWithBackticksAndQuotes = number; +export type SimpleFile = unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * This is a simple reference */ -export type CommentWithBreaks = number; +export type SimpleReference = ModelWithString; /** - * Testing expression placeholders in string: ${expression} should work + * This is a simple string */ -export type CommentWithExpressionPlaceholders = number; +export type SimpleStringWithPattern = string; /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work + * This is a simple enum with strings */ -export type CommentWithQuotes = number; +export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; /** - * Testing reserved characters in string: * inline * and ** inline ** should work + * This is a simple enum with strings */ -export type CommentWithReservedCharacters = number; +export const EnumWithStrings = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'NON_ASCII:_ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' +} as const; + +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharacters = { + '_SINGLE_QUOTE': "'Single Quote'", + '"_DOUBLE_QUOTES"': '"Double Quotes"', + 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', + '3_1': 3.1, + '': '' +} as const; /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work + * This is a simple enum with numbers */ -export type CommentWithSlashes = number; +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; /** - * This is a base model with two simple optional properties + * This is a simple enum with numbers */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; +export const EnumWithNumbers = { + 1: 1, + 2: 2, + 3: 3, + '1_1': 1.1, + '1_2': 1.2, + '1_3': 1.3, + 100: 100, + 200: 200, + 300: 300, + '-100': -100, + '-200': -200, + '-300': -300, + '-1_1': -1.1, + '-1_2': -1.2, + '-1_3': -1.3 +} as const; /** - * This is a model that extends the base model + * Success=1,Warning=2,Error=3 */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; +export type EnumFromDescription = number; /** - * This is a model with one property with a 'all of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAllOfAndNullable = { - propA?: (({ - boolean?: boolean; -} & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null); -}; +export type EnumWithExtensions = 200 | 400 | 500; /** - * This is a model with one property with a 'any of' relationship + * This is a simple enum with numbers */ -export type CompositionWithAnyOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export const EnumWithExtensions = { + /** + * Used when the status of something is successful + */ + CUSTOM_SUCCESS: 200, + /** + * Used when the status of something has a warning + */ + CUSTOM_WARNING: 400, + /** + * Used when the status of something has an error + */ + CUSTOM_ERROR: 500 +} as const; + +export type EnumWithXEnumNames = 0 | 1 | 2; + +export const EnumWithXEnumNames = { + ZERO: 0, + ONE: 1, + TWO: 2 +} as const; /** - * This is a model with one property with a 'any of' relationship + * This is a simple array with numbers */ -export type CompositionWithAnyOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; +export type ArrayWithNumbers = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with booleans */ -export type CompositionWithAnyOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); -}; +export type ArrayWithBooleans = Array; /** - * This is a model with nested 'any of' property with a type null + * This is a simple array with strings */ -export type CompositionWithNestedAnyAndTypeNull = { - propA?: (Array<(ModelWithDictionary | null)> | Array<(ModelWithArray | null)>); -}; +export type ArrayWithStrings = Array; /** - * This is a model with one property with a 'any of' relationship where the options are not $ref + * This is a simple array with references */ -export type CompositionWithNestedAnyOfAndNull = { - propA?: (Array<(_3e_num_1Период | ConstValue)> | null); -}; +export type ArrayWithReferences = Array; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array containing an array */ -export type CompositionWithOneOf = { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -}; +export type ArrayWithArray = Array>; /** - * This is a model that contains a dictionary of complex arrays (composited) within composition + * This is a simple array with properties */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(number | string)>; -}); -}; +export type ArrayWithProperties = Array<{ + '16x16'?: CamelCaseCommentWithBreaks; + bar?: string; +}>; /** - * This is a model with one property with a 'one of' relationship + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndNullable = { - propA?: (({ - boolean?: boolean; -} | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null); -}; - -export type CompositionWithOneOfAndProperties = ({ - foo: ParameterSimpleParameter; +export type ArrayWithAnyOfProperties = Array<{ + foo?: string; } | { - bar: NonAsciiStringæøåÆØÅöôêÊ字符串; -}) & { - baz: (number) | null; - qux: number; -}; + bar?: string; +}>; -/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: (boolean | { - [key: string]: Array<(boolean)>; -}); +export type AnyOfAnyAndNull = { + data?: unknown | null; }; /** - * This is a model that contains a simple dictionary within composition + * This is a simple array with any of properties */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: (boolean | { - [key: string]: (number); -}); +export type AnyOfArrays = { + results?: Array<{ + foo?: string; + } | { + bar?: string; + }>; }; /** - * This is a model with one property with a 'one of' relationship where the options are not $ref + * This is a string dictionary */ -export type CompositionWithOneOfAnonymous = { - propA?: ({ - propA?: string; -} | string | number); +export type DictionaryWithString = { + [key: string]: string; }; -/** - * This is a model with one property with a 'one of' relationship where the options are not $ref - */ -export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; - -export type ConstValue = "ConstValue"; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData = string; - -/** - * Model used to test deduplication strategy - */ -export type DeleteFooData2 = string; +export type DictionaryWithPropertiesAndAdditionalProperties = { + foo?: number; + bar?: boolean; + [key: string]: string | number | boolean | undefined; +}; /** - * This is a deprecated model with a deprecated property - * @deprecated + * This is a string reference */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; +export type DictionaryWithReference = { + [key: string]: ModelWithString; }; /** @@ -315,7 +264,7 @@ export type DictionaryWithArray = { */ export type DictionaryWithDictionary = { [key: string]: { - [key: string]: (string); + [key: string]: string; }; }; @@ -329,193 +278,204 @@ export type DictionaryWithProperties = { }; }; -export type DictionaryWithPropertiesAndAdditionalProperties = { - foo?: number; - bar?: boolean; - [key: string]: (string | number | boolean) | undefined; -}; - /** - * This is a string reference + * This is a model with one number property */ -export type DictionaryWithReference = { - [key: string]: ModelWithString; +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; }; /** - * This is a string dictionary + * This is a model with one boolean property */ -export type DictionaryWithString = { - [key: string]: (string); +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; }; /** - * Success=1,Warning=2,Error=3 + * This is a model with one string property */ -export type EnumFromDescription = number; +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * This is a model with one string property */ -export type EnumWithExtensions = 200 | 400 | 500; +export type ModelWithStringError = { + /** + * This is a simple string property + */ + prop?: string; +}; /** - * This is a simple enum with numbers + * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) */ -export const EnumWithExtensions = { +export type ModelFromZendesk = string; + +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { /** - * Used when the status of something is successful + * This is a simple string property */ - CUSTOM_SUCCESS: 200, + nullableProp1?: string; /** - * Used when the status of something has a warning + * This is a simple string property */ - CUSTOM_WARNING: 400, + nullableRequiredProp1: string; /** - * Used when the status of something has an error + * This is a simple string property */ - CUSTOM_ERROR: 500 -} as const; + nullableProp2?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: string | null; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +}; /** - * This is a simple enum with numbers + * This is a model with one enum */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: true; +}; /** - * This is a simple enum with numbers + * This is a model with one enum with escaped name */ -export const EnumWithNumbers = { - '_1': 1, - '_2': 2, - '_3': 3, - '_1.1': 1.1, - '_1.2': 1.2, - '_1.3': 1.3, - '_100': 100, - '_200': 200, - '_300': 300, - '_-100': -100, - '_-200': -200, - '_-300': -300, - '_-1.1': -1.1, - '_-1.2': -1.2, - '_-1.3': -1.3 -} as const; - -export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharacters = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'ØÆÅÔÖ_ØÆÅÔÖ字符串': 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '' -} as const; +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; /** - * This is a simple enum with strings + * This is a model with one enum */ -export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | "'Single Quote'" | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; /** - * This is a simple enum with strings + * This is a model with nested enums */ -export const EnumWithStrings = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - 'NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串': 'Non-ascii: øæåôöØÆÅÔÖ字符串' -} as const; - -export type EnumWithXEnumNames = 0 | 1 | 2; - -export const EnumWithXEnumNames = { - zero: 0, - one: 1, - two: 2 -} as const; - -export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; +export type ModelWithNestedEnums = { + dictionaryWithEnum?: { + [key: string]: 'Success' | 'Warning' | 'Error'; + }; + dictionaryWithEnumFromDescription?: { + [key: string]: number; + }; + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; + arrayWithDescription?: Array; + /** + * This is a simple enum with strings + */ + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; }; /** - * This is a free-form object with additionalProperties: {}. + * This is a model with one property containing a reference */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - [key: string]: unknown; +export type ModelWithReference = { + prop?: ModelWithProperties; }; /** - * This is a free-form object with additionalProperties: true. + * This is a model with one property containing an array */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = { - [key: string]: unknown; +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; /** - * This is a free-form object without additionalProperties. + * This is a model with one property containing an array */ -export type FreeFormObjectWithoutAdditionalProperties = { - [key: string]: unknown; +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; }; -export type Generic_Schema_Duplicate_Issue_1_System_Boolean_ = { - item?: boolean; - error?: (string) | null; - readonly hasError?: boolean; - data?: { - [key: string]: unknown; +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: { + [key: string]: string; }; }; -export type Generic_Schema_Duplicate_Issue_1_System_String_ = { - item?: (string) | null; - error?: (string) | null; - readonly hasError?: boolean; -}; - /** - * This schema was giving PascalCase transformations a hard time + * This is a deprecated model with a deprecated property + * @deprecated */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_DeleteOptions = { +export type DeprecatedModel = { /** - * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + * This is a deprecated property + * @deprecated */ - preconditions?: (io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions); + prop?: string; }; /** - * This schema was giving PascalCase transformations a hard time + * This is a model with one property containing a circular reference */ -export type io_k8s_apimachinery_pkg_apis_meta_v1_Preconditions = { - /** - * Specifies the target ResourceVersion - */ - resourceVersion?: string; - /** - * Specifies the target UID. - */ - uid?: string; +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; }; /** - * `Comment` or `VoiceComment`. The JSON object for adding voice comments to tickets is different. See [Adding voice comments to tickets](/documentation/ticketing/managing-tickets/adding-voice-comments-to-tickets) + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type Model_From_Zendesk = string; +export type CompositionWithOneOfAnonymous = { + propA?: { + propA?: string; + } | string | number; +}; /** * Circle */ export type ModelCircle = { - kind: 'circle'; + kind: string; radius?: number; }; @@ -523,365 +483,296 @@ export type ModelCircle = { * Square */ export type ModelSquare = { - kind: 'square'; + kind: string; sideLength?: number; }; /** - * This is a model that extends another model + * This is a model with one property with a 'one of' relationship where the options are not $ref */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; +export type CompositionWithOneOfDiscriminator = ({ + kind?: 'circle'; +} & ModelCircle) | ({ + kind?: 'square'; +} & ModelSquare); + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model that extends another model + * This is a model with one property with a 'any of' relationship where the options are not $ref */ -export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { - propExtendsC?: string; - propExtendsD?: ModelWithString; +export type CompositionWithAnyOfAnonymous = { + propA?: { + propA?: string; + } | string | number; }; /** - * This is a model with one property and additionalProperties: true + * This is a model with nested 'any of' property with a type null */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown | string; +export type CompositionWithNestedAnyAndTypeNull = { + propA?: Array | Array; }; -export type ModelWithAnyOfConstantSizeArray = [ - (number | string), - (number | string), - (number | string) -]; +export type _3eNum1Период = 'Bird' | 'Dog'; -export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ - (number & string), - (number & string) -]; +export const _3eNum1Период = { + BIRD: 'Bird', + DOG: 'Dog' +} as const; -export type ModelWithAnyOfConstantSizeArrayNullable = [ - ((number) | null | string), - ((number) | null | string), - ((number) | null | string) -]; +export type ConstValue = 'ConstValue'; -export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ - (number | _import), - (number | _import) -]; +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: Array<_3eNum1Период | ConstValue> | null; +}; /** - * This is a model with one property containing an array + * This is a model with one property with a 'one of' relationship */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with one property containing an array + * This is a model that contains a simple dictionary within composition */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array<((Blob | File))>; - propWithNumber?: Array<(number)>; +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: boolean | { + [key: string]: number; + }; }; /** - * Some description with `back ticks` + * This is a model that contains a dictionary of simple arrays within composition */ -export type ModelWithBackticksInDescription = { - /** - * The template `that` should be used for parsing and importing the contents of the CSV file. - * - *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

- *
-     * [
-     * {
-     * "resourceType": "Asset",
-     * "identifier": {
-     * "name": "${1}",
-     * "domain": {
-     * "name": "${2}",
-     * "community": {
-     * "name": "Some Community"
-     * }
-     * }
-     * },
-     * "attributes" : {
-     * "00000000-0000-0000-0000-000000003115" : [ {
-     * "value" : "${3}"
-     * } ],
-     * "00000000-0000-0000-0000-000000000222" : [ {
-     * "value" : "${4}"
-     * } ]
-     * }
-     * }
-     * ]
-     * 
- */ - template?: string; +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one boolean property + * This is a model that contains a dictionary of complex arrays (composited) within composition */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | { + [key: string]: Array; + }; }; /** - * This is a model with one property containing a circular reference + * This is a model with one property with a 'all of' relationship */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; - -export type ModelWithConst = { - String?: "String"; - number?: 0; - null?: null; - withType?: "Some string"; +export type CompositionWithAllOfAndNullable = { + propA?: { + boolean?: boolean; + } & ModelWithEnum & ModelWithArray & ModelWithDictionary; }; -export type ModelWithConstantSizeArray = [ - number, - number -]; - /** - * This is a model with one property containing a dictionary + * This is a model with one property with a 'any of' relationship */ -export type ModelWithDictionary = { - prop?: { - [key: string]: (string); - }; +export type CompositionWithAnyOfAndNullable = { + propA?: { + boolean?: boolean; + } | ModelWithEnum | ModelWithArray | ModelWithDictionary; }; /** - * This is a model with duplicated imports + * This is a base model with two simple optional properties */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; }; /** - * This is a model with duplicated properties + * This is a model that extends the base model */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; +export type CompositionExtendedModel = CompositionBaseModel & { + age: number; + firstName: string; + lastname: string; }; /** - * This is a model with one enum + * This is a model with one nested property */ -export type ModelWithEnum = { - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; - /** - * These are the HTTP error code enums - */ - statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; - /** - * Simple boolean enum - */ - bool?: boolean; +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: string; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; }; /** - * This is a simple enum with strings + * This is a model with one nested property */ -export type foo_bar_enum = 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; /** - * This is a simple enum with strings + * This is a model with duplicated properties */ -export const foo_bar_enum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - 'ØÆÅ字符串': 'ØÆÅ字符串' -} as const; +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; /** - * These are the HTTP error code enums + * This is a model with ordered properties */ -export type statusCode = '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; /** - * These are the HTTP error code enums + * This is a model with duplicated imports */ -export const statusCode = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar' -} as const; +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; /** - * This is a model with one enum + * This is a model that extends another model */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; }; /** - * This is a model with one enum with escaped name + * This is a model that extends another model */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; +export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; }; -export type foo_bar_baz_qux = '3.0'; - -export const foo_bar_baz_qux = { - _3_0: '3.0' -} as const; - /** - * This is a model with one number property + * This is a model that contains a some patterns */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; }; -export type ModelWithNestedArrayEnums = { - array_strings?: Array<(string)>; - data?: (ModelWithNestedArrayEnumsData); +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; }; -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; +export type Default = { + name?: string; }; -export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBar = { - BAZ: 'baz', - QUX: 'qux' -} as const; - -export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFoo = { - FOO: 'foo', - BAR: 'bar' -} as const; - -export type ModelWithNestedCompositionEnums = { - foo?: (ModelWithNestedArrayEnumsDataFoo); +export type Pageable = { + page?: number; + size?: number; + sort?: Array; }; /** - * This is a model with nested enums + * This is a free-form object without additionalProperties. */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: { - [key: string]: ('Success' | 'Warning' | 'Error'); - }; - dictionaryWithEnumFromDescription?: { - [key: string]: (number); - }; - arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; - arrayWithDescription?: Array<(number)>; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; +export type FreeFormObjectWithoutAdditionalProperties = { + [key: string]: unknown; }; /** - * This is a model with one nested property + * This is a free-form object with additionalProperties: true. */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: (string) | null; - } | null; - } | null; +export type FreeFormObjectWithAdditionalPropertiesEqTrue = { + [key: string]: unknown; }; -export type ModelWithNullableObject = { - data?: NullableObject; +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = {}; + +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; }; /** - * This is a model with one string property + * This is a model with one property and additionalProperties: true */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp1?: (string) | null; - /** - * This is a simple string property - */ - nullableRequiredProp1: (string) | null; - /** - * This is a simple string property - */ - nullableProp2?: (string) | null; +export type ModelWithAdditionalPropertiesEqTrue = { /** * This is a simple string property */ - nullableRequiredProp2: (string) | null; - /** - * This is a simple enum with strings - */ - 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + prop?: string; + [key: string]: unknown | string | undefined; }; -export type ModelWithNumericEnumUnion = { - /** - * Период - */ - value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; + +export type CompositionWithOneOfAndProperties = ({ + foo: SimpleParameter; +} | { + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; +}) & { + baz: number; + qux: number; }; /** - * Период + * An object that can be null */ -export type value = -10 | -1 | 0 | 1 | 3 | 6 | 12; +export type NullableObject = { + foo?: string; +} | null; /** - * Период + * Some % character */ -export const value = { - '_-10': -10, - '_-1': -1, - '_0': 0, - '_1': 1, - '_3': 3, - '_6': 6, - '_12': 12 -} as const; +export type CharactersInDescription = string; -export type ModelWithOneOfAndProperties = (ParameterSimpleParameter | NonAsciiStringæøåÆØÅöôêÊ字符串) & { - baz: (number) | null; - qux: number; +export type ModelWithNullableObject = { + data?: NullableObject; }; export type ModelWithOneOfEnum = { @@ -895,64 +786,38 @@ export type ModelWithOneOfEnum = { foo: 'Quux'; } | { content: [ - (string), - (string) + unknown, + unknown ]; foo: 'Corge'; }; -export type foo = 'Bar'; +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export const ModelWithNestedArrayEnumsDataFoo = { + FOO: 'foo', + BAR: 'bar' +} as const; + +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; -export const foo = { - BAR: 'Bar' +export const ModelWithNestedArrayEnumsDataBar = { + BAZ: 'baz', + QUX: 'qux' } as const; -/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; }; -/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: string; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; }; -export type ModelWithPrefixItemsConstantSizeArray = [ - ModelWithInteger, - (number | string), - string -]; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - requiredAndNullable: (string) | null; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; }; export type ModelWithReadOnlyAndWriteOnly = { @@ -961,81 +826,116 @@ export type ModelWithReadOnlyAndWriteOnly = { baz: string; }; -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; +export type ModelWithConstantSizeArray = [ + number, + number +]; -/** - * This is a model with one string property - */ -export type ModelWithString = { +export type ModelWithAnyOfConstantSizeArray = [ + number | string, + number | string, + number | string +]; + +export type ModelWithPrefixItemsConstantSizeArray = [ + ModelWithInteger, + number | string, + string +]; + +export type ModelWithAnyOfConstantSizeArrayNullable = [ + number | string, + number | string, + number | string +]; + +export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ + number | Import, + number | Import +]; + +export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ + number & string, + number & string +]; + +export type ModelWithNumericEnumUnion = { /** - * This is a simple string property + * Период */ - prop?: string; + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; }; /** - * This is a model with one string property + * Some description with `back ticks` */ -export type ModelWithStringError = { +export type ModelWithBackticksInDescription = { /** - * This is a simple string property + * The template `that` should be used for parsing and importing the contents of the CSV file. + * + *

There is one placeholder currently supported:

  • ${x} - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)

Example of a correct JSON template:

+ *
+     * [
+     * {
+     * "resourceType": "Asset",
+     * "identifier": {
+     * "name": "${1}",
+     * "domain": {
+     * "name": "${2}",
+     * "community": {
+     * "name": "Some Community"
+     * }
+     * }
+     * },
+     * "attributes" : {
+     * "00000000-0000-0000-0000-000000003115" : [ {
+     * "value" : "${3}"
+     * } ],
+     * "00000000-0000-0000-0000-000000000222" : [ {
+     * "value" : "${4}"
+     * } ]
+     * }
+     * }
+     * ]
+     * 
*/ - prop?: string; + template?: string; }; -export type NestedAnyOfArraysNullable = { - nullableArray?: (Array<(string | boolean)> | null); +export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { + baz: number; + qux: number; }; /** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; - -/** - * An object that can be null + * Model used to test deduplication strategy (unused) */ -export type NullableObject = { - foo?: string; -} | null; - -export type OneOfAllOfIssue = ((ConstValue | Generic_Schema_Duplicate_Issue_1_System_Boolean_) & _3e_num_1Период) | Generic_Schema_Duplicate_Issue_1_System_String_; - -export type Pageable = { - page?: number; - size?: number; - sort?: Array<(string)>; -}; +export type ParameterSimpleParameterUnused = string; /** - * This is a reusable parameter + * Model used to test deduplication strategy */ -export type ParameterSimpleParameter = string; +export type PostServiceWithEmptyTagResponse = string; /** - * Model used to test deduplication strategy (unused) + * Model used to test deduplication strategy */ -export type ParameterSimpleParameterUnused = string; +export type PostServiceWithEmptyTagResponse2 = string; /** - * Parameter with illegal characters + * Model used to test deduplication strategy */ -export type Parameterx_Foo_Bar = ModelWithString; +export type DeleteFooData = string; /** * Model used to test deduplication strategy */ -export type PostServiceWithEmptyTagResponse = string; +export type DeleteFooData2 = string; /** - * Model used to test deduplication strategy + * Model with restricted keyword name */ -export type PostServiceWithEmptyTagResponse2 = string; +export type Import = string; export type SchemaWithFormRestrictedKeys = { description?: string; @@ -1050,71 +950,211 @@ export type SchemaWithFormRestrictedKeys = { 'x-enumNames'?: string; title?: string; }; - array?: Array<({ - description?: string; - 'x-enum-descriptions'?: string; - 'x-enum-varnames'?: string; - 'x-enumNames'?: string; - title?: string; -})>; + array?: Array; }; /** - * This is a simple boolean + * This schema was giving PascalCase transformations a hard time */ -export type SimpleBoolean = boolean; +export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { + /** + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. + */ + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; +}; /** - * This is a simple file + * This schema was giving PascalCase transformations a hard time */ -export type SimpleFile = (Blob | File); +export type IoK8sApimachineryPkgApisMetaV1Preconditions = { + /** + * Specifies the target ResourceVersion + */ + resourceVersion?: string; + /** + * Specifies the target UID. + */ + uid?: string; +}; + +export type AdditionalPropertiesUnknownIssue = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue2 = { + [key: string]: string | number; +}; + +export type AdditionalPropertiesUnknownIssue3 = string & { + entries: unknown; +}; + +export type AdditionalPropertiesIntegerIssue = { + value: number; + [key: string]: number; +}; + +export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; + +export type GenericSchemaDuplicateIssue1SystemBoolean = { + item?: boolean; + error?: string; + readonly hasError?: boolean; + data?: { + [key: string]: never; + }; +}; + +export type GenericSchemaDuplicateIssue1SystemString = { + item?: string; + error?: string; + readonly hasError?: boolean; +}; /** - * This is a simple number + * This is a reusable parameter */ -export type SimpleInteger = number; +export type SimpleParameter = string; /** - * This is a simple reference + * Parameter with illegal characters */ -export type SimpleReference = ModelWithString; +export type XFooBar = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleString = string; +export type SimpleRequestBody = ModelWithString; /** - * This is a simple string + * A reusable request body */ -export type SimpleStringWithPattern = (string) | null; +export type SimpleFormData = ModelWithString; + +export type ExportData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; export type ImportData = { - body: (ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly); + body: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; + path?: never; + query?: never; + url: '/api/v{api-version}/no-tag'; +}; + +export type ImportResponses = { + /** + * Success + */ + 200: ModelFromZendesk; + /** + * Default success response + */ + default: ModelWithReadOnlyAndWriteOnly; }; -export type ImportResponse = (Model_From_Zendesk | ModelWithReadOnlyAndWriteOnly); +export type ImportResponse = ImportResponses[keyof ImportResponses]; -export type ImportError = unknown; +export type ApiVVersionODataControllerCountData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple/$count'; +}; -export type ApiVVersionODataControllerCountResponse = (Model_From_Zendesk); +export type ApiVVersionODataControllerCountResponses = { + /** + * Success + */ + 200: ModelFromZendesk; +}; -export type ApiVVersionODataControllerCountError = unknown; +export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; export type GetApiVbyApiVersionSimpleOperationData = { + body?: never; path: { /** * foo in method */ foo_param: string; }; + query?: never; + url: '/api/v{api-version}/simple:operation'; +}; + +export type GetApiVbyApiVersionSimpleOperationErrors = { + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; + +export type GetApiVbyApiVersionSimpleOperationResponses = { + /** + * Response is a simple number + */ + 200: number; +}; + +export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; + +export type DeleteCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type GetCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type HeadCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type OptionsCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; + +export type PatchCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; }; -export type GetApiVbyApiVersionSimpleOperationResponse = (number); +export type PostCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; -export type GetApiVbyApiVersionSimpleOperationError = (ModelWithBoolean); +export type PutCallWithoutParametersAndResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/simple'; +}; export type DeleteFooData3 = { + body?: never; headers: { /** * Parameter with illegal characters @@ -1122,30 +1162,38 @@ export type DeleteFooData3 = { 'x-Foo-Bar': ModelWithString; }; path: { - /** - * bar in method - */ - BarParam: string; /** * foo in method */ foo_param: string; + /** + * bar in method + */ + BarParam: string; }; + query?: never; + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; }; export type CallWithDescriptionsData = { + body?: never; + path?: never; query?: { + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; /** * Testing backticks in string: `backticks` and ```multiple backticks``` should work */ parameterWithBackticks?: unknown; /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line + * Testing slashes in string: \backwards\\\ and /forwards/// should work */ - parameterWithBreaks?: unknown; + parameterWithSlashes?: unknown; /** * Testing expression placeholders in string: ${expression} should work */ @@ -1158,21 +1206,22 @@ export type CallWithDescriptionsData = { * Testing reserved characters in string: * inline * and ** inline ** should work */ parameterWithReservedCharacters?: unknown; - /** - * Testing slashes in string: \backwards\\\ and /forwards/// should work - */ - parameterWithSlashes?: unknown; }; + url: '/api/v{api-version}/descriptions/'; }; export type DeprecatedCallData = { + body?: never; headers: { /** * This parameter is deprecated * @deprecated */ - parameter: (DeprecatedModel) | null; + parameter: DeprecatedModel; }; + path?: never; + query?: never; + url: '/api/v{api-version}/parameters/deprecated'; }; export type CallWithParametersData = { @@ -1181,49 +1230,50 @@ export type CallWithParametersData = { */ body: { [key: string]: unknown; - } | null; + }; headers: { /** * This is the parameter that goes into the header */ - parameterHeader: (string) | null; + parameterHeader: string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + parameterPath: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - parameterPath: (string) | null; + 'api-version': string; }; query: { + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; /** * This is the parameter that goes into the query params */ - cursor: (string) | null; - foo_all_of_enum: (ModelWithNestedArrayEnumsDataFoo); - foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; + cursor: string; }; + url: '/api/v{api-version}/parameters/{parameterPath}'; }; export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the body */ - body: (ModelWithString) | null; + body: ModelWithString; headers: { /** * This is the parameter that goes into the request header */ - 'parameter.header': (string) | null; + 'parameter.header': string; }; path: { /** - * api-version should be required in standalone clients + * This is the parameter that goes into the path */ - 'api-version': (string) | null; + 'parameter.path.1'?: string; /** * This is the parameter that goes into the path */ @@ -1233,9 +1283,9 @@ export type CallWithWeirdParameterNamesData = { */ 'PARAMETER-PATH-3'?: string; /** - * This is the parameter that goes into the path + * api-version should be required in standalone clients */ - 'parameter.path.1'?: string; + 'api-version': string; }; query: { /** @@ -1245,8 +1295,9 @@ export type CallWithWeirdParameterNamesData = { /** * This is the parameter that goes into the request query params */ - 'parameter-query': (string) | null; + 'parameter-query': string; }; + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; }; export type GetCallWithOptionalParamData = { @@ -1254,12 +1305,14 @@ export type GetCallWithOptionalParamData = { * This is a required parameter */ body: ModelWithOneOfEnum; + path?: never; query?: { /** * This is an optional parameter */ page?: number; }; + url: '/api/v{api-version}/parameters/'; }; export type PostCallWithOptionalParamData = { @@ -1267,73 +1320,101 @@ export type PostCallWithOptionalParamData = { * This is an optional parameter */ body?: { - offset?: (number) | null; + offset?: number; }; + path?: never; query: { /** * This is a required parameter */ parameter: Pageable; }; + url: '/api/v{api-version}/parameters/'; }; -export type PostCallWithOptionalParamResponse = (number | void); +export type PostCallWithOptionalParamResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type PostCallWithOptionalParamError = unknown; +export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; export type PostApiVbyApiVersionRequestBodyData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleRequestBody; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/requestBody/'; }; export type PostApiVbyApiVersionFormDataData = { /** * A reusable request body */ - body?: ModelWithString; + body?: SimpleFormData; + path?: never; query?: { /** * This is a reusable parameter */ parameter?: string; }; + url: '/api/v{api-version}/formData/'; }; export type CallWithDefaultParametersData = { + body?: never; + path?: never; query?: { /** - * This is a simple boolean with default value + * This is a simple string with default value */ - parameterBoolean?: (boolean) | null; + parameterString?: string; /** - * This is a simple enum with default value + * This is a simple number with default value */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; + parameterNumber?: number; /** - * This is a simple model with default value + * This is a simple boolean with default value */ - parameterModel?: (ModelWithString) | null; + parameterBoolean?: boolean; /** - * This is a simple number with default value + * This is a simple enum with default value */ - parameterNumber?: (number) | null; + parameterEnum?: 'Success' | 'Warning' | 'Error'; /** - * This is a simple string with default value + * This is a simple model with default value */ - parameterString?: (string) | null; + parameterModel?: ModelWithString; }; + url: '/api/v{api-version}/defaults'; }; export type CallWithDefaultOptionalParametersData = { + body?: never; + path?: never; query?: { + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; /** * This is a simple boolean that is optional with default value */ @@ -1346,18 +1427,13 @@ export type CallWithDefaultOptionalParametersData = { * This is a simple model that is optional with default value */ parameterModel?: ModelWithString; - /** - * This is a simple number that is optional with default value - */ - parameterNumber?: number; - /** - * This is a simple string that is optional with default value - */ - parameterString?: string; }; + url: '/api/v{api-version}/defaults'; }; export type CallToTestOrderOfParamsData = { + body?: never; + path?: never; query: { /** * This is a optional string with default @@ -1371,14 +1447,6 @@ export type CallToTestOrderOfParamsData = { * This is a optional string with no default */ parameterOptionalStringWithNoDefault?: string; - /** - * This is a string that can be null with default - */ - parameterStringNullableWithDefault?: (string) | null; - /** - * This is a string that can be null with no default - */ - parameterStringNullableWithNoDefault?: (string) | null; /** * This is a string with default */ @@ -1391,67 +1459,252 @@ export type CallToTestOrderOfParamsData = { * This is a string with no default */ parameterStringWithNoDefault: string; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string; }; + url: '/api/v{api-version}/defaults'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; + +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; }; -export type CallWithNoContentResponseResponse = (void); +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithNoContentResponseError = unknown; +export type DuplicateNameData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/duplicate'; +}; -export type CallWithResponseAndNoContentResponseResponse = (number | void); +export type CallWithNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/no-content'; +}; -export type CallWithResponseAndNoContentResponseError = unknown; +export type CallWithNoContentResponseResponses = { + /** + * Success + */ + 204: void; +}; -export type DummyAResponse = (_400); +export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; -export type DummyAError = unknown; +export type CallWithResponseAndNoContentResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; +}; -export type DummyBResponse = (void); +export type CallWithResponseAndNoContentResponseResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Success + */ + 204: void; +}; -export type DummyBError = unknown; +export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; -export type CallWithResponseResponse = (_import); +export type DummyAData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/a'; +}; -export type CallWithResponseError = unknown; +export type DummyAResponses = { + 200: _400; +}; -export type CallWithDuplicateResponsesResponse = ((ModelWithBoolean & ModelWithInteger) | ModelWithString); +export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; -export type CallWithDuplicateResponsesError = (ModelWithStringError | DictionaryWithArray | ModelWithBoolean); +export type DummyBData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multiple-tags/b'; +}; -export type CallWithResponsesResponse = ({ - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; - readonly value?: Array; -} | ModelThatExtends | ModelThatExtendsExtends); +export type DummyBResponses = { + /** + * Success + */ + 204: void; +}; + +export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; + +export type CallWithResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponseResponses = { + default: Import; +}; + +export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; + +export type CallWithDuplicateResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithDuplicateResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for 4XX errors + */ + '4XX': DictionaryWithArray; + /** + * Default error response + */ + default: ModelWithBoolean; +}; + +export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; + +export type CallWithDuplicateResponsesResponses = { + /** + * Message for 200 response + */ + 200: ModelWithBoolean & ModelWithInteger; + /** + * Message for 201 response + */ + 201: ModelWithString; + /** + * Message for 202 response + */ + 202: ModelWithString; +}; -export type CallWithResponsesError = (ModelWithStringError); +export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; + +export type CallWithResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/response'; +}; + +export type CallWithResponsesErrors = { + /** + * Message for 500 error + */ + 500: ModelWithStringError; + /** + * Message for 501 error + */ + 501: ModelWithStringError; + /** + * Message for 502 error + */ + 502: ModelWithStringError; + /** + * Message for default response + */ + default: ModelWithStringError; +}; + +export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; + +export type CallWithResponsesResponses = { + /** + * Message for 200 response + */ + 200: { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + }; + /** + * Message for 201 response + */ + 201: ModelThatExtends; + /** + * Message for 202 response + */ + 202: ModelThatExtendsExtends; +}; + +export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; export type CollectionFormatData = { + body?: never; + path?: never; query: { /** * This is an array parameter that is sent as csv format (comma-separated values) */ - parameterArrayCSV: Array<(string)> | null; + parameterArrayCSV: Array; /** - * This is an array parameter that is sent as multi format (multiple parameter instances) + * This is an array parameter that is sent as ssv format (space-separated values) */ - parameterArrayMulti: Array<(string)> | null; + parameterArraySSV: Array; /** - * This is an array parameter that is sent as pipes format (pipe-separated values) + * This is an array parameter that is sent as tsv format (tab-separated values) */ - parameterArrayPipes: Array<(string)> | null; + parameterArrayTSV: Array; /** - * This is an array parameter that is sent as ssv format (space-separated values) + * This is an array parameter that is sent as pipes format (pipe-separated values) */ - parameterArraySSV: Array<(string)> | null; + parameterArrayPipes: Array; /** - * This is an array parameter that is sent as tsv format (tab-separated values) + * This is an array parameter that is sent as multi format (multiple parameter instances) */ - parameterArrayTSV: Array<(string)> | null; + parameterArrayMulti: Array; }; + url: '/api/v{api-version}/collectionFormat'; }; export type TypesData = { + body?: never; path?: { /** * This is a number parameter @@ -1460,75 +1713,105 @@ export type TypesData = { }; query: { /** - * This is an array parameter + * This is a number parameter */ - parameterArray: Array<(string)> | null; + parameterNumber: number; /** - * This is a boolean parameter + * This is a string parameter */ - parameterBoolean: (boolean) | null; + parameterString: string; /** - * This is a dictionary parameter + * This is a boolean parameter */ - parameterDictionary: { - [key: string]: unknown; - } | null; + parameterBoolean: boolean; /** - * This is an enum parameter + * This is an object parameter */ - parameterEnum: ('Success' | 'Warning' | 'Error') | null; + parameterObject: { + [key: string]: unknown; + }; /** - * This is a number parameter + * This is an array parameter */ - parameterNumber: number; + parameterArray: Array; /** - * This is an object parameter + * This is a dictionary parameter */ - parameterObject: { + parameterDictionary: { [key: string]: unknown; - } | null; + }; /** - * This is a string parameter + * This is an enum parameter */ - parameterString: (string) | null; + parameterEnum: 'Success' | 'Warning' | 'Error'; }; + url: '/api/v{api-version}/types'; }; -export type TypesResponse = (number | string | boolean | { - [key: string]: unknown; -}); +export type TypesResponses = { + /** + * Response is a simple number + */ + 200: number; + /** + * Response is a simple string + */ + 201: string; + /** + * Response is a simple boolean + */ + 202: boolean; + /** + * Response is a simple object + */ + 203: { + [key: string]: unknown; + }; +}; -export type TypesError = unknown; +export type TypesResponse = TypesResponses[keyof TypesResponses]; export type UploadFileData = { - body: (Blob | File); + body: unknown; path: { /** * api-version should be required in standalone clients */ - 'api-version': (string) | null; + 'api-version': string; }; + query?: never; + url: '/api/v{api-version}/upload'; }; -export type UploadFileResponse = (boolean); +export type UploadFileResponses = { + 200: boolean; +}; -export type UploadFileError = unknown; +export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; export type FileResponseData = { + body?: never; path: { + id: string; /** * api-version should be required in standalone clients */ 'api-version': string; - id: string; }; + query?: never; + url: '/api/v{api-version}/file/{id}'; }; -export type FileResponseResponse = ((Blob | File)); - -export type FileResponseError = unknown; +export type FileResponseResponses = { + /** + * Success + */ + 200: unknown; +}; export type ComplexTypesData = { + body?: never; + path?: never; query: { /** * Parameter containing object @@ -1545,86 +1828,182 @@ export type ComplexTypesData = { */ parameterReference: ModelWithString; }; + url: '/api/v{api-version}/complex'; +}; + +export type ComplexTypesErrors = { + /** + * 400 `server` error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; }; -export type ComplexTypesResponse = (Array); +export type ComplexTypesResponses = { + /** + * Successful response + */ + 200: Array; +}; -export type ComplexTypesError = (unknown); +export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; -export type MultipartRequestData = { - body?: { - content?: (Blob | File); - data?: ((ModelWithString) | null); - }; +export type MultipartResponseData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; }; -export type MultipartResponseResponse = ({ - file?: (Blob | File); - metadata?: { - foo?: string; - bar?: string; +export type MultipartResponseResponses = { + /** + * OK + */ + 200: { + file?: Blob | File; + metadata?: { + foo?: string; + bar?: string; + }; }; -}); +}; + +export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; -export type MultipartResponseError = unknown; +export type MultipartRequestData = { + body?: { + content?: Blob | File; + data?: ModelWithString; + }; + path?: never; + query?: never; + url: '/api/v{api-version}/multipart'; +}; export type ComplexParamsData = { body?: { - readonly key: (string) | null; - name: (string) | null; + readonly key: string; + name: string; enabled?: boolean; - readonly type: 'Monkey' | 'Horse' | 'Bird'; - listOfModels?: Array | null; - listOfStrings?: Array<(string)> | null; - parameters: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); + type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array; + listOfStrings?: Array; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; readonly user?: { readonly id?: number; - readonly name?: (string) | null; + readonly name?: string; }; }; path: { + id: number; /** * api-version should be required in standalone clients */ 'api-version': string; - id: number; }; + query?: never; + url: '/api/v{api-version}/complex/{id}'; +}; + +export type ComplexParamsResponses = { + /** + * Success + */ + 200: ModelWithString; }; -export type ComplexParamsResponse = (ModelWithString); +export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; -export type ComplexParamsError = unknown; +export type CallWithResultFromHeaderData = { + body?: never; + path?: never; + query?: never; + url: '/api/v{api-version}/header'; +}; -export type CallWithResultFromHeaderResponse = (string); +export type CallWithResultFromHeaderErrors = { + /** + * 400 server error + */ + 400: unknown; + /** + * 500 server error + */ + 500: unknown; +}; -export type CallWithResultFromHeaderError = (unknown); +export type CallWithResultFromHeaderResponses = { + /** + * Successful response + */ + 200: unknown; +}; export type TestErrorCodeData = { + body?: never; + path?: never; query: { /** * Status code to return */ status: number; }; + url: '/api/v{api-version}/error'; }; -export type TestErrorCodeResponse = (unknown); +export type TestErrorCodeErrors = { + /** + * Custom message: Internal Server Error + */ + 500: unknown; + /** + * Custom message: Not Implemented + */ + 501: unknown; + /** + * Custom message: Bad Gateway + */ + 502: unknown; + /** + * Custom message: Service Unavailable + */ + 503: unknown; +}; -export type TestErrorCodeError = (unknown); +export type TestErrorCodeResponses = { + /** + * Custom message: Successful response + */ + 200: unknown; +}; export type NonAsciiæøåÆøÅöôêÊ字符串Data = { + body?: never; + path?: never; query: { /** * Dummy input param */ nonAsciiParamæøåÆØÅöôêÊ: number; }; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; -export type NonAsciiæøåÆøÅöôêÊ字符串Response = (Array); +export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { + /** + * Successful response + */ + 200: Array; +}; -export type NonAsciiæøåÆøÅöôêÊ字符串Error = unknown; +export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; export type PutWithFormUrlEncodedData = { body: ArrayWithStrings; + path?: never; + query?: never; + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/index.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/index.ts.snap index 81abc8221..e64537d21 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/index.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/index.ts.snap @@ -1,3 +1,3 @@ // This file is auto-generated by @hey-api/openapi-ts -export * from './sdk.gen'; -export * from './types.gen'; \ No newline at end of file +export * from './types.gen'; +export * from './sdk.gen'; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/sdk.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/sdk.gen.ts.snap index 7821795e0..ec8342eb2 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/sdk.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/sdk.gen.ts.snap @@ -1,51 +1,53 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createClient, createConfig, type OptionsLegacyParser } from '@hey-api/client-fetch'; -import { type ParentModelWithDatesError, type ParentModelWithDatesResponse, type ModelWithDatesError, type ModelWithDatesResponse, type ModelWithDatesArrayError, type ModelWithDatesArrayResponse, type ArrayOfDatesError, type ArrayOfDatesResponse, type DateError, type DateResponse, type MultipleResponsesError, type MultipleResponsesResponse, ParentModelWithDatesResponseTransformer, ModelWithDatesResponseTransformer, ModelWithDatesArrayResponseTransformer } from './types.gen'; +import { createClient, createConfig, type Options } from '@hey-api/client-fetch'; +import type { ParentModelWithDatesData, ParentModelWithDatesResponse, ModelWithDatesData, ModelWithDatesResponse, ModelWithDatesArrayData, ModelWithDatesArrayResponse, ArrayOfDatesData, ArrayOfDatesResponse, DateData, DateResponse, MultipleResponsesData, MultipleResponsesResponse } from './types.gen'; +import { modelWithDatesResponseTransformer, modelWithDatesArrayResponseTransformer, arrayOfDatesResponseTransformer, dateResponseTransformer } from './transformers.gen'; export const client = createClient(createConfig()); -export const parentModelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).post({ - ...options, +export const parentModelWithDates = (options?: Options) => { + return (options?.client ?? client).post({ url: '/api/model-with-dates', - responseTransformer: ParentModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesResponseTransformer, url: '/api/model-with-dates', - responseTransformer: ModelWithDatesResponseTransformer + ...options }); }; -export const modelWithDatesArray = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, +export const modelWithDatesArray = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: modelWithDatesArrayResponseTransformer, url: '/api/model-with-dates-array', - responseTransformer: ModelWithDatesArrayResponseTransformer + ...options }); }; -export const arrayOfDates = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/array-of-dates' +export const arrayOfDates = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: arrayOfDatesResponseTransformer, + url: '/api/array-of-dates', + ...options }); }; -export const date = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/date' +export const date = (options?: Options) => { + return (options?.client ?? client).put({ + responseTransformer: dateResponseTransformer, + url: '/api/date', + ...options }); }; -export const multipleResponses = (options?: OptionsLegacyParser) => { - return (options?.client ?? client).put({ - ...options, - url: '/api/multiple-responses' +export const multipleResponses = (options?: Options) => { + return (options?.client ?? client).put({ + url: '/api/multiple-responses', + ...options }); }; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/transformers.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/transformers.gen.ts.snap new file mode 100644 index 000000000..699754aca --- /dev/null +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/transformers.gen.ts.snap @@ -0,0 +1,35 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { ModelWithDatesResponse, ModelWithDatesArrayResponse, ArrayOfDatesResponse, DateResponse } from './types.gen'; + +const modelWithDatesSchemaResponseTransformer = (data: any) => { + data.modified = new Date(data.modified); + if (data.expires) { + data.expires = new Date(data.expires); + } + return data; +}; + +export const modelWithDatesResponseTransformer = async (data: any): Promise => { + data = modelWithDatesSchemaResponseTransformer(data); + return data; +}; + +export const modelWithDatesArrayResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return modelWithDatesSchemaResponseTransformer(item); + }); + return data; +}; + +export const arrayOfDatesResponseTransformer = async (data: any): Promise => { + data = data.map((item: any) => { + return new Date(item); + }); + return data; +}; + +export const dateResponseTransformer = async (data: any): Promise => { + data = new Date(data); + return data; +}; \ No newline at end of file diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap index 0326edf4c..0c44fd1ac 100644 --- a/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap +++ b/packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch_transform/types.gen.ts.snap @@ -1,5 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts +/** + * This is a model that contains a some dates + */ +export type SimpleModel = { + id: number; + name: string; + readonly enabled: boolean; +}; + /** * This is a model that contains a some dates */ @@ -19,100 +28,113 @@ export type ParentModelWithDates = { readonly modified?: Date; items?: Array; item?: ModelWithDates; - 'nullable-date'?: Array<(Date | null)>; + 'nullable-date'?: Array; simpleItems?: Array; simpleItem?: SimpleModel; - dates?: Array<(Date)>; - strings?: Array<(string)>; + dates?: Array; + strings?: Array; }; -/** - * This is a model that contains a some dates - */ -export type SimpleModel = { - id: number; - name: string; - readonly enabled: boolean; +export type ParentModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; }; -export type ParentModelWithDatesResponse = (ParentModelWithDates | unknown); - -export type ParentModelWithDatesError = unknown; - -export type ModelWithDatesResponse = (ModelWithDates); - -export type ModelWithDatesError = unknown; - -export type ModelWithDatesArrayResponse = (Array); - -export type ModelWithDatesArrayError = unknown; - -export type ArrayOfDatesResponse = (Array<(Date)>); +export type ParentModelWithDatesResponses = { + /** + * Success + */ + 200: ParentModelWithDates; + /** + * Success + */ + 201: unknown; +}; -export type ArrayOfDatesError = unknown; +export type ParentModelWithDatesResponse = ParentModelWithDatesResponses[keyof ParentModelWithDatesResponses]; -export type DateResponse = (Date); +export type ModelWithDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates'; +}; -export type DateError = unknown; +export type ModelWithDatesResponses = { + /** + * Success + */ + 200: ModelWithDates; +}; -export type MultipleResponsesResponse = (Array | Array); +export type ModelWithDatesResponse = ModelWithDatesResponses[keyof ModelWithDatesResponses]; -export type MultipleResponsesError = unknown; +export type ModelWithDatesArrayData = { + body?: never; + path?: never; + query?: never; + url: '/api/model-with-dates-array'; +}; -export type ParentModelWithDatesResponseTransformer = (data: any) => Promise; +export type ModelWithDatesArrayResponses = { + /** + * Success + */ + 200: Array; +}; -export type ParentModelWithDatesModelResponseTransformer = (data: any) => ParentModelWithDates; +export type ModelWithDatesArrayResponse = ModelWithDatesArrayResponses[keyof ModelWithDatesArrayResponses]; -export type ModelWithDatesModelResponseTransformer = (data: any) => ModelWithDates; +export type ArrayOfDatesData = { + body?: never; + path?: never; + query?: never; + url: '/api/array-of-dates'; +}; -export const ModelWithDatesModelResponseTransformer: ModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (data?.expires) { - data.expires = new Date(data.expires); - } - return data; +export type ArrayOfDatesResponses = { + /** + * Success + */ + 200: Array; }; -export const ParentModelWithDatesModelResponseTransformer: ParentModelWithDatesModelResponseTransformer = data => { - if (data?.modified) { - data.modified = new Date(data.modified); - } - if (Array.isArray(data?.items)) { - data.items.forEach(ModelWithDatesModelResponseTransformer); - } - if (data?.item) { - ModelWithDatesModelResponseTransformer(data.item); - } - if (Array.isArray(data?.['nullable-date'])) { - data['nullable-date'] = data['nullable-date'].map(item => item ? new Date(item) : item); - } - if (Array.isArray(data?.dates)) { - data.dates = data.dates.map(item => item ? new Date(item) : item); - } - return data; +export type ArrayOfDatesResponse = ArrayOfDatesResponses[keyof ArrayOfDatesResponses]; + +export type DateData = { + body?: never; + path?: never; + query?: never; + url: '/api/date'; }; -export const ParentModelWithDatesResponseTransformer: ParentModelWithDatesResponseTransformer = async (data) => { - if (data) { - ParentModelWithDatesModelResponseTransformer(data); - } - return data; +export type DateResponses = { + /** + * Success + */ + 200: Date; }; -export type ModelWithDatesResponseTransformer = (data: any) => Promise; +export type DateResponse = DateResponses[keyof DateResponses]; -export const ModelWithDatesResponseTransformer: ModelWithDatesResponseTransformer = async (data) => { - ModelWithDatesModelResponseTransformer(data); - return data; +export type MultipleResponsesData = { + body?: never; + path?: never; + query?: never; + url: '/api/multiple-responses'; }; -export type ModelWithDatesArrayResponseTransformer = (data: any) => Promise; +export type MultipleResponsesResponses = { + /** + * Updated + */ + 200: Array; + /** + * Created + */ + 201: Array; +}; -export const ModelWithDatesArrayResponseTransformer: ModelWithDatesArrayResponseTransformer = async (data) => { - if (Array.isArray(data)) { - data.forEach(ModelWithDatesModelResponseTransformer); - } - return data; -}; \ No newline at end of file +export type MultipleResponsesResponse = MultipleResponsesResponses[keyof MultipleResponsesResponses]; \ No newline at end of file diff --git a/packages/openapi-ts/test/openapi-ts.config.ts b/packages/openapi-ts/test/openapi-ts.config.ts index 2827b7e0a..40d1f17d9 100644 --- a/packages/openapi-ts/test/openapi-ts.config.ts +++ b/packages/openapi-ts/test/openapi-ts.config.ts @@ -7,7 +7,7 @@ export default defineConfig({ name: '@hey-api/client-fetch', // name: 'legacy/xhr', }, - experimentalParser: true, + // experimentalParser: false, input: { // exclude: '^#/components/schemas/ModelWithCircularReference$', // include: