fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: add NestJS plugin for type-safe controller method signatures

Generates a `ControllerMethods` type from OpenAPI specs that NestJS developers
can use with `implements Pick<ControllerMethods, ...>` for compile-time contract
enforcement. Mirrors the Fastify plugin pattern with function-type method signatures.

- Plugin files: types.ts, config.ts, index.ts, plugin.ts
- Snapshot tests for 2.0.x, 3.0.x, 3.1.x specs
- Example project with NestJS controller usage
- Documentation and sidebar update

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+8244 -117
+1 -1
docs/.vitepress/config/en.ts
··· 249 249 }, 250 250 { 251 251 link: '/openapi-ts/plugins/nest', 252 - text: 'Nest <span data-soon>soon</span>', 252 + text: 'Nest', 253 253 }, 254 254 ], 255 255 link: '/openapi-ts/web-frameworks',
+75 -92
docs/implementation-plan-nestjs-plugin.md
··· 67 67 ListPetsResponse, 68 68 ShowPetByIdData, 69 69 ShowPetByIdResponse, 70 - } from "./types.gen"; 70 + } from './types.gen'; 71 71 72 72 export interface ControllerMethods { 73 - createPets(body: CreatePetsData["body"]): Promise<CreatePetsResponse>; 74 - listPets(query?: ListPetsData["query"]): Promise<ListPetsResponse>; 75 - showPetById(path: ShowPetByIdData["path"]): Promise<ShowPetByIdResponse>; 73 + createPets(body: CreatePetsData['body']): Promise<CreatePetsResponse>; 74 + listPets(query?: ListPetsData['query']): Promise<ListPetsResponse>; 75 + showPetById(path: ShowPetByIdData['path']): Promise<ShowPetByIdResponse>; 76 76 } 77 77 ``` 78 78 ··· 113 113 ### Basic Usage 114 114 115 115 ```typescript 116 - import { Controller, Get, Post, Param, Query, Body } from "@nestjs/common"; 117 - import type { ControllerMethods } from "../client/nestjs.gen"; 118 - import type { 119 - ListPetsData, 120 - ShowPetByIdData, 121 - CreatePetsData, 122 - } from "../client/types.gen"; 116 + import { Controller, Get, Post, Param, Query, Body } from '@nestjs/common'; 117 + import type { ControllerMethods } from '../client/nestjs.gen'; 118 + import type { ListPetsData, ShowPetByIdData, CreatePetsData } from '../client/types.gen'; 123 119 124 - @Controller("pets") 125 - export class PetsController 126 - implements Pick<ControllerMethods, "listPets" | "createPets" | "showPetById"> 127 - { 120 + @Controller('pets') 121 + export class PetsController implements Pick< 122 + ControllerMethods, 123 + 'listPets' | 'createPets' | 'showPetById' 124 + > { 128 125 @Get() 129 - async listPets(@Query() query?: ListPetsData["query"]) { 126 + async listPets(@Query() query?: ListPetsData['query']) { 130 127 return []; 131 128 } 132 129 133 130 @Post() 134 - async createPets(@Body() body: CreatePetsData["body"]) { 131 + async createPets(@Body() body: CreatePetsData['body']) { 135 132 return { id: 1, name: body.name }; 136 133 } 137 134 138 - @Get(":petId") 139 - async showPetById(@Param() path: ShowPetByIdData["path"]) { 140 - return { id: path.petId, name: "Kitty" }; 135 + @Get(':petId') 136 + async showPetById(@Param() path: ShowPetByIdData['path']) { 137 + return { id: path.petId, name: 'Kitty' }; 141 138 } 142 139 } 143 140 ``` ··· 197 194 ### `types.ts` 198 195 199 196 ```typescript 200 - import type { DefinePlugin, Plugin } from "@hey-api/shared"; 197 + import type { DefinePlugin, Plugin } from '@hey-api/shared'; 201 198 202 - export type UserConfig = Plugin.Name<"nestjs"> & 203 - Plugin.Hooks & 204 - Plugin.UserExports; 199 + export type UserConfig = Plugin.Name<'nestjs'> & Plugin.Hooks & Plugin.UserExports; 205 200 206 201 export type NestJSPlugin = DefinePlugin<UserConfig, UserConfig>; 207 202 ``` ··· 209 204 ### `config.ts` 210 205 211 206 ```typescript 212 - import { definePluginConfig } from "@hey-api/shared"; 207 + import { definePluginConfig } from '@hey-api/shared'; 213 208 214 - import { handler } from "./plugin"; 215 - import type { NestJSPlugin } from "./types"; 209 + import { handler } from './plugin'; 210 + import type { NestJSPlugin } from './types'; 216 211 217 - export const defaultConfig: NestJSPlugin["Config"] = { 212 + export const defaultConfig: NestJSPlugin['Config'] = { 218 213 config: { 219 214 includeInEntry: false, 220 215 }, 221 - dependencies: ["@hey-api/typescript"], 216 + dependencies: ['@hey-api/typescript'], 222 217 handler, 223 - name: "nestjs", 218 + name: 'nestjs', 224 219 }; 225 220 226 221 export const defineConfig = definePluginConfig(defaultConfig); ··· 229 224 ### `index.ts` 230 225 231 226 ```typescript 232 - export { defaultConfig, defineConfig } from "./config"; 233 - export type { NestJSPlugin } from "./types"; 227 + export { defaultConfig, defineConfig } from './config'; 228 + export type { NestJSPlugin } from './types'; 234 229 ``` 235 230 236 231 ### `plugin.ts` (Core Logic) 237 232 238 233 ```typescript 239 - import type { IR } from "@hey-api/shared"; 240 - import { 241 - hasParameterGroupObjectRequired, 242 - operationResponsesMap, 243 - } from "@hey-api/shared"; 234 + import type { IR } from '@hey-api/shared'; 235 + import { hasParameterGroupObjectRequired, operationResponsesMap } from '@hey-api/shared'; 244 236 245 - import { $ } from "../../ts-dsl"; 246 - import type { NestJSPlugin } from "./types"; 237 + import { $ } from '../../ts-dsl'; 238 + import type { NestJSPlugin } from './types'; 247 239 248 240 const operationToMethod = ({ 249 241 operation, 250 242 plugin, 251 243 }: { 252 244 operation: IR.OperationObject; 253 - plugin: NestJSPlugin["Instance"]; 245 + plugin: NestJSPlugin['Instance']; 254 246 }) => { 255 247 const funcType = $.type.func(); 256 248 257 249 const symbolDataType = plugin.querySymbol({ 258 - category: "type", 259 - resource: "operation", 250 + category: 'type', 251 + resource: 'operation', 260 252 resourceId: operation.id, 261 - role: "data", 262 - tool: "typescript", 253 + role: 'data', 254 + tool: 'typescript', 263 255 }); 264 256 265 257 if (symbolDataType) { ··· 267 259 if (operation.parameters?.path) { 268 260 funcType.param((p) => 269 261 p 270 - .name("path") 262 + .name('path') 271 263 .required(hasParameterGroupObjectRequired(operation.parameters!.path)) 272 - .type($.type(symbolDataType).idx($.type.literal("path"))), 264 + .type($.type(symbolDataType).idx($.type.literal('path'))), 273 265 ); 274 266 } 275 267 ··· 277 269 if (operation.parameters?.query) { 278 270 funcType.param((p) => 279 271 p 280 - .name("query") 281 - .required( 282 - hasParameterGroupObjectRequired(operation.parameters!.query), 283 - ) 284 - .type($.type(symbolDataType).idx($.type.literal("query"))), 272 + .name('query') 273 + .required(hasParameterGroupObjectRequired(operation.parameters!.query)) 274 + .type($.type(symbolDataType).idx($.type.literal('query'))), 285 275 ); 286 276 } 287 277 ··· 289 279 if (operation.body) { 290 280 funcType.param((p) => 291 281 p 292 - .name("body") 282 + .name('body') 293 283 .required(operation.body!.required) 294 - .type($.type(symbolDataType).idx($.type.literal("body"))), 284 + .type($.type(symbolDataType).idx($.type.literal('body'))), 295 285 ); 296 286 } 297 287 ··· 299 289 if (operation.parameters?.header) { 300 290 funcType.param((p) => 301 291 p 302 - .name("headers") 303 - .required( 304 - hasParameterGroupObjectRequired(operation.parameters!.header), 305 - ) 306 - .type($.type(symbolDataType).idx($.type.literal("headers"))), 292 + .name('headers') 293 + .required(hasParameterGroupObjectRequired(operation.parameters!.header)) 294 + .type($.type(symbolDataType).idx($.type.literal('headers'))), 307 295 ); 308 296 } 309 297 } 310 298 311 299 // Build response type - use the response type alias (union of success bodies) 312 300 const symbolResponseType = plugin.querySymbol({ 313 - category: "type", 314 - resource: "operation", 301 + category: 'type', 302 + resource: 'operation', 315 303 resourceId: operation.id, 316 - role: "response", 317 - tool: "typescript", 304 + role: 'response', 305 + tool: 'typescript', 318 306 }); 319 307 320 308 if (symbolResponseType) { 321 - funcType.returns( 322 - $.type("Promise", (t) => t.generic($.type(symbolResponseType))), 323 - ); 309 + funcType.returns($.type('Promise', (t) => t.generic($.type(symbolResponseType)))); 324 310 } else { 325 - funcType.returns($.type("Promise", (t) => t.generic($.type("void")))); 311 + funcType.returns($.type('Promise', (t) => t.generic($.type('void')))); 326 312 } 327 313 328 314 return { ··· 331 317 }; 332 318 }; 333 319 334 - export const handler: NestJSPlugin["Handler"] = ({ plugin }) => { 335 - const symbolControllerMethods = plugin.symbol("ControllerMethods"); 320 + export const handler: NestJSPlugin['Handler'] = ({ plugin }) => { 321 + const symbolControllerMethods = plugin.symbol('ControllerMethods'); 336 322 337 323 const type = $.type.object(); 338 324 339 325 plugin.forEach( 340 - "operation", 326 + 'operation', 341 327 ({ operation }) => { 342 328 const method = operationToMethod({ operation, plugin }); 343 329 if (method) { ··· 345 331 } 346 332 }, 347 333 { 348 - order: "declarations", 334 + order: 'declarations', 349 335 }, 350 336 ); 351 337 ··· 362 348 **`packages/openapi-ts/src/plugins/config.ts`:** 363 349 364 350 ```typescript 365 - import { defaultConfig as nestjs } from "./nestjs/config"; 351 + import { defaultConfig as nestjs } from './nestjs/config'; 366 352 // ... add to defaultPluginConfigs map: 367 353 // nestjs, 368 354 ``` ··· 370 356 **`packages/openapi-ts/src/index.ts`:** 371 357 372 358 ```typescript 373 - import type { NestJSPlugin } from "./plugins/nestjs/types"; 359 + import type { NestJSPlugin } from './plugins/nestjs/types'; 374 360 // ... add to PluginConfigMap interface: 375 361 // nestjs: NestJSPlugin['Types']; 376 362 ``` ··· 411 397 ### `openapi-ts.config.ts` 412 398 413 399 ```typescript 414 - import { defineConfig } from "@hey-api/openapi-ts"; 400 + import { defineConfig } from '@hey-api/openapi-ts'; 415 401 416 402 export default defineConfig({ 417 - input: "./openapi.json", 403 + input: './openapi.json', 418 404 output: { 419 - path: "./src/client", 405 + path: './src/client', 420 406 }, 421 - plugins: ["nestjs"], 407 + plugins: ['nestjs'], 422 408 }); 423 409 ``` 424 410 425 411 ### `src/pets/pets.controller.ts` 426 412 427 413 ```typescript 428 - import { Controller, Get, Post, Param, Query, Body } from "@nestjs/common"; 429 - import type { ControllerMethods } from "../client/nestjs.gen"; 430 - import type { 431 - CreatePetsData, 432 - ListPetsData, 433 - ShowPetByIdData, 434 - } from "../client/types.gen"; 414 + import { Controller, Get, Post, Param, Query, Body } from '@nestjs/common'; 415 + import type { ControllerMethods } from '../client/nestjs.gen'; 416 + import type { CreatePetsData, ListPetsData, ShowPetByIdData } from '../client/types.gen'; 435 417 436 - @Controller("pets") 437 - export class PetsController 438 - implements Pick<ControllerMethods, "listPets" | "createPets" | "showPetById"> 439 - { 418 + @Controller('pets') 419 + export class PetsController implements Pick< 420 + ControllerMethods, 421 + 'listPets' | 'createPets' | 'showPetById' 422 + > { 440 423 @Get() 441 - async listPets(@Query() query?: ListPetsData["query"]) { 424 + async listPets(@Query() query?: ListPetsData['query']) { 442 425 return []; 443 426 } 444 427 445 428 @Post() 446 - async createPets(@Body() body: CreatePetsData["body"]) { 429 + async createPets(@Body() body: CreatePetsData['body']) { 447 430 return; 448 431 } 449 432 450 - @Get(":petId") 451 - async showPetById(@Param() path: ShowPetByIdData["path"]) { 433 + @Get(':petId') 434 + async showPetById(@Param() path: ShowPetByIdData['path']) { 452 435 return { 453 436 id: Number(path.petId), 454 - name: "Kitty", 437 + name: 'Kitty', 455 438 }; 456 439 } 457 440 }
+130 -6
docs/openapi-ts/plugins/nest.md
··· 1 1 --- 2 - title: Nest 3 - description: Nest plugin for Hey API. Compatible with all our features. 2 + title: NestJS Plugin 3 + description: Generate NestJS controller interfaces from OpenAPI with type safety. Fully compatible with all core features. 4 4 --- 5 5 6 6 <script setup lang="ts"> 7 - import FeatureStatus from '@components/FeatureStatus.vue'; 7 + import Heading from '@components/Heading.vue'; 8 + import VersionLabel from '@components/VersionLabel.vue'; 8 9 </script> 9 10 10 - # Nest <span data-soon>soon</span> 11 + <Heading> 12 + <h1>NestJS</h1> 13 + <VersionLabel value="v10" /> 14 + </Heading> 11 15 12 - <FeatureStatus issueNumber=1481 name="Nest" /> 16 + ::: warning 17 + NestJS plugin is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on [GitHub](https://github.com/hey-api/openapi-ts/issues). 18 + ::: 13 19 14 20 ### About 15 21 16 - [Nest](https://nestjs.com) is a progressive Node.js framework for building efficient, reliable and scalable server-side applications. 22 + [NestJS](https://nestjs.com) is a progressive Node.js framework for building efficient, reliable and scalable server-side applications. 17 23 24 + The NestJS plugin for Hey API generates type-safe controller method signatures from your OpenAPI spec, fully compatible with all core features. 25 + 26 + ## Features 27 + 28 + - NestJS v10 support 29 + - seamless integration with `@hey-api/openapi-ts` ecosystem 30 + - type-safe controller methods via `implements` 31 + - incremental adoption with `Pick<ControllerMethods, ...>` 32 + - zero runtime coupling — pure TypeScript types 33 + - minimal learning curve thanks to extending the underlying technology 34 + 35 + ## Installation 36 + 37 + In your [configuration](/openapi-ts/get-started), add `nestjs` to your plugins and you'll be ready to generate NestJS artifacts. :tada: 38 + 39 + ```js 40 + export default { 41 + input: 'hey-api/backend', // sign up at app.heyapi.dev 42 + output: 'src/client', 43 + plugins: [ 44 + // ...other plugins 45 + 'nestjs', // [!code ++] 46 + ], 47 + }; 48 + ``` 49 + 50 + ## Output 51 + 52 + The NestJS plugin will generate the following artifacts, depending on the input specification. 53 + 54 + ## Controller Methods 55 + 56 + A single `ControllerMethods` type is generated from all endpoints. The method signatures follow the naming convention of SDK functions. 57 + 58 + ::: code-group 59 + 60 + ```ts [output] 61 + import type { 62 + ListPetsData, 63 + ListPetsResponse, 64 + ShowPetByIdData, 65 + ShowPetByIdResponse, 66 + } from './types.gen'; 67 + 68 + export type ControllerMethods = { 69 + createPets: () => Promise<void>; 70 + listPets: (query?: ListPetsData['query']) => Promise<ListPetsResponse>; 71 + showPetById: (path: ShowPetByIdData['path']) => Promise<ShowPetByIdResponse>; 72 + }; 73 + ``` 74 + 75 + ```js [config] 76 + export default { 77 + input: 'hey-api/backend', // sign up at app.heyapi.dev 78 + output: 'src/client', 79 + plugins: [ 80 + // ...other plugins 81 + { 82 + name: 'nestjs', 83 + }, 84 + ], 85 + }; 86 + ``` 87 + 88 + ::: 89 + 90 + ## Usage 91 + 92 + Use `Pick<ControllerMethods, ...>` with `implements` to enforce the contract on your controllers. 93 + 94 + ```ts 95 + import { Controller, Get, Post, Param, Query } from '@nestjs/common'; 96 + import type { ControllerMethods } from '../client/nestjs.gen'; 97 + import type { ListPetsData, ShowPetByIdData } from '../client/types.gen'; 98 + 99 + @Controller('pets') 100 + export class PetsController implements Pick< 101 + ControllerMethods, 102 + 'listPets' | 'createPets' | 'showPetById' 103 + > { 104 + @Get() 105 + async listPets(@Query() query?: ListPetsData['query']) { 106 + return []; 107 + } 108 + 109 + @Post() 110 + async createPets() { 111 + return; 112 + } 113 + 114 + @Get(':petId') 115 + async showPetById(@Param() path: ShowPetByIdData['path']) { 116 + return { id: Number(path.petId), name: 'Kitty' }; 117 + } 118 + } 119 + ``` 120 + 121 + ## Constraints 122 + 123 + The `implements` pattern requires **whole-object parameter style** with NestJS decorators: 124 + 125 + ```ts 126 + // WORKS with implements - whole-object style (recommended) 127 + @Get(':petId') 128 + async showPetById(@Param() path: ShowPetByIdData['path']) { ... } 129 + 130 + // DOES NOT WORK with implements - decomposed style 131 + @Get(':petId') 132 + async showPetById(@Param('petId') petId: string) { ... } 133 + ``` 134 + 135 + Methods using `@Res()` for raw response access are incompatible with `implements` because the extra parameter breaks assignability. 136 + 137 + ## API 138 + 139 + You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/plugins/nestjs/types.ts) interface. 140 + 141 + <!--@include: ../../partials/examples.md--> 18 142 <!--@include: ../../partials/sponsors.md-->
+18 -18
docs/openapi-ts/plugins/nestjs-research.md
··· 110 110 CreatePetsResponses, 111 111 ShowPetByIdData, 112 112 ShowPetByIdResponses, 113 - } from "./types.gen"; 113 + } from './types.gen'; 114 114 115 115 export interface PetsController { 116 - listPets(query?: ListPetsData["query"]): Promise<ListPetsResponses>; 117 - createPets(body: CreatePetsData["body"]): Promise<CreatePetsResponses>; 118 - showPetById(params: ShowPetByIdData["path"]): Promise<ShowPetByIdResponses>; 116 + listPets(query?: ListPetsData['query']): Promise<ListPetsResponses>; 117 + createPets(body: CreatePetsData['body']): Promise<CreatePetsResponses>; 118 + showPetById(params: ShowPetByIdData['path']): Promise<ShowPetByIdResponses>; 119 119 } 120 120 ``` 121 121 ··· 123 123 124 124 ```typescript 125 125 // controllers/pets.controller.ts 126 - import { Controller, Get, Post, Param, Query, Body } from "@nestjs/common"; 127 - import type { PetsController } from "../client/nestjs.gen"; 126 + import { Controller, Get, Post, Param, Query, Body } from '@nestjs/common'; 127 + import type { PetsController } from '../client/nestjs.gen'; 128 128 129 - @Controller("pets") 129 + @Controller('pets') 130 130 export class PetsControllerImpl implements PetsController { 131 131 @Get() 132 132 async listPets(@Query() query?) { ··· 138 138 return { id: 1 }; 139 139 } 140 140 141 - @Get(":petId") 141 + @Get(':petId') 142 142 async showPetById(@Param() params) { 143 - return { id: params.petId, name: "Kitty" }; 143 + return { id: params.petId, name: 'Kitty' }; 144 144 } 145 145 } 146 146 ``` ··· 202 202 203 203 ```js 204 204 export default { 205 - input: "openapi.json", 206 - output: "src/client", 205 + input: 'openapi.json', 206 + output: 'src/client', 207 207 plugins: [ 208 - "nestjs", // [!code ++] 208 + 'nestjs', // [!code ++] 209 209 ], 210 210 }; 211 211 ``` ··· 220 220 ::: code-group 221 221 222 222 ```ts [example] 223 - import { Controller, Get, Post } from "@nestjs/common"; 224 - import type { PetsController } from "../client/nestjs.gen"; 223 + import { Controller, Get, Post } from '@nestjs/common'; 224 + import type { PetsController } from '../client/nestjs.gen'; 225 225 226 - @Controller("pets") 226 + @Controller('pets') 227 227 export class PetsControllerImpl implements PetsController { 228 228 @Get() 229 229 async listPets(query?) { ··· 239 239 240 240 ```js [config] 241 241 export default { 242 - input: "openapi.json", 243 - output: "src/client", 242 + input: 'openapi.json', 243 + output: 'src/client', 244 244 plugins: [ 245 245 { 246 - name: "nestjs", 246 + name: 'nestjs', 247 247 }, 248 248 ], 249 249 };
+13
examples/openapi-ts-nestjs/openapi-ts.config.ts
··· 1 + import { defineConfig } from '@hey-api/openapi-ts'; 2 + 3 + export default defineConfig({ 4 + input: './openapi.json', 5 + logs: { 6 + path: './logs', 7 + }, 8 + output: { 9 + path: './src/client', 10 + postProcess: ['oxfmt', 'eslint'], 11 + }, 12 + plugins: ['nestjs', '@hey-api/sdk'], 13 + });
+100
examples/openapi-ts-nestjs/openapi.json
··· 1 + { 2 + "openapi": "3.1.0", 3 + "info": { 4 + "title": "Petstore API", 5 + "version": "1.0.0", 6 + "description": "A sample API that uses a petstore as an example" 7 + }, 8 + "servers": [ 9 + { 10 + "url": "http://localhost:3000/v3" 11 + } 12 + ], 13 + "paths": { 14 + "/pets/{petId}": { 15 + "get": { 16 + "summary": "Find pet by ID", 17 + "operationId": "showPetById", 18 + "parameters": [ 19 + { 20 + "name": "petId", 21 + "in": "path", 22 + "required": true, 23 + "schema": { 24 + "type": "string" 25 + } 26 + } 27 + ], 28 + "responses": { 29 + "200": { 30 + "description": "Pet found", 31 + "content": { 32 + "application/json": { 33 + "schema": { 34 + "type": "object", 35 + "properties": { 36 + "id": { 37 + "type": "string" 38 + }, 39 + "name": { 40 + "type": "string" 41 + } 42 + } 43 + } 44 + } 45 + } 46 + } 47 + } 48 + } 49 + }, 50 + "/pets": { 51 + "get": { 52 + "summary": "List all pets", 53 + "operationId": "listPets", 54 + "parameters": [ 55 + { 56 + "name": "limit", 57 + "in": "query", 58 + "required": false, 59 + "schema": { 60 + "type": "integer", 61 + "format": "int32" 62 + } 63 + } 64 + ], 65 + "responses": { 66 + "200": { 67 + "description": "A list of pets", 68 + "content": { 69 + "application/json": { 70 + "schema": { 71 + "type": "array", 72 + "items": { 73 + "type": "object", 74 + "properties": { 75 + "id": { 76 + "type": "string" 77 + }, 78 + "name": { 79 + "type": "string" 80 + } 81 + } 82 + } 83 + } 84 + } 85 + } 86 + } 87 + } 88 + }, 89 + "post": { 90 + "summary": "Create a pet", 91 + "operationId": "createPets", 92 + "responses": { 93 + "201": { 94 + "description": "Pet created" 95 + } 96 + } 97 + } 98 + } 99 + } 100 + }
+28
examples/openapi-ts-nestjs/package.json
··· 1 + { 2 + "name": "@example/openapi-ts-nestjs", 3 + "version": "0.1.0", 4 + "private": true, 5 + "type": "module", 6 + "scripts": { 7 + "openapi-ts": "openapi-ts", 8 + "test": "vitest", 9 + "typecheck": "tsc --noEmit" 10 + }, 11 + "dependencies": { 12 + "@nestjs/common": "10.4.18", 13 + "@nestjs/core": "10.4.18", 14 + "@nestjs/platform-express": "10.4.18", 15 + "reflect-metadata": "0.2.2", 16 + "rxjs": "7.8.2" 17 + }, 18 + "devDependencies": { 19 + "@hey-api/openapi-ts": "workspace:*", 20 + "@nestjs/testing": "10.4.18", 21 + "eslint": "9.17.0", 22 + "oxfmt": "0.27.0", 23 + "supertest": "7.1.0", 24 + "typescript": "5.9.3", 25 + "vite": "7.3.1", 26 + "vitest": "4.0.18" 27 + } 28 + }
+8
examples/openapi-ts-nestjs/src/app.module.ts
··· 1 + import { Module } from '@nestjs/common'; 2 + 3 + import { PetsController } from './pets/pets.controller'; 4 + 5 + @Module({ 6 + controllers: [PetsController], 7 + }) 8 + export class AppModule {}
+20
examples/openapi-ts-nestjs/src/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { type ClientOptions, type Config, createClient, createConfig } from './client'; 4 + import type { ClientOptions as ClientOptions2 } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = ( 15 + override?: Config<ClientOptions & T>, 16 + ) => Config<Required<ClientOptions> & T>; 17 + 18 + export const client = createClient( 19 + createConfig<ClientOptions2>({ baseUrl: 'http://localhost:3000/v3' }), 20 + );
+288
examples/openapi-ts-nestjs/src/client/client/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createSseClient } from '../core/serverSentEvents.gen'; 4 + import type { HttpMethod } from '../core/types.gen'; 5 + import { getValidRequestBody } from '../core/utils.gen'; 6 + import type { Client, Config, RequestOptions, ResolvedRequestOptions } from './types.gen'; 7 + import { 8 + buildUrl, 9 + createConfig, 10 + createInterceptors, 11 + getParseAs, 12 + mergeConfigs, 13 + mergeHeaders, 14 + setAuthParams, 15 + } from './utils.gen'; 16 + 17 + type ReqInit = Omit<RequestInit, 'body' | 'headers'> & { 18 + body?: any; 19 + headers: ReturnType<typeof mergeHeaders>; 20 + }; 21 + 22 + export const createClient = (config: Config = {}): Client => { 23 + let _config = mergeConfigs(createConfig(), config); 24 + 25 + const getConfig = (): Config => ({ ..._config }); 26 + 27 + const setConfig = (config: Config): Config => { 28 + _config = mergeConfigs(_config, config); 29 + return getConfig(); 30 + }; 31 + 32 + const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>(); 33 + 34 + const beforeRequest = async (options: RequestOptions) => { 35 + const opts = { 36 + ..._config, 37 + ...options, 38 + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, 39 + headers: mergeHeaders(_config.headers, options.headers), 40 + serializedBody: undefined, 41 + }; 42 + 43 + if (opts.security) { 44 + await setAuthParams({ 45 + ...opts, 46 + security: opts.security, 47 + }); 48 + } 49 + 50 + if (opts.requestValidator) { 51 + await opts.requestValidator(opts); 52 + } 53 + 54 + if (opts.body !== undefined && opts.bodySerializer) { 55 + opts.serializedBody = opts.bodySerializer(opts.body); 56 + } 57 + 58 + // remove Content-Type header if body is empty to avoid sending invalid requests 59 + if (opts.body === undefined || opts.serializedBody === '') { 60 + opts.headers.delete('Content-Type'); 61 + } 62 + 63 + const url = buildUrl(opts); 64 + 65 + return { opts, url }; 66 + }; 67 + 68 + const request: Client['request'] = async (options) => { 69 + // @ts-expect-error 70 + const { opts, url } = await beforeRequest(options); 71 + const requestInit: ReqInit = { 72 + redirect: 'follow', 73 + ...opts, 74 + body: getValidRequestBody(opts), 75 + }; 76 + 77 + let request = new Request(url, requestInit); 78 + 79 + for (const fn of interceptors.request.fns) { 80 + if (fn) { 81 + request = await fn(request, opts); 82 + } 83 + } 84 + 85 + // fetch must be assigned here, otherwise it would throw the error: 86 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 87 + const _fetch = opts.fetch!; 88 + let response: Response; 89 + 90 + try { 91 + response = await _fetch(request); 92 + } catch (error) { 93 + // Handle fetch exceptions (AbortError, network errors, etc.) 94 + let finalError = error; 95 + 96 + for (const fn of interceptors.error.fns) { 97 + if (fn) { 98 + finalError = (await fn(error, undefined as any, request, opts)) as unknown; 99 + } 100 + } 101 + 102 + finalError = finalError || ({} as unknown); 103 + 104 + if (opts.throwOnError) { 105 + throw finalError; 106 + } 107 + 108 + // Return error response 109 + return opts.responseStyle === 'data' 110 + ? undefined 111 + : { 112 + error: finalError, 113 + request, 114 + response: undefined as any, 115 + }; 116 + } 117 + 118 + for (const fn of interceptors.response.fns) { 119 + if (fn) { 120 + response = await fn(response, request, opts); 121 + } 122 + } 123 + 124 + const result = { 125 + request, 126 + response, 127 + }; 128 + 129 + if (response.ok) { 130 + const parseAs = 131 + (opts.parseAs === 'auto' 132 + ? getParseAs(response.headers.get('Content-Type')) 133 + : opts.parseAs) ?? 'json'; 134 + 135 + if (response.status === 204 || response.headers.get('Content-Length') === '0') { 136 + let emptyData: any; 137 + switch (parseAs) { 138 + case 'arrayBuffer': 139 + case 'blob': 140 + case 'text': 141 + emptyData = await response[parseAs](); 142 + break; 143 + case 'formData': 144 + emptyData = new FormData(); 145 + break; 146 + case 'stream': 147 + emptyData = response.body; 148 + break; 149 + case 'json': 150 + default: 151 + emptyData = {}; 152 + break; 153 + } 154 + return opts.responseStyle === 'data' 155 + ? emptyData 156 + : { 157 + data: emptyData, 158 + ...result, 159 + }; 160 + } 161 + 162 + let data: any; 163 + switch (parseAs) { 164 + case 'arrayBuffer': 165 + case 'blob': 166 + case 'formData': 167 + case 'text': 168 + data = await response[parseAs](); 169 + break; 170 + case 'json': { 171 + // Some servers return 200 with no Content-Length and empty body. 172 + // response.json() would throw; read as text and parse if non-empty. 173 + const text = await response.text(); 174 + data = text ? JSON.parse(text) : {}; 175 + break; 176 + } 177 + case 'stream': 178 + return opts.responseStyle === 'data' 179 + ? response.body 180 + : { 181 + data: response.body, 182 + ...result, 183 + }; 184 + } 185 + 186 + if (parseAs === 'json') { 187 + if (opts.responseValidator) { 188 + await opts.responseValidator(data); 189 + } 190 + 191 + if (opts.responseTransformer) { 192 + data = await opts.responseTransformer(data); 193 + } 194 + } 195 + 196 + return opts.responseStyle === 'data' 197 + ? data 198 + : { 199 + data, 200 + ...result, 201 + }; 202 + } 203 + 204 + const textError = await response.text(); 205 + let jsonError: unknown; 206 + 207 + try { 208 + jsonError = JSON.parse(textError); 209 + } catch { 210 + // noop 211 + } 212 + 213 + const error = jsonError ?? textError; 214 + let finalError = error; 215 + 216 + for (const fn of interceptors.error.fns) { 217 + if (fn) { 218 + finalError = (await fn(error, response, request, opts)) as string; 219 + } 220 + } 221 + 222 + finalError = finalError || ({} as string); 223 + 224 + if (opts.throwOnError) { 225 + throw finalError; 226 + } 227 + 228 + // TODO: we probably want to return error and improve types 229 + return opts.responseStyle === 'data' 230 + ? undefined 231 + : { 232 + error: finalError, 233 + ...result, 234 + }; 235 + }; 236 + 237 + const makeMethodFn = (method: Uppercase<HttpMethod>) => (options: RequestOptions) => 238 + request({ ...options, method }); 239 + 240 + const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => { 241 + const { opts, url } = await beforeRequest(options); 242 + return createSseClient({ 243 + ...opts, 244 + body: opts.body as BodyInit | null | undefined, 245 + headers: opts.headers as unknown as Record<string, string>, 246 + method, 247 + onRequest: async (url, init) => { 248 + let request = new Request(url, init); 249 + for (const fn of interceptors.request.fns) { 250 + if (fn) { 251 + request = await fn(request, opts); 252 + } 253 + } 254 + return request; 255 + }, 256 + serializedBody: getValidRequestBody(opts) as BodyInit | null | undefined, 257 + url, 258 + }); 259 + }; 260 + 261 + return { 262 + buildUrl, 263 + connect: makeMethodFn('CONNECT'), 264 + delete: makeMethodFn('DELETE'), 265 + get: makeMethodFn('GET'), 266 + getConfig, 267 + head: makeMethodFn('HEAD'), 268 + interceptors, 269 + options: makeMethodFn('OPTIONS'), 270 + patch: makeMethodFn('PATCH'), 271 + post: makeMethodFn('POST'), 272 + put: makeMethodFn('PUT'), 273 + request, 274 + setConfig, 275 + sse: { 276 + connect: makeSseFn('CONNECT'), 277 + delete: makeSseFn('DELETE'), 278 + get: makeSseFn('GET'), 279 + head: makeSseFn('HEAD'), 280 + options: makeSseFn('OPTIONS'), 281 + patch: makeSseFn('PATCH'), 282 + post: makeSseFn('POST'), 283 + put: makeSseFn('PUT'), 284 + trace: makeSseFn('TRACE'), 285 + }, 286 + trace: makeMethodFn('TRACE'), 287 + } as Client; 288 + };
+25
examples/openapi-ts-nestjs/src/client/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { Auth } from '../core/auth.gen'; 4 + export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; 5 + export { 6 + formDataBodySerializer, 7 + jsonBodySerializer, 8 + urlSearchParamsBodySerializer, 9 + } from '../core/bodySerializer.gen'; 10 + export { buildClientParams } from '../core/params.gen'; 11 + export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; 12 + export { createClient } from './client.gen'; 13 + export type { 14 + Client, 15 + ClientOptions, 16 + Config, 17 + CreateClientConfig, 18 + Options, 19 + RequestOptions, 20 + RequestResult, 21 + ResolvedRequestOptions, 22 + ResponseStyle, 23 + TDataShape, 24 + } from './types.gen'; 25 + export { createConfig, mergeHeaders } from './utils.gen';
+211
examples/openapi-ts-nestjs/src/client/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth } from '../core/auth.gen'; 4 + import type { ServerSentEventsOptions, ServerSentEventsResult } from '../core/serverSentEvents.gen'; 5 + import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen'; 6 + import type { Middleware } from './utils.gen'; 7 + 8 + export type ResponseStyle = 'data' | 'fields'; 9 + 10 + export interface Config<T extends ClientOptions = ClientOptions> 11 + extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig { 12 + /** 13 + * Base URL for all requests made by this client. 14 + */ 15 + baseUrl?: T['baseUrl']; 16 + /** 17 + * Fetch API implementation. You can use this option to provide a custom 18 + * fetch instance. 19 + * 20 + * @default globalThis.fetch 21 + */ 22 + fetch?: typeof fetch; 23 + /** 24 + * Please don't use the Fetch client for Next.js applications. The `next` 25 + * options won't have any effect. 26 + * 27 + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. 28 + */ 29 + next?: never; 30 + /** 31 + * Return the response data parsed in a specified format. By default, `auto` 32 + * will infer the appropriate method from the `Content-Type` response header. 33 + * You can override this behavior with any of the {@link Body} methods. 34 + * Select `stream` if you don't want to parse response data at all. 35 + * 36 + * @default 'auto' 37 + */ 38 + parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text'; 39 + /** 40 + * Should we return only data or multiple fields (data, error, response, etc.)? 41 + * 42 + * @default 'fields' 43 + */ 44 + responseStyle?: ResponseStyle; 45 + /** 46 + * Throw an error instead of returning it in the response? 47 + * 48 + * @default false 49 + */ 50 + throwOnError?: T['throwOnError']; 51 + } 52 + 53 + export interface RequestOptions< 54 + TData = unknown, 55 + TResponseStyle extends ResponseStyle = 'fields', 56 + ThrowOnError extends boolean = boolean, 57 + Url extends string = string, 58 + > 59 + extends 60 + Config<{ 61 + responseStyle: TResponseStyle; 62 + throwOnError: ThrowOnError; 63 + }>, 64 + Pick< 65 + ServerSentEventsOptions<TData>, 66 + | 'onRequest' 67 + | 'onSseError' 68 + | 'onSseEvent' 69 + | 'sseDefaultRetryDelay' 70 + | 'sseMaxRetryAttempts' 71 + | 'sseMaxRetryDelay' 72 + > { 73 + /** 74 + * Any body that you want to add to your request. 75 + * 76 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} 77 + */ 78 + body?: unknown; 79 + path?: Record<string, unknown>; 80 + query?: Record<string, unknown>; 81 + /** 82 + * Security mechanism(s) to use for the request. 83 + */ 84 + security?: ReadonlyArray<Auth>; 85 + url: Url; 86 + } 87 + 88 + export interface ResolvedRequestOptions< 89 + TResponseStyle extends ResponseStyle = 'fields', 90 + ThrowOnError extends boolean = boolean, 91 + Url extends string = string, 92 + > extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> { 93 + serializedBody?: string; 94 + } 95 + 96 + export type RequestResult< 97 + TData = unknown, 98 + TError = unknown, 99 + ThrowOnError extends boolean = boolean, 100 + TResponseStyle extends ResponseStyle = 'fields', 101 + > = ThrowOnError extends true 102 + ? Promise< 103 + TResponseStyle extends 'data' 104 + ? TData extends Record<string, unknown> 105 + ? TData[keyof TData] 106 + : TData 107 + : { 108 + data: TData extends Record<string, unknown> ? TData[keyof TData] : TData; 109 + request: Request; 110 + response: Response; 111 + } 112 + > 113 + : Promise< 114 + TResponseStyle extends 'data' 115 + ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined 116 + : ( 117 + | { 118 + data: TData extends Record<string, unknown> ? TData[keyof TData] : TData; 119 + error: undefined; 120 + } 121 + | { 122 + data: undefined; 123 + error: TError extends Record<string, unknown> ? TError[keyof TError] : TError; 124 + } 125 + ) & { 126 + request: Request; 127 + response: Response; 128 + } 129 + >; 130 + 131 + export interface ClientOptions { 132 + baseUrl?: string; 133 + responseStyle?: ResponseStyle; 134 + throwOnError?: boolean; 135 + } 136 + 137 + type MethodFn = < 138 + TData = unknown, 139 + TError = unknown, 140 + ThrowOnError extends boolean = false, 141 + TResponseStyle extends ResponseStyle = 'fields', 142 + >( 143 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 144 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 145 + 146 + type SseFn = < 147 + TData = unknown, 148 + TError = unknown, 149 + ThrowOnError extends boolean = false, 150 + TResponseStyle extends ResponseStyle = 'fields', 151 + >( 152 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>, 153 + ) => Promise<ServerSentEventsResult<TData, TError>>; 154 + 155 + type RequestFn = < 156 + TData = unknown, 157 + TError = unknown, 158 + ThrowOnError extends boolean = false, 159 + TResponseStyle extends ResponseStyle = 'fields', 160 + >( 161 + options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & 162 + Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>, 163 + ) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>; 164 + 165 + type BuildUrlFn = < 166 + TData extends { 167 + body?: unknown; 168 + path?: Record<string, unknown>; 169 + query?: Record<string, unknown>; 170 + url: string; 171 + }, 172 + >( 173 + options: TData & Options<TData>, 174 + ) => string; 175 + 176 + export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & { 177 + interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>; 178 + }; 179 + 180 + /** 181 + * The `createClientConfig()` function will be called on client initialization 182 + * and the returned object will become the client's initial configuration. 183 + * 184 + * You may want to initialize your client this way instead of calling 185 + * `setConfig()`. This is useful for example if you're using Next.js 186 + * to ensure your client always has the correct values. 187 + */ 188 + export type CreateClientConfig<T extends ClientOptions = ClientOptions> = ( 189 + override?: Config<ClientOptions & T>, 190 + ) => Config<Required<ClientOptions> & T>; 191 + 192 + export interface TDataShape { 193 + body?: unknown; 194 + headers?: unknown; 195 + path?: unknown; 196 + query?: unknown; 197 + url: string; 198 + } 199 + 200 + type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>; 201 + 202 + export type Options< 203 + TData extends TDataShape = TDataShape, 204 + ThrowOnError extends boolean = boolean, 205 + TResponse = unknown, 206 + TResponseStyle extends ResponseStyle = 'fields', 207 + > = OmitKeys< 208 + RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 209 + 'body' | 'path' | 'query' | 'url' 210 + > & 211 + ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
+316
examples/openapi-ts-nestjs/src/client/client/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { getAuthToken } from '../core/auth.gen'; 4 + import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; 5 + import { jsonBodySerializer } from '../core/bodySerializer.gen'; 6 + import { 7 + serializeArrayParam, 8 + serializeObjectParam, 9 + serializePrimitiveParam, 10 + } from '../core/pathSerializer.gen'; 11 + import { getUrl } from '../core/utils.gen'; 12 + import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; 13 + 14 + export const createQuerySerializer = <T = unknown>({ 15 + parameters = {}, 16 + ...args 17 + }: QuerySerializerOptions = {}) => { 18 + const querySerializer = (queryParams: T) => { 19 + const search: string[] = []; 20 + if (queryParams && typeof queryParams === 'object') { 21 + for (const name in queryParams) { 22 + const value = queryParams[name]; 23 + 24 + if (value === undefined || value === null) { 25 + continue; 26 + } 27 + 28 + const options = parameters[name] || args; 29 + 30 + if (Array.isArray(value)) { 31 + const serializedArray = serializeArrayParam({ 32 + allowReserved: options.allowReserved, 33 + explode: true, 34 + name, 35 + style: 'form', 36 + value, 37 + ...options.array, 38 + }); 39 + if (serializedArray) search.push(serializedArray); 40 + } else if (typeof value === 'object') { 41 + const serializedObject = serializeObjectParam({ 42 + allowReserved: options.allowReserved, 43 + explode: true, 44 + name, 45 + style: 'deepObject', 46 + value: value as Record<string, unknown>, 47 + ...options.object, 48 + }); 49 + if (serializedObject) search.push(serializedObject); 50 + } else { 51 + const serializedPrimitive = serializePrimitiveParam({ 52 + allowReserved: options.allowReserved, 53 + name, 54 + value: value as string, 55 + }); 56 + if (serializedPrimitive) search.push(serializedPrimitive); 57 + } 58 + } 59 + } 60 + return search.join('&'); 61 + }; 62 + return querySerializer; 63 + }; 64 + 65 + /** 66 + * Infers parseAs value from provided Content-Type header. 67 + */ 68 + export const getParseAs = (contentType: string | null): Exclude<Config['parseAs'], 'auto'> => { 69 + if (!contentType) { 70 + // If no Content-Type header is provided, the best we can do is return the raw response body, 71 + // which is effectively the same as the 'stream' option. 72 + return 'stream'; 73 + } 74 + 75 + const cleanContent = contentType.split(';')[0]?.trim(); 76 + 77 + if (!cleanContent) { 78 + return; 79 + } 80 + 81 + if (cleanContent.startsWith('application/json') || cleanContent.endsWith('+json')) { 82 + return 'json'; 83 + } 84 + 85 + if (cleanContent === 'multipart/form-data') { 86 + return 'formData'; 87 + } 88 + 89 + if ( 90 + ['application/', 'audio/', 'image/', 'video/'].some((type) => cleanContent.startsWith(type)) 91 + ) { 92 + return 'blob'; 93 + } 94 + 95 + if (cleanContent.startsWith('text/')) { 96 + return 'text'; 97 + } 98 + 99 + return; 100 + }; 101 + 102 + const checkForExistence = ( 103 + options: Pick<RequestOptions, 'auth' | 'query'> & { 104 + headers: Headers; 105 + }, 106 + name?: string, 107 + ): boolean => { 108 + if (!name) { 109 + return false; 110 + } 111 + if ( 112 + options.headers.has(name) || 113 + options.query?.[name] || 114 + options.headers.get('Cookie')?.includes(`${name}=`) 115 + ) { 116 + return true; 117 + } 118 + return false; 119 + }; 120 + 121 + export const setAuthParams = async ({ 122 + security, 123 + ...options 124 + }: Pick<Required<RequestOptions>, 'security'> & 125 + Pick<RequestOptions, 'auth' | 'query'> & { 126 + headers: Headers; 127 + }) => { 128 + for (const auth of security) { 129 + if (checkForExistence(options, auth.name)) { 130 + continue; 131 + } 132 + 133 + const token = await getAuthToken(auth, options.auth); 134 + 135 + if (!token) { 136 + continue; 137 + } 138 + 139 + const name = auth.name ?? 'Authorization'; 140 + 141 + switch (auth.in) { 142 + case 'query': 143 + if (!options.query) { 144 + options.query = {}; 145 + } 146 + options.query[name] = token; 147 + break; 148 + case 'cookie': 149 + options.headers.append('Cookie', `${name}=${token}`); 150 + break; 151 + case 'header': 152 + default: 153 + options.headers.set(name, token); 154 + break; 155 + } 156 + } 157 + }; 158 + 159 + export const buildUrl: Client['buildUrl'] = (options) => 160 + getUrl({ 161 + baseUrl: options.baseUrl as string, 162 + path: options.path, 163 + query: options.query, 164 + querySerializer: 165 + typeof options.querySerializer === 'function' 166 + ? options.querySerializer 167 + : createQuerySerializer(options.querySerializer), 168 + url: options.url, 169 + }); 170 + 171 + export const mergeConfigs = (a: Config, b: Config): Config => { 172 + const config = { ...a, ...b }; 173 + if (config.baseUrl?.endsWith('/')) { 174 + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); 175 + } 176 + config.headers = mergeHeaders(a.headers, b.headers); 177 + return config; 178 + }; 179 + 180 + const headersEntries = (headers: Headers): Array<[string, string]> => { 181 + const entries: Array<[string, string]> = []; 182 + headers.forEach((value, key) => { 183 + entries.push([key, value]); 184 + }); 185 + return entries; 186 + }; 187 + 188 + export const mergeHeaders = ( 189 + ...headers: Array<Required<Config>['headers'] | undefined> 190 + ): Headers => { 191 + const mergedHeaders = new Headers(); 192 + for (const header of headers) { 193 + if (!header) { 194 + continue; 195 + } 196 + 197 + const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header); 198 + 199 + for (const [key, value] of iterator) { 200 + if (value === null) { 201 + mergedHeaders.delete(key); 202 + } else if (Array.isArray(value)) { 203 + for (const v of value) { 204 + mergedHeaders.append(key, v as string); 205 + } 206 + } else if (value !== undefined) { 207 + // assume object headers are meant to be JSON stringified, i.e. their 208 + // content value in OpenAPI specification is 'application/json' 209 + mergedHeaders.set( 210 + key, 211 + typeof value === 'object' ? JSON.stringify(value) : (value as string), 212 + ); 213 + } 214 + } 215 + } 216 + return mergedHeaders; 217 + }; 218 + 219 + type ErrInterceptor<Err, Res, Req, Options> = ( 220 + error: Err, 221 + response: Res, 222 + request: Req, 223 + options: Options, 224 + ) => Err | Promise<Err>; 225 + 226 + type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>; 227 + 228 + type ResInterceptor<Res, Req, Options> = ( 229 + response: Res, 230 + request: Req, 231 + options: Options, 232 + ) => Res | Promise<Res>; 233 + 234 + class Interceptors<Interceptor> { 235 + fns: Array<Interceptor | null> = []; 236 + 237 + clear(): void { 238 + this.fns = []; 239 + } 240 + 241 + eject(id: number | Interceptor): void { 242 + const index = this.getInterceptorIndex(id); 243 + if (this.fns[index]) { 244 + this.fns[index] = null; 245 + } 246 + } 247 + 248 + exists(id: number | Interceptor): boolean { 249 + const index = this.getInterceptorIndex(id); 250 + return Boolean(this.fns[index]); 251 + } 252 + 253 + getInterceptorIndex(id: number | Interceptor): number { 254 + if (typeof id === 'number') { 255 + return this.fns[id] ? id : -1; 256 + } 257 + return this.fns.indexOf(id); 258 + } 259 + 260 + update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { 261 + const index = this.getInterceptorIndex(id); 262 + if (this.fns[index]) { 263 + this.fns[index] = fn; 264 + return id; 265 + } 266 + return false; 267 + } 268 + 269 + use(fn: Interceptor): number { 270 + this.fns.push(fn); 271 + return this.fns.length - 1; 272 + } 273 + } 274 + 275 + export interface Middleware<Req, Res, Err, Options> { 276 + error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>; 277 + request: Interceptors<ReqInterceptor<Req, Options>>; 278 + response: Interceptors<ResInterceptor<Res, Req, Options>>; 279 + } 280 + 281 + export const createInterceptors = <Req, Res, Err, Options>(): Middleware< 282 + Req, 283 + Res, 284 + Err, 285 + Options 286 + > => ({ 287 + error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(), 288 + request: new Interceptors<ReqInterceptor<Req, Options>>(), 289 + response: new Interceptors<ResInterceptor<Res, Req, Options>>(), 290 + }); 291 + 292 + const defaultQuerySerializer = createQuerySerializer({ 293 + allowReserved: false, 294 + array: { 295 + explode: true, 296 + style: 'form', 297 + }, 298 + object: { 299 + explode: true, 300 + style: 'deepObject', 301 + }, 302 + }); 303 + 304 + const defaultHeaders = { 305 + 'Content-Type': 'application/json', 306 + }; 307 + 308 + export const createConfig = <T extends ClientOptions = ClientOptions>( 309 + override: Config<Omit<ClientOptions, keyof T> & T> = {}, 310 + ): Config<Omit<ClientOptions, keyof T> & T> => ({ 311 + ...jsonBodySerializer, 312 + headers: defaultHeaders, 313 + parseAs: 'auto', 314 + querySerializer: defaultQuerySerializer, 315 + ...override, 316 + });
+41
examples/openapi-ts-nestjs/src/client/core/auth.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type AuthToken = string | undefined; 4 + 5 + export interface Auth { 6 + /** 7 + * Which part of the request do we use to send the auth? 8 + * 9 + * @default 'header' 10 + */ 11 + in?: 'header' | 'query' | 'cookie'; 12 + /** 13 + * Header or query parameter name. 14 + * 15 + * @default 'Authorization' 16 + */ 17 + name?: string; 18 + scheme?: 'basic' | 'bearer'; 19 + type: 'apiKey' | 'http'; 20 + } 21 + 22 + export const getAuthToken = async ( 23 + auth: Auth, 24 + callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken, 25 + ): Promise<string | undefined> => { 26 + const token = typeof callback === 'function' ? await callback(auth) : callback; 27 + 28 + if (!token) { 29 + return; 30 + } 31 + 32 + if (auth.scheme === 'bearer') { 33 + return `Bearer ${token}`; 34 + } 35 + 36 + if (auth.scheme === 'basic') { 37 + return `Basic ${btoa(token)}`; 38 + } 39 + 40 + return token; 41 + };
+84
examples/openapi-ts-nestjs/src/client/core/bodySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerializer.gen'; 4 + 5 + export type QuerySerializer = (query: Record<string, unknown>) => string; 6 + 7 + export type BodySerializer = (body: any) => any; 8 + 9 + type QuerySerializerOptionsObject = { 10 + allowReserved?: boolean; 11 + array?: Partial<SerializerOptions<ArrayStyle>>; 12 + object?: Partial<SerializerOptions<ObjectStyle>>; 13 + }; 14 + 15 + export type QuerySerializerOptions = QuerySerializerOptionsObject & { 16 + /** 17 + * Per-parameter serialization overrides. When provided, these settings 18 + * override the global array/object settings for specific parameter names. 19 + */ 20 + parameters?: Record<string, QuerySerializerOptionsObject>; 21 + }; 22 + 23 + const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { 24 + if (typeof value === 'string' || value instanceof Blob) { 25 + data.append(key, value); 26 + } else if (value instanceof Date) { 27 + data.append(key, value.toISOString()); 28 + } else { 29 + data.append(key, JSON.stringify(value)); 30 + } 31 + }; 32 + 33 + const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { 34 + if (typeof value === 'string') { 35 + data.append(key, value); 36 + } else { 37 + data.append(key, JSON.stringify(value)); 38 + } 39 + }; 40 + 41 + export const formDataBodySerializer = { 42 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>( 43 + body: T, 44 + ): FormData => { 45 + const data = new FormData(); 46 + 47 + Object.entries(body).forEach(([key, value]) => { 48 + if (value === undefined || value === null) { 49 + return; 50 + } 51 + if (Array.isArray(value)) { 52 + value.forEach((v) => serializeFormDataPair(data, key, v)); 53 + } else { 54 + serializeFormDataPair(data, key, value); 55 + } 56 + }); 57 + 58 + return data; 59 + }, 60 + }; 61 + 62 + export const jsonBodySerializer = { 63 + bodySerializer: <T>(body: T): string => 64 + JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)), 65 + }; 66 + 67 + export const urlSearchParamsBodySerializer = { 68 + bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => { 69 + const data = new URLSearchParams(); 70 + 71 + Object.entries(body).forEach(([key, value]) => { 72 + if (value === undefined || value === null) { 73 + return; 74 + } 75 + if (Array.isArray(value)) { 76 + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); 77 + } else { 78 + serializeUrlSearchParamsPair(data, key, value); 79 + } 80 + }); 81 + 82 + return data.toString(); 83 + }, 84 + };
+169
examples/openapi-ts-nestjs/src/client/core/params.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + type Slot = 'body' | 'headers' | 'path' | 'query'; 4 + 5 + export type Field = 6 + | { 7 + in: Exclude<Slot, 'body'>; 8 + /** 9 + * Field name. This is the name we want the user to see and use. 10 + */ 11 + key: string; 12 + /** 13 + * Field mapped name. This is the name we want to use in the request. 14 + * If omitted, we use the same value as `key`. 15 + */ 16 + map?: string; 17 + } 18 + | { 19 + in: Extract<Slot, 'body'>; 20 + /** 21 + * Key isn't required for bodies. 22 + */ 23 + key?: string; 24 + map?: string; 25 + } 26 + | { 27 + /** 28 + * Field name. This is the name we want the user to see and use. 29 + */ 30 + key: string; 31 + /** 32 + * Field mapped name. This is the name we want to use in the request. 33 + * If `in` is omitted, `map` aliases `key` to the transport layer. 34 + */ 35 + map: Slot; 36 + }; 37 + 38 + export interface Fields { 39 + allowExtra?: Partial<Record<Slot, boolean>>; 40 + args?: ReadonlyArray<Field>; 41 + } 42 + 43 + export type FieldsConfig = ReadonlyArray<Field | Fields>; 44 + 45 + const extraPrefixesMap: Record<string, Slot> = { 46 + $body_: 'body', 47 + $headers_: 'headers', 48 + $path_: 'path', 49 + $query_: 'query', 50 + }; 51 + const extraPrefixes = Object.entries(extraPrefixesMap); 52 + 53 + type KeyMap = Map< 54 + string, 55 + | { 56 + in: Slot; 57 + map?: string; 58 + } 59 + | { 60 + in?: never; 61 + map: Slot; 62 + } 63 + >; 64 + 65 + const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { 66 + if (!map) { 67 + map = new Map(); 68 + } 69 + 70 + for (const config of fields) { 71 + if ('in' in config) { 72 + if (config.key) { 73 + map.set(config.key, { 74 + in: config.in, 75 + map: config.map, 76 + }); 77 + } 78 + } else if ('key' in config) { 79 + map.set(config.key, { 80 + map: config.map, 81 + }); 82 + } else if (config.args) { 83 + buildKeyMap(config.args, map); 84 + } 85 + } 86 + 87 + return map; 88 + }; 89 + 90 + interface Params { 91 + body: unknown; 92 + headers: Record<string, unknown>; 93 + path: Record<string, unknown>; 94 + query: Record<string, unknown>; 95 + } 96 + 97 + const stripEmptySlots = (params: Params) => { 98 + for (const [slot, value] of Object.entries(params)) { 99 + if (value && typeof value === 'object' && !Object.keys(value).length) { 100 + delete params[slot as Slot]; 101 + } 102 + } 103 + }; 104 + 105 + export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => { 106 + const params: Params = { 107 + body: {}, 108 + headers: {}, 109 + path: {}, 110 + query: {}, 111 + }; 112 + 113 + const map = buildKeyMap(fields); 114 + 115 + let config: FieldsConfig[number] | undefined; 116 + 117 + for (const [index, arg] of args.entries()) { 118 + if (fields[index]) { 119 + config = fields[index]; 120 + } 121 + 122 + if (!config) { 123 + continue; 124 + } 125 + 126 + if ('in' in config) { 127 + if (config.key) { 128 + const field = map.get(config.key)!; 129 + const name = field.map || config.key; 130 + if (field.in) { 131 + (params[field.in] as Record<string, unknown>)[name] = arg; 132 + } 133 + } else { 134 + params.body = arg; 135 + } 136 + } else { 137 + for (const [key, value] of Object.entries(arg ?? {})) { 138 + const field = map.get(key); 139 + 140 + if (field) { 141 + if (field.in) { 142 + const name = field.map || key; 143 + (params[field.in] as Record<string, unknown>)[name] = value; 144 + } else { 145 + params[field.map] = value; 146 + } 147 + } else { 148 + const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)); 149 + 150 + if (extra) { 151 + const [prefix, slot] = extra; 152 + (params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value; 153 + } else if ('allowExtra' in config && config.allowExtra) { 154 + for (const [slot, allowed] of Object.entries(config.allowExtra)) { 155 + if (allowed) { 156 + (params[slot as Slot] as Record<string, unknown>)[key] = value; 157 + break; 158 + } 159 + } 160 + } 161 + } 162 + } 163 + } 164 + } 165 + 166 + stripEmptySlots(params); 167 + 168 + return params; 169 + };
+171
examples/openapi-ts-nestjs/src/client/core/pathSerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {} 4 + 5 + interface SerializePrimitiveOptions { 6 + allowReserved?: boolean; 7 + name: string; 8 + } 9 + 10 + export interface SerializerOptions<T> { 11 + /** 12 + * @default true 13 + */ 14 + explode: boolean; 15 + style: T; 16 + } 17 + 18 + export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; 19 + export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; 20 + type MatrixStyle = 'label' | 'matrix' | 'simple'; 21 + export type ObjectStyle = 'form' | 'deepObject'; 22 + type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; 23 + 24 + interface SerializePrimitiveParam extends SerializePrimitiveOptions { 25 + value: string; 26 + } 27 + 28 + export const separatorArrayExplode = (style: ArraySeparatorStyle) => { 29 + switch (style) { 30 + case 'label': 31 + return '.'; 32 + case 'matrix': 33 + return ';'; 34 + case 'simple': 35 + return ','; 36 + default: 37 + return '&'; 38 + } 39 + }; 40 + 41 + export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { 42 + switch (style) { 43 + case 'form': 44 + return ','; 45 + case 'pipeDelimited': 46 + return '|'; 47 + case 'spaceDelimited': 48 + return '%20'; 49 + default: 50 + return ','; 51 + } 52 + }; 53 + 54 + export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { 55 + switch (style) { 56 + case 'label': 57 + return '.'; 58 + case 'matrix': 59 + return ';'; 60 + case 'simple': 61 + return ','; 62 + default: 63 + return '&'; 64 + } 65 + }; 66 + 67 + export const serializeArrayParam = ({ 68 + allowReserved, 69 + explode, 70 + name, 71 + style, 72 + value, 73 + }: SerializeOptions<ArraySeparatorStyle> & { 74 + value: unknown[]; 75 + }) => { 76 + if (!explode) { 77 + const joinedValues = ( 78 + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) 79 + ).join(separatorArrayNoExplode(style)); 80 + switch (style) { 81 + case 'label': 82 + return `.${joinedValues}`; 83 + case 'matrix': 84 + return `;${name}=${joinedValues}`; 85 + case 'simple': 86 + return joinedValues; 87 + default: 88 + return `${name}=${joinedValues}`; 89 + } 90 + } 91 + 92 + const separator = separatorArrayExplode(style); 93 + const joinedValues = value 94 + .map((v) => { 95 + if (style === 'label' || style === 'simple') { 96 + return allowReserved ? v : encodeURIComponent(v as string); 97 + } 98 + 99 + return serializePrimitiveParam({ 100 + allowReserved, 101 + name, 102 + value: v as string, 103 + }); 104 + }) 105 + .join(separator); 106 + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; 107 + }; 108 + 109 + export const serializePrimitiveParam = ({ 110 + allowReserved, 111 + name, 112 + value, 113 + }: SerializePrimitiveParam) => { 114 + if (value === undefined || value === null) { 115 + return ''; 116 + } 117 + 118 + if (typeof value === 'object') { 119 + throw new Error( 120 + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', 121 + ); 122 + } 123 + 124 + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; 125 + }; 126 + 127 + export const serializeObjectParam = ({ 128 + allowReserved, 129 + explode, 130 + name, 131 + style, 132 + value, 133 + valueOnly, 134 + }: SerializeOptions<ObjectSeparatorStyle> & { 135 + value: Record<string, unknown> | Date; 136 + valueOnly?: boolean; 137 + }) => { 138 + if (value instanceof Date) { 139 + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; 140 + } 141 + 142 + if (style !== 'deepObject' && !explode) { 143 + let values: string[] = []; 144 + Object.entries(value).forEach(([key, v]) => { 145 + values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)]; 146 + }); 147 + const joinedValues = values.join(','); 148 + switch (style) { 149 + case 'form': 150 + return `${name}=${joinedValues}`; 151 + case 'label': 152 + return `.${joinedValues}`; 153 + case 'matrix': 154 + return `;${name}=${joinedValues}`; 155 + default: 156 + return joinedValues; 157 + } 158 + } 159 + 160 + const separator = separatorObjectExplode(style); 161 + const joinedValues = Object.entries(value) 162 + .map(([key, v]) => 163 + serializePrimitiveParam({ 164 + allowReserved, 165 + name: style === 'deepObject' ? `${name}[${key}]` : key, 166 + value: v as string, 167 + }), 168 + ) 169 + .join(separator); 170 + return style === 'label' || style === 'matrix' ? separator + joinedValues : joinedValues; 171 + };
+117
examples/openapi-ts-nestjs/src/client/core/queryKeySerializer.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + /** 4 + * JSON-friendly union that mirrors what Pinia Colada can hash. 5 + */ 6 + export type JsonValue = 7 + | null 8 + | string 9 + | number 10 + | boolean 11 + | JsonValue[] 12 + | { [key: string]: JsonValue }; 13 + 14 + /** 15 + * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. 16 + */ 17 + export const queryKeyJsonReplacer = (_key: string, value: unknown) => { 18 + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { 19 + return undefined; 20 + } 21 + if (typeof value === 'bigint') { 22 + return value.toString(); 23 + } 24 + if (value instanceof Date) { 25 + return value.toISOString(); 26 + } 27 + return value; 28 + }; 29 + 30 + /** 31 + * Safely stringifies a value and parses it back into a JsonValue. 32 + */ 33 + export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { 34 + try { 35 + const json = JSON.stringify(input, queryKeyJsonReplacer); 36 + if (json === undefined) { 37 + return undefined; 38 + } 39 + return JSON.parse(json) as JsonValue; 40 + } catch { 41 + return undefined; 42 + } 43 + }; 44 + 45 + /** 46 + * Detects plain objects (including objects with a null prototype). 47 + */ 48 + const isPlainObject = (value: unknown): value is Record<string, unknown> => { 49 + if (value === null || typeof value !== 'object') { 50 + return false; 51 + } 52 + const prototype = Object.getPrototypeOf(value as object); 53 + return prototype === Object.prototype || prototype === null; 54 + }; 55 + 56 + /** 57 + * Turns URLSearchParams into a sorted JSON object for deterministic keys. 58 + */ 59 + const serializeSearchParams = (params: URLSearchParams): JsonValue => { 60 + const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)); 61 + const result: Record<string, JsonValue> = {}; 62 + 63 + for (const [key, value] of entries) { 64 + const existing = result[key]; 65 + if (existing === undefined) { 66 + result[key] = value; 67 + continue; 68 + } 69 + 70 + if (Array.isArray(existing)) { 71 + (existing as string[]).push(value); 72 + } else { 73 + result[key] = [existing, value]; 74 + } 75 + } 76 + 77 + return result; 78 + }; 79 + 80 + /** 81 + * Normalizes any accepted value into a JSON-friendly shape for query keys. 82 + */ 83 + export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { 84 + if (value === null) { 85 + return null; 86 + } 87 + 88 + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { 89 + return value; 90 + } 91 + 92 + if (value === undefined || typeof value === 'function' || typeof value === 'symbol') { 93 + return undefined; 94 + } 95 + 96 + if (typeof value === 'bigint') { 97 + return value.toString(); 98 + } 99 + 100 + if (value instanceof Date) { 101 + return value.toISOString(); 102 + } 103 + 104 + if (Array.isArray(value)) { 105 + return stringifyToJsonValue(value); 106 + } 107 + 108 + if (typeof URLSearchParams !== 'undefined' && value instanceof URLSearchParams) { 109 + return serializeSearchParams(value); 110 + } 111 + 112 + if (isPlainObject(value)) { 113 + return stringifyToJsonValue(value); 114 + } 115 + 116 + return undefined; 117 + };
+243
examples/openapi-ts-nestjs/src/client/core/serverSentEvents.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Config } from './types.gen'; 4 + 5 + export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & 6 + Pick<Config, 'method' | 'responseTransformer' | 'responseValidator'> & { 7 + /** 8 + * Fetch API implementation. You can use this option to provide a custom 9 + * fetch instance. 10 + * 11 + * @default globalThis.fetch 12 + */ 13 + fetch?: typeof fetch; 14 + /** 15 + * Implementing clients can call request interceptors inside this hook. 16 + */ 17 + onRequest?: (url: string, init: RequestInit) => Promise<Request>; 18 + /** 19 + * Callback invoked when a network or parsing error occurs during streaming. 20 + * 21 + * This option applies only if the endpoint returns a stream of events. 22 + * 23 + * @param error The error that occurred. 24 + */ 25 + onSseError?: (error: unknown) => void; 26 + /** 27 + * Callback invoked when an event is streamed from the server. 28 + * 29 + * This option applies only if the endpoint returns a stream of events. 30 + * 31 + * @param event Event streamed from the server. 32 + * @returns Nothing (void). 33 + */ 34 + onSseEvent?: (event: StreamEvent<TData>) => void; 35 + serializedBody?: RequestInit['body']; 36 + /** 37 + * Default retry delay in milliseconds. 38 + * 39 + * This option applies only if the endpoint returns a stream of events. 40 + * 41 + * @default 3000 42 + */ 43 + sseDefaultRetryDelay?: number; 44 + /** 45 + * Maximum number of retry attempts before giving up. 46 + */ 47 + sseMaxRetryAttempts?: number; 48 + /** 49 + * Maximum retry delay in milliseconds. 50 + * 51 + * Applies only when exponential backoff is used. 52 + * 53 + * This option applies only if the endpoint returns a stream of events. 54 + * 55 + * @default 30000 56 + */ 57 + sseMaxRetryDelay?: number; 58 + /** 59 + * Optional sleep function for retry backoff. 60 + * 61 + * Defaults to using `setTimeout`. 62 + */ 63 + sseSleepFn?: (ms: number) => Promise<void>; 64 + url: string; 65 + }; 66 + 67 + export interface StreamEvent<TData = unknown> { 68 + data: TData; 69 + event?: string; 70 + id?: string; 71 + retry?: number; 72 + } 73 + 74 + export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = { 75 + stream: AsyncGenerator< 76 + TData extends Record<string, unknown> ? TData[keyof TData] : TData, 77 + TReturn, 78 + TNext 79 + >; 80 + }; 81 + 82 + export const createSseClient = <TData = unknown>({ 83 + onRequest, 84 + onSseError, 85 + onSseEvent, 86 + responseTransformer, 87 + responseValidator, 88 + sseDefaultRetryDelay, 89 + sseMaxRetryAttempts, 90 + sseMaxRetryDelay, 91 + sseSleepFn, 92 + url, 93 + ...options 94 + }: ServerSentEventsOptions): ServerSentEventsResult<TData> => { 95 + let lastEventId: string | undefined; 96 + 97 + const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); 98 + 99 + const createStream = async function* () { 100 + let retryDelay: number = sseDefaultRetryDelay ?? 3000; 101 + let attempt = 0; 102 + const signal = options.signal ?? new AbortController().signal; 103 + 104 + while (true) { 105 + if (signal.aborted) break; 106 + 107 + attempt++; 108 + 109 + const headers = 110 + options.headers instanceof Headers 111 + ? options.headers 112 + : new Headers(options.headers as Record<string, string> | undefined); 113 + 114 + if (lastEventId !== undefined) { 115 + headers.set('Last-Event-ID', lastEventId); 116 + } 117 + 118 + try { 119 + const requestInit: RequestInit = { 120 + redirect: 'follow', 121 + ...options, 122 + body: options.serializedBody, 123 + headers, 124 + signal, 125 + }; 126 + let request = new Request(url, requestInit); 127 + if (onRequest) { 128 + request = await onRequest(url, requestInit); 129 + } 130 + // fetch must be assigned here, otherwise it would throw the error: 131 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 132 + const _fetch = options.fetch ?? globalThis.fetch; 133 + const response = await _fetch(request); 134 + 135 + if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`); 136 + 137 + if (!response.body) throw new Error('No body in SSE response'); 138 + 139 + const reader = response.body.pipeThrough(new TextDecoderStream()).getReader(); 140 + 141 + let buffer = ''; 142 + 143 + const abortHandler = () => { 144 + try { 145 + reader.cancel(); 146 + } catch { 147 + // noop 148 + } 149 + }; 150 + 151 + signal.addEventListener('abort', abortHandler); 152 + 153 + try { 154 + while (true) { 155 + const { done, value } = await reader.read(); 156 + if (done) break; 157 + buffer += value; 158 + // Normalize line endings: CRLF -> LF, then CR -> LF 159 + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); 160 + 161 + const chunks = buffer.split('\n\n'); 162 + buffer = chunks.pop() ?? ''; 163 + 164 + for (const chunk of chunks) { 165 + const lines = chunk.split('\n'); 166 + const dataLines: Array<string> = []; 167 + let eventName: string | undefined; 168 + 169 + for (const line of lines) { 170 + if (line.startsWith('data:')) { 171 + dataLines.push(line.replace(/^data:\s*/, '')); 172 + } else if (line.startsWith('event:')) { 173 + eventName = line.replace(/^event:\s*/, ''); 174 + } else if (line.startsWith('id:')) { 175 + lastEventId = line.replace(/^id:\s*/, ''); 176 + } else if (line.startsWith('retry:')) { 177 + const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10); 178 + if (!Number.isNaN(parsed)) { 179 + retryDelay = parsed; 180 + } 181 + } 182 + } 183 + 184 + let data: unknown; 185 + let parsedJson = false; 186 + 187 + if (dataLines.length) { 188 + const rawData = dataLines.join('\n'); 189 + try { 190 + data = JSON.parse(rawData); 191 + parsedJson = true; 192 + } catch { 193 + data = rawData; 194 + } 195 + } 196 + 197 + if (parsedJson) { 198 + if (responseValidator) { 199 + await responseValidator(data); 200 + } 201 + 202 + if (responseTransformer) { 203 + data = await responseTransformer(data); 204 + } 205 + } 206 + 207 + onSseEvent?.({ 208 + data, 209 + event: eventName, 210 + id: lastEventId, 211 + retry: retryDelay, 212 + }); 213 + 214 + if (dataLines.length) { 215 + yield data as any; 216 + } 217 + } 218 + } 219 + } finally { 220 + signal.removeEventListener('abort', abortHandler); 221 + reader.releaseLock(); 222 + } 223 + 224 + break; // exit loop on normal completion 225 + } catch (error) { 226 + // connection failed or aborted; retry after delay 227 + onSseError?.(error); 228 + 229 + if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { 230 + break; // stop after firing error 231 + } 232 + 233 + // exponential backoff: double retry each attempt, cap at 30s 234 + const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000); 235 + await sleep(backoff); 236 + } 237 + } 238 + }; 239 + 240 + const stream = createStream(); 241 + 242 + return { stream }; 243 + };
+104
examples/openapi-ts-nestjs/src/client/core/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Auth, AuthToken } from './auth.gen'; 4 + import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen'; 5 + 6 + export type HttpMethod = 7 + | 'connect' 8 + | 'delete' 9 + | 'get' 10 + | 'head' 11 + | 'options' 12 + | 'patch' 13 + | 'post' 14 + | 'put' 15 + | 'trace'; 16 + 17 + export type Client< 18 + RequestFn = never, 19 + Config = unknown, 20 + MethodFn = never, 21 + BuildUrlFn = never, 22 + SseFn = never, 23 + > = { 24 + /** 25 + * Returns the final request URL. 26 + */ 27 + buildUrl: BuildUrlFn; 28 + getConfig: () => Config; 29 + request: RequestFn; 30 + setConfig: (config: Config) => Config; 31 + } & { 32 + [K in HttpMethod]: MethodFn; 33 + } & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }); 34 + 35 + export interface Config { 36 + /** 37 + * Auth token or a function returning auth token. The resolved value will be 38 + * added to the request payload as defined by its `security` array. 39 + */ 40 + auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken; 41 + /** 42 + * A function for serializing request body parameter. By default, 43 + * {@link JSON.stringify()} will be used. 44 + */ 45 + bodySerializer?: BodySerializer | null; 46 + /** 47 + * An object containing any HTTP headers that you want to pre-populate your 48 + * `Headers` object with. 49 + * 50 + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 51 + */ 52 + headers?: 53 + | RequestInit['headers'] 54 + | Record< 55 + string, 56 + string | number | boolean | (string | number | boolean)[] | null | undefined | unknown 57 + >; 58 + /** 59 + * The request method. 60 + * 61 + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} 62 + */ 63 + method?: Uppercase<HttpMethod>; 64 + /** 65 + * A function for serializing request query parameters. By default, arrays 66 + * will be exploded in form style, objects will be exploded in deepObject 67 + * style, and reserved characters are percent-encoded. 68 + * 69 + * This method will have no effect if the native `paramsSerializer()` Axios 70 + * API function is used. 71 + * 72 + * {@link https://swagger.io/docs/specification/serialization/#query View examples} 73 + */ 74 + querySerializer?: QuerySerializer | QuerySerializerOptions; 75 + /** 76 + * A function validating request data. This is useful if you want to ensure 77 + * the request conforms to the desired shape, so it can be safely sent to 78 + * the server. 79 + */ 80 + requestValidator?: (data: unknown) => Promise<unknown>; 81 + /** 82 + * A function transforming response data before it's returned. This is useful 83 + * for post-processing data, e.g. converting ISO strings into Date objects. 84 + */ 85 + responseTransformer?: (data: unknown) => Promise<unknown>; 86 + /** 87 + * A function validating response data. This is useful if you want to ensure 88 + * the response conforms to the desired shape, so it can be safely passed to 89 + * the transformers and returned to the user. 90 + */ 91 + responseValidator?: (data: unknown) => Promise<unknown>; 92 + } 93 + 94 + type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 95 + ? true 96 + : [T] extends [never | undefined] 97 + ? [undefined] extends [T] 98 + ? false 99 + : true 100 + : false; 101 + 102 + export type OmitNever<T extends Record<string, unknown>> = { 103 + [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K]; 104 + };
+140
examples/openapi-ts-nestjs/src/client/core/utils.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; 4 + import { 5 + type ArraySeparatorStyle, 6 + serializeArrayParam, 7 + serializeObjectParam, 8 + serializePrimitiveParam, 9 + } from './pathSerializer.gen'; 10 + 11 + export interface PathSerializer { 12 + path: Record<string, unknown>; 13 + url: string; 14 + } 15 + 16 + export const PATH_PARAM_RE = /\{[^{}]+\}/g; 17 + 18 + export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { 19 + let url = _url; 20 + const matches = _url.match(PATH_PARAM_RE); 21 + if (matches) { 22 + for (const match of matches) { 23 + let explode = false; 24 + let name = match.substring(1, match.length - 1); 25 + let style: ArraySeparatorStyle = 'simple'; 26 + 27 + if (name.endsWith('*')) { 28 + explode = true; 29 + name = name.substring(0, name.length - 1); 30 + } 31 + 32 + if (name.startsWith('.')) { 33 + name = name.substring(1); 34 + style = 'label'; 35 + } else if (name.startsWith(';')) { 36 + name = name.substring(1); 37 + style = 'matrix'; 38 + } 39 + 40 + const value = path[name]; 41 + 42 + if (value === undefined || value === null) { 43 + continue; 44 + } 45 + 46 + if (Array.isArray(value)) { 47 + url = url.replace(match, serializeArrayParam({ explode, name, style, value })); 48 + continue; 49 + } 50 + 51 + if (typeof value === 'object') { 52 + url = url.replace( 53 + match, 54 + serializeObjectParam({ 55 + explode, 56 + name, 57 + style, 58 + value: value as Record<string, unknown>, 59 + valueOnly: true, 60 + }), 61 + ); 62 + continue; 63 + } 64 + 65 + if (style === 'matrix') { 66 + url = url.replace( 67 + match, 68 + `;${serializePrimitiveParam({ 69 + name, 70 + value: value as string, 71 + })}`, 72 + ); 73 + continue; 74 + } 75 + 76 + const replaceValue = encodeURIComponent( 77 + style === 'label' ? `.${value as string}` : (value as string), 78 + ); 79 + url = url.replace(match, replaceValue); 80 + } 81 + } 82 + return url; 83 + }; 84 + 85 + export const getUrl = ({ 86 + baseUrl, 87 + path, 88 + query, 89 + querySerializer, 90 + url: _url, 91 + }: { 92 + baseUrl?: string; 93 + path?: Record<string, unknown>; 94 + query?: Record<string, unknown>; 95 + querySerializer: QuerySerializer; 96 + url: string; 97 + }) => { 98 + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; 99 + let url = (baseUrl ?? '') + pathUrl; 100 + if (path) { 101 + url = defaultPathSerializer({ path, url }); 102 + } 103 + let search = query ? querySerializer(query) : ''; 104 + if (search.startsWith('?')) { 105 + search = search.substring(1); 106 + } 107 + if (search) { 108 + url += `?${search}`; 109 + } 110 + return url; 111 + }; 112 + 113 + export function getValidRequestBody(options: { 114 + body?: unknown; 115 + bodySerializer?: BodySerializer | null; 116 + serializedBody?: unknown; 117 + }) { 118 + const hasBody = options.body !== undefined; 119 + const isSerializedBody = hasBody && options.bodySerializer; 120 + 121 + if (isSerializedBody) { 122 + if ('serializedBody' in options) { 123 + const hasSerializedBody = 124 + options.serializedBody !== undefined && options.serializedBody !== ''; 125 + 126 + return hasSerializedBody ? options.serializedBody : null; 127 + } 128 + 129 + // not all clients implement a serializedBody property (i.e. client-axios) 130 + return options.body !== '' ? options.body : null; 131 + } 132 + 133 + // plain/text body 134 + if (hasBody) { 135 + return options.body; 136 + } 137 + 138 + // no body was provided 139 + return undefined; 140 + }
+14
examples/openapi-ts-nestjs/src/client/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export { createPets, listPets, type Options, showPetById } from './sdk.gen'; 4 + export type { 5 + ClientOptions, 6 + CreatePetsData, 7 + CreatePetsResponses, 8 + ListPetsData, 9 + ListPetsResponse, 10 + ListPetsResponses, 11 + ShowPetByIdData, 12 + ShowPetByIdResponse, 13 + ShowPetByIdResponses, 14 + } from './types.gen';
+14
examples/openapi-ts-nestjs/src/client/nestjs.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { 4 + ListPetsData, 5 + ListPetsResponse, 6 + ShowPetByIdData, 7 + ShowPetByIdResponse, 8 + } from './types.gen'; 9 + 10 + export type ControllerMethods = { 11 + createPets: () => Promise<void>; 12 + listPets: (query?: ListPetsData['query']) => Promise<ListPetsResponse>; 13 + showPetById: (path: ShowPetByIdData['path']) => Promise<ShowPetByIdResponse>; 14 + };
+62
examples/openapi-ts-nestjs/src/client/sdk.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { Client, Options as Options2, TDataShape } from './client'; 4 + import { client } from './client.gen'; 5 + import type { 6 + CreatePetsData, 7 + CreatePetsResponses, 8 + ListPetsData, 9 + ListPetsResponses, 10 + ShowPetByIdData, 11 + ShowPetByIdResponses, 12 + } from './types.gen'; 13 + 14 + export type Options< 15 + TData extends TDataShape = TDataShape, 16 + ThrowOnError extends boolean = boolean, 17 + > = Options2<TData, ThrowOnError> & { 18 + /** 19 + * You can provide a client instance returned by `createClient()` instead of 20 + * individual options. This might be also useful if you want to implement a 21 + * custom client. 22 + */ 23 + client?: Client; 24 + /** 25 + * You can pass arbitrary values through the `meta` object. This can be 26 + * used to access values that aren't defined as part of the SDK function. 27 + */ 28 + meta?: Record<string, unknown>; 29 + }; 30 + 31 + /** 32 + * Find pet by ID 33 + */ 34 + export const showPetById = <ThrowOnError extends boolean = false>( 35 + options: Options<ShowPetByIdData, ThrowOnError>, 36 + ) => 37 + (options.client ?? client).get<ShowPetByIdResponses, unknown, ThrowOnError>({ 38 + url: '/pets/{petId}', 39 + ...options, 40 + }); 41 + 42 + /** 43 + * List all pets 44 + */ 45 + export const listPets = <ThrowOnError extends boolean = false>( 46 + options?: Options<ListPetsData, ThrowOnError>, 47 + ) => 48 + (options?.client ?? client).get<ListPetsResponses, unknown, ThrowOnError>({ 49 + url: '/pets', 50 + ...options, 51 + }); 52 + 53 + /** 54 + * Create a pet 55 + */ 56 + export const createPets = <ThrowOnError extends boolean = false>( 57 + options?: Options<CreatePetsData, ThrowOnError>, 58 + ) => 59 + (options?.client ?? client).post<CreatePetsResponses, unknown, ThrowOnError>({ 60 + url: '/pets', 61 + ...options, 62 + });
+61
examples/openapi-ts-nestjs/src/client/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/v3' | (string & {}); 5 + }; 6 + 7 + export type ShowPetByIdData = { 8 + body?: never; 9 + path: { 10 + petId: string; 11 + }; 12 + query?: never; 13 + url: '/pets/{petId}'; 14 + }; 15 + 16 + export type ShowPetByIdResponses = { 17 + /** 18 + * Pet found 19 + */ 20 + 200: { 21 + id?: string; 22 + name?: string; 23 + }; 24 + }; 25 + 26 + export type ShowPetByIdResponse = ShowPetByIdResponses[keyof ShowPetByIdResponses]; 27 + 28 + export type ListPetsData = { 29 + body?: never; 30 + path?: never; 31 + query?: { 32 + limit?: number; 33 + }; 34 + url: '/pets'; 35 + }; 36 + 37 + export type ListPetsResponses = { 38 + /** 39 + * A list of pets 40 + */ 41 + 200: Array<{ 42 + id?: string; 43 + name?: string; 44 + }>; 45 + }; 46 + 47 + export type ListPetsResponse = ListPetsResponses[keyof ListPetsResponses]; 48 + 49 + export type CreatePetsData = { 50 + body?: never; 51 + path?: never; 52 + query?: never; 53 + url: '/pets'; 54 + }; 55 + 56 + export type CreatePetsResponses = { 57 + /** 58 + * Pet created 59 + */ 60 + 201: unknown; 61 + };
+17
examples/openapi-ts-nestjs/src/main.ts
··· 1 + import 'reflect-metadata'; 2 + 3 + import { NestFactory } from '@nestjs/core'; 4 + 5 + import { AppModule } from './app.module'; 6 + 7 + export const buildApp = async () => { 8 + const app = await NestFactory.create(AppModule); 9 + return app; 10 + }; 11 + 12 + buildApp().then((app) => { 13 + app.listen(3000).catch((err) => { 14 + console.error(err); 15 + process.exit(1); 16 + }); 17 + });
+32
examples/openapi-ts-nestjs/src/pets/pets.controller.ts
··· 1 + import { Controller, Get, Param, Post, Query } from '@nestjs/common'; 2 + 3 + import type { ControllerMethods } from '../client/nestjs.gen'; 4 + import type { ListPetsData, ShowPetByIdData } from '../client/types.gen'; 5 + 6 + @Controller('pets') 7 + export class PetsController implements Pick< 8 + ControllerMethods, 9 + 'listPets' | 'createPets' | 'showPetById' 10 + > { 11 + @Get() 12 + async listPets(@Query() query?: ListPetsData['query']) { 13 + const pets = [ 14 + { id: '1', name: 'Fido' }, 15 + { id: '2', name: 'Kitty' }, 16 + ]; 17 + return query?.limit ? pets.slice(0, query.limit) : pets; 18 + } 19 + 20 + @Post() 21 + async createPets() { 22 + return; 23 + } 24 + 25 + @Get(':petId') 26 + async showPetById(@Param() path: ShowPetByIdData['path']) { 27 + return { 28 + id: Number(path.petId), 29 + name: 'Kitty', 30 + }; 31 + } 32 + }
+37
examples/openapi-ts-nestjs/test/pets.test.ts
··· 1 + import type { INestApplication } from '@nestjs/common'; 2 + import { Test } from '@nestjs/testing'; 3 + import { AppModule } from 'src/app.module'; 4 + import { showPetById } from 'src/client'; 5 + import { client } from 'src/client/client.gen'; 6 + 7 + describe('PetsController', () => { 8 + let app: INestApplication; 9 + 10 + beforeAll(async () => { 11 + const moduleRef = await Test.createTestingModule({ 12 + imports: [AppModule], 13 + }).compile(); 14 + 15 + app = moduleRef.createNestApplication(); 16 + await app.init(); 17 + await app.listen(0); 18 + 19 + const address = app.getHttpServer().address(); 20 + const baseUrl = `http://localhost:${address.port}`; 21 + client.setConfig({ baseUrl }); 22 + }); 23 + 24 + afterAll(async () => { 25 + await app.close(); 26 + }); 27 + 28 + test('showPetById', async () => { 29 + const result = await showPetById({ 30 + client, 31 + path: { 32 + petId: '123', 33 + }, 34 + }); 35 + expect(result.response.status).toBe(200); 36 + }); 37 + });
+17
examples/openapi-ts-nestjs/tsconfig.json
··· 1 + { 2 + "include": ["src/**/*", "test/**/*"], 3 + "compilerOptions": { 4 + "baseUrl": ".", 5 + "emitDecoratorMetadata": true, 6 + "esModuleInterop": true, 7 + "experimentalDecorators": true, 8 + "lib": ["es2023", "dom", "dom.iterable"], 9 + "module": "ESNext", 10 + "moduleResolution": "Bundler", 11 + "skipLibCheck": true, 12 + "strict": true, 13 + "target": "es2022", 14 + "types": ["vitest/globals"] 15 + }, 16 + "references": [{ "path": "./tsconfig.node.json" }] 17 + }
+11
examples/openapi-ts-nestjs/tsconfig.node.json
··· 1 + { 2 + "compilerOptions": { 3 + "composite": true, 4 + "skipLibCheck": true, 5 + "module": "ESNext", 6 + "moduleResolution": "bundler", 7 + "allowSyntheticDefaultImports": true, 8 + "strict": true 9 + }, 10 + "include": ["vite.config.ts"] 11 + }
+13
examples/openapi-ts-nestjs/vite.config.ts
··· 1 + import { defineProject } from 'vitest/config'; 2 + 3 + export default defineProject({ 4 + resolve: { 5 + alias: { 6 + src: new URL('./src', import.meta.url).pathname, 7 + }, 8 + }, 9 + test: { 10 + environment: 'node', 11 + include: ['test/**/*.test.ts'], 12 + }, 13 + });
+3
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/nestjs/default/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, Date, Default, DeleteCallWithoutParametersAndResponseData, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponses, DummyBData, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithStrings, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, FailureFailure, FooWowData, FooWowResponses, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, ModelThatExtends, ModelThatExtendsExtends, ModelWithArray, ModelWithBoolean, ModelWithCircularReference, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithInteger, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableString, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, OptionsCallWithoutParametersAndResponseData, ParameterActivityParams, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionBodyData, PostApiVbyApiVersionBodyError, PostApiVbyApiVersionBodyErrors, PostApiVbyApiVersionBodyResponse, PostApiVbyApiVersionBodyResponses, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, ResponsePostActivityResponse, ServiceWithEmptyTagData, SimpleBoolean, SimpleFile, SimpleInteger, SimpleReference, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses } from './types.gen';
+40
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/nestjs/default/nestjs.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesResponse, CallWithParametersData, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithResponsesResponse, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexTypesData, ComplexTypesResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PostApiVbyApiVersionBodyData, PostApiVbyApiVersionBodyResponse, TestErrorCodeData, TypesData, TypesResponse } from './types.gen'; 4 + 5 + export type ControllerMethods = { 6 + serviceWithEmptyTag: () => Promise<void>; 7 + patchApiVbyApiVersionNoTag: () => Promise<void>; 8 + fooWow: () => Promise<void>; 9 + deleteCallWithoutParametersAndResponse: () => Promise<void>; 10 + getCallWithoutParametersAndResponse: () => Promise<void>; 11 + headCallWithoutParametersAndResponse: () => Promise<void>; 12 + optionsCallWithoutParametersAndResponse: () => Promise<void>; 13 + patchCallWithoutParametersAndResponse: () => Promise<void>; 14 + postCallWithoutParametersAndResponse: () => Promise<void>; 15 + putCallWithoutParametersAndResponse: () => Promise<void>; 16 + callWithDescriptions: (query?: CallWithDescriptionsData['query']) => Promise<void>; 17 + callWithParameters: (path: CallWithParametersData['path'], query: CallWithParametersData['query'], headers: CallWithParametersData['headers']) => Promise<void>; 18 + callWithWeirdParameterNames: (path: CallWithWeirdParameterNamesData['path'], query: CallWithWeirdParameterNamesData['query'], body: CallWithWeirdParameterNamesData['body'], headers: CallWithWeirdParameterNamesData['headers']) => Promise<void>; 19 + callWithDefaultParameters: (query: CallWithDefaultParametersData['query']) => Promise<void>; 20 + callWithDefaultOptionalParameters: (query?: CallWithDefaultOptionalParametersData['query']) => Promise<void>; 21 + callToTestOrderOfParams: (query: CallToTestOrderOfParamsData['query']) => Promise<void>; 22 + duplicateName: () => Promise<void>; 23 + duplicateName2: () => Promise<void>; 24 + duplicateName3: () => Promise<void>; 25 + duplicateName4: () => Promise<void>; 26 + callWithNoContentResponse: () => Promise<void>; 27 + callWithResponseAndNoContentResponse: () => Promise<CallWithResponseAndNoContentResponseResponse>; 28 + dummyA: () => Promise<void>; 29 + dummyB: () => Promise<void>; 30 + callWithResponse: () => Promise<CallWithResponseResponse>; 31 + callWithDuplicateResponses: () => Promise<CallWithDuplicateResponsesResponse>; 32 + callWithResponses: () => Promise<CallWithResponsesResponse>; 33 + collectionFormat: (query: CollectionFormatData['query']) => Promise<void>; 34 + types: (query: TypesData['query'], path?: TypesData['path']) => Promise<TypesResponse>; 35 + complexTypes: (query: ComplexTypesData['query']) => Promise<ComplexTypesResponse>; 36 + callWithResultFromHeader: () => Promise<void>; 37 + testErrorCode: (query: TestErrorCodeData['query']) => Promise<void>; 38 + nonAsciiæøåÆøÅöôêÊ字符串: (query: NonAsciiæøåÆøÅöôêÊ字符串Data['query']) => Promise<NonAsciiæøåÆøÅöôêÊ字符串Response>; 39 + postApiVbyApiVersionBody: (body: PostApiVbyApiVersionBodyData['body']) => Promise<PostApiVbyApiVersionBodyResponse>; 40 + };
+1188
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/nestjs/default/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + export type ExternalRefA = ExternalSharedExternalSharedModel; 8 + 9 + export type ExternalRefB = ExternalSharedExternalSharedModel; 10 + 11 + /** 12 + * Testing multiline comments in string: First line 13 + * Second line 14 + * 15 + * Fourth line 16 + */ 17 + export type CommentWithBreaks = number; 18 + 19 + /** 20 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 21 + */ 22 + export type CommentWithBackticks = number; 23 + 24 + /** 25 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 26 + */ 27 + export type CommentWithBackticksAndQuotes = number; 28 + 29 + /** 30 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 31 + */ 32 + export type CommentWithSlashes = number; 33 + 34 + /** 35 + * Testing expression placeholders in string: ${expression} should work 36 + */ 37 + export type CommentWithExpressionPlaceholders = number; 38 + 39 + /** 40 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 41 + */ 42 + export type CommentWithQuotes = number; 43 + 44 + /** 45 + * Testing reserved characters in string: * inline * and ** inline ** should work 46 + */ 47 + export type CommentWithReservedCharacters = number; 48 + 49 + /** 50 + * This is a simple number 51 + */ 52 + export type SimpleInteger = number; 53 + 54 + /** 55 + * This is a simple boolean 56 + */ 57 + export type SimpleBoolean = boolean; 58 + 59 + /** 60 + * This is a simple string 61 + */ 62 + export type SimpleString = string; 63 + 64 + /** 65 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 66 + */ 67 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 68 + 69 + /** 70 + * This is a simple file 71 + */ 72 + export type SimpleFile = Blob | File; 73 + 74 + export type SimpleReference = ModelWithString; 75 + 76 + /** 77 + * This is a simple string 78 + */ 79 + export type SimpleStringWithPattern = string; 80 + 81 + /** 82 + * This is a simple enum with strings 83 + */ 84 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 85 + 86 + /** 87 + * This is a simple enum with numbers 88 + */ 89 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 90 + 91 + /** 92 + * Success=1,Warning=2,Error=3 93 + */ 94 + export type EnumFromDescription = number; 95 + 96 + /** 97 + * This is a simple enum with numbers 98 + */ 99 + export type EnumWithExtensions = 200 | 400 | 500; 100 + 101 + /** 102 + * This is a simple array with numbers 103 + */ 104 + export type ArrayWithNumbers = Array<number>; 105 + 106 + /** 107 + * This is a simple array with booleans 108 + */ 109 + export type ArrayWithBooleans = Array<boolean>; 110 + 111 + /** 112 + * This is a simple array with strings 113 + */ 114 + export type ArrayWithStrings = Array<string>; 115 + 116 + /** 117 + * This is a simple array with references 118 + */ 119 + export type ArrayWithReferences = Array<ModelWithString>; 120 + 121 + /** 122 + * This is a simple array containing an array 123 + */ 124 + export type ArrayWithArray = Array<Array<ModelWithString>>; 125 + 126 + /** 127 + * This is a simple array with properties 128 + */ 129 + export type ArrayWithProperties = Array<{ 130 + foo?: string; 131 + bar?: string; 132 + }>; 133 + 134 + /** 135 + * This is a string dictionary 136 + */ 137 + export type DictionaryWithString = { 138 + [key: string]: string; 139 + }; 140 + 141 + /** 142 + * This is a string reference 143 + */ 144 + export type DictionaryWithReference = { 145 + [key: string]: ModelWithString; 146 + }; 147 + 148 + /** 149 + * This is a complex dictionary 150 + */ 151 + export type DictionaryWithArray = { 152 + [key: string]: Array<ModelWithString>; 153 + }; 154 + 155 + /** 156 + * This is a string dictionary 157 + */ 158 + export type DictionaryWithDictionary = { 159 + [key: string]: { 160 + [key: string]: string; 161 + }; 162 + }; 163 + 164 + /** 165 + * This is a complex dictionary 166 + */ 167 + export type DictionaryWithProperties = { 168 + [key: string]: { 169 + foo?: string; 170 + bar?: string; 171 + }; 172 + }; 173 + 174 + /** 175 + * This is a type-only model that defines Date as a string 176 + */ 177 + export type Date = string; 178 + 179 + /** 180 + * This is a model with one number property 181 + */ 182 + export type ModelWithInteger = { 183 + /** 184 + * This is a simple number property 185 + */ 186 + prop?: number; 187 + }; 188 + 189 + /** 190 + * This is a model with one boolean property 191 + */ 192 + export type ModelWithBoolean = { 193 + /** 194 + * This is a simple boolean property 195 + */ 196 + prop?: boolean; 197 + }; 198 + 199 + /** 200 + * This is a model with one string property 201 + */ 202 + export type ModelWithString = { 203 + /** 204 + * This is a simple string property 205 + */ 206 + prop?: string; 207 + }; 208 + 209 + /** 210 + * This is a model with one string property 211 + */ 212 + export type ModelWithStringError = { 213 + /** 214 + * This is a simple string property 215 + */ 216 + prop?: string; 217 + }; 218 + 219 + /** 220 + * This is a model with one string property 221 + */ 222 + export type ModelWithNullableString = { 223 + /** 224 + * This is a simple string property 225 + */ 226 + nullableProp?: string | null; 227 + /** 228 + * This is a simple string property 229 + */ 230 + nullableRequiredProp: string | null; 231 + }; 232 + 233 + /** 234 + * This is a model with one enum 235 + */ 236 + export type ModelWithEnum = { 237 + /** 238 + * This is a simple enum with strings 239 + */ 240 + test?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 241 + /** 242 + * These are the HTTP error code enums 243 + */ 244 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 245 + /** 246 + * Simple boolean enum 247 + */ 248 + bool?: true; 249 + }; 250 + 251 + /** 252 + * This is a model with one enum 253 + */ 254 + export type ModelWithEnumFromDescription = { 255 + /** 256 + * Success=1,Warning=2,Error=3 257 + */ 258 + test?: number; 259 + }; 260 + 261 + /** 262 + * This is a model with nested enums 263 + */ 264 + export type ModelWithNestedEnums = { 265 + dictionaryWithEnum?: { 266 + [key: string]: 'Success' | 'Warning' | 'Error'; 267 + }; 268 + dictionaryWithEnumFromDescription?: { 269 + [key: string]: number; 270 + }; 271 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 272 + arrayWithDescription?: Array<number>; 273 + }; 274 + 275 + /** 276 + * This is a model with one property containing a reference 277 + */ 278 + export type ModelWithReference = { 279 + prop?: ModelWithProperties; 280 + }; 281 + 282 + /** 283 + * This is a model with one property containing an array 284 + */ 285 + export type ModelWithArray = { 286 + prop?: Array<ModelWithString>; 287 + propWithFile?: Array<Blob | File>; 288 + propWithNumber?: Array<number>; 289 + }; 290 + 291 + /** 292 + * This is a model with one property containing a dictionary 293 + */ 294 + export type ModelWithDictionary = { 295 + prop?: { 296 + [key: string]: string; 297 + }; 298 + }; 299 + 300 + /** 301 + * This is a model with one property containing a circular reference 302 + */ 303 + export type ModelWithCircularReference = { 304 + prop?: ModelWithCircularReference; 305 + }; 306 + 307 + /** 308 + * This is a model with one nested property 309 + */ 310 + export type ModelWithProperties = { 311 + required: string; 312 + readonly requiredAndReadOnly: string; 313 + string?: string; 314 + number?: number; 315 + boolean?: boolean; 316 + reference?: ModelWithString; 317 + 'property with space'?: string; 318 + default?: string; 319 + try?: string; 320 + readonly '@namespace.string'?: string; 321 + readonly '@namespace.integer'?: number; 322 + }; 323 + 324 + /** 325 + * This is a model with one nested property 326 + */ 327 + export type ModelWithNestedProperties = { 328 + readonly first: { 329 + readonly second: { 330 + readonly third: string; 331 + }; 332 + }; 333 + }; 334 + 335 + /** 336 + * This is a model with duplicated properties 337 + */ 338 + export type ModelWithDuplicateProperties = { 339 + prop?: ModelWithString; 340 + }; 341 + 342 + /** 343 + * This is a model with ordered properties 344 + */ 345 + export type ModelWithOrderedProperties = { 346 + zebra?: string; 347 + apple?: string; 348 + hawaii?: string; 349 + }; 350 + 351 + /** 352 + * This is a model with duplicated imports 353 + */ 354 + export type ModelWithDuplicateImports = { 355 + propA?: ModelWithString; 356 + propB?: ModelWithString; 357 + propC?: ModelWithString; 358 + }; 359 + 360 + /** 361 + * This is a model that extends another model 362 + */ 363 + export type ModelThatExtends = ModelWithString & { 364 + propExtendsA?: string; 365 + propExtendsB?: ModelWithString; 366 + }; 367 + 368 + /** 369 + * This is a model that extends another model 370 + */ 371 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 372 + propExtendsC?: string; 373 + propExtendsD?: ModelWithString; 374 + }; 375 + 376 + export type Default = { 377 + name?: string; 378 + }; 379 + 380 + /** 381 + * This is a model that contains a some patterns 382 + */ 383 + export type ModelWithPattern = { 384 + key: string; 385 + name: string; 386 + readonly enabled?: boolean; 387 + readonly modified?: string; 388 + id?: string; 389 + text?: string; 390 + patternWithSingleQuotes?: string; 391 + patternWithNewline?: string; 392 + patternWithBacktick?: string; 393 + }; 394 + 395 + export type ParameterActivityParams = { 396 + description?: string; 397 + graduate_id?: number; 398 + organization_id?: number; 399 + parent_activity?: number; 400 + post_id?: number; 401 + }; 402 + 403 + export type ResponsePostActivityResponse = { 404 + description?: string; 405 + graduate_id?: number; 406 + organization_id?: number; 407 + parent_activity_id?: number; 408 + post_id?: number; 409 + }; 410 + 411 + export type FailureFailure = { 412 + error?: string; 413 + message?: string; 414 + reference_code?: string; 415 + }; 416 + 417 + export type ExternalSharedExternalSharedModel = { 418 + id: string; 419 + name?: string; 420 + }; 421 + 422 + /** 423 + * This is a model with one property containing a reference 424 + */ 425 + export type ModelWithReferenceWritable = { 426 + prop?: ModelWithPropertiesWritable; 427 + }; 428 + 429 + /** 430 + * This is a model with one nested property 431 + */ 432 + export type ModelWithPropertiesWritable = { 433 + required: string; 434 + string?: string; 435 + number?: number; 436 + boolean?: boolean; 437 + reference?: ModelWithString; 438 + 'property with space'?: string; 439 + default?: string; 440 + try?: string; 441 + }; 442 + 443 + /** 444 + * This is a model that contains a some patterns 445 + */ 446 + export type ModelWithPatternWritable = { 447 + key: string; 448 + name: string; 449 + id?: string; 450 + text?: string; 451 + patternWithSingleQuotes?: string; 452 + patternWithNewline?: string; 453 + patternWithBacktick?: string; 454 + }; 455 + 456 + export type ServiceWithEmptyTagData = { 457 + body?: never; 458 + path?: never; 459 + query?: never; 460 + url: '/api/v{api-version}/no+tag'; 461 + }; 462 + 463 + export type PatchApiVbyApiVersionNoTagData = { 464 + body?: never; 465 + path?: never; 466 + query?: never; 467 + url: '/api/v{api-version}/no+tag'; 468 + }; 469 + 470 + export type PatchApiVbyApiVersionNoTagResponses = { 471 + /** 472 + * OK 473 + */ 474 + default: unknown; 475 + }; 476 + 477 + export type FooWowData = { 478 + body?: never; 479 + path?: never; 480 + query?: never; 481 + url: '/api/v{api-version}/no+tag'; 482 + }; 483 + 484 + export type FooWowResponses = { 485 + /** 486 + * OK 487 + */ 488 + default: unknown; 489 + }; 490 + 491 + export type DeleteCallWithoutParametersAndResponseData = { 492 + body?: never; 493 + path?: never; 494 + query?: never; 495 + url: '/api/v{api-version}/simple'; 496 + }; 497 + 498 + export type GetCallWithoutParametersAndResponseData = { 499 + body?: never; 500 + path?: never; 501 + query?: never; 502 + url: '/api/v{api-version}/simple'; 503 + }; 504 + 505 + export type HeadCallWithoutParametersAndResponseData = { 506 + body?: never; 507 + path?: never; 508 + query?: never; 509 + url: '/api/v{api-version}/simple'; 510 + }; 511 + 512 + export type OptionsCallWithoutParametersAndResponseData = { 513 + body?: never; 514 + path?: never; 515 + query?: never; 516 + url: '/api/v{api-version}/simple'; 517 + }; 518 + 519 + export type PatchCallWithoutParametersAndResponseData = { 520 + body?: never; 521 + path?: never; 522 + query?: never; 523 + url: '/api/v{api-version}/simple'; 524 + }; 525 + 526 + export type PostCallWithoutParametersAndResponseData = { 527 + body?: never; 528 + path?: never; 529 + query?: never; 530 + url: '/api/v{api-version}/simple'; 531 + }; 532 + 533 + export type PutCallWithoutParametersAndResponseData = { 534 + body?: never; 535 + path?: never; 536 + query?: never; 537 + url: '/api/v{api-version}/simple'; 538 + }; 539 + 540 + export type CallWithDescriptionsData = { 541 + body?: never; 542 + path?: never; 543 + query?: { 544 + /** 545 + * Testing multiline comments in string: First line 546 + * Second line 547 + * 548 + * Fourth line 549 + */ 550 + parameterWithBreaks?: string; 551 + /** 552 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 553 + */ 554 + parameterWithBackticks?: string; 555 + /** 556 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 557 + */ 558 + parameterWithSlashes?: string; 559 + /** 560 + * Testing expression placeholders in string: ${expression} should work 561 + */ 562 + parameterWithExpressionPlaceholders?: string; 563 + /** 564 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 565 + */ 566 + parameterWithQuotes?: string; 567 + /** 568 + * Testing reserved characters in string: * inline * and ** inline ** should work 569 + */ 570 + parameterWithReservedCharacters?: string; 571 + }; 572 + url: '/api/v{api-version}/descriptions/'; 573 + }; 574 + 575 + export type CallWithParametersData = { 576 + body?: never; 577 + headers: { 578 + /** 579 + * This is the parameter that goes into the header 580 + */ 581 + parameterHeader: string; 582 + }; 583 + path: { 584 + /** 585 + * This is the parameter that goes into the path 586 + */ 587 + parameterPath: string; 588 + /** 589 + * api-version should be required in standalone clients 590 + */ 591 + 'api-version': string; 592 + }; 593 + query: { 594 + /** 595 + * This is the parameter that goes into the query params 596 + */ 597 + parameterQuery: string; 598 + }; 599 + url: '/api/v{api-version}/parameters/{parameterPath}'; 600 + }; 601 + 602 + export type CallWithWeirdParameterNamesData = { 603 + /** 604 + * This is the parameter that is sent as request body 605 + */ 606 + body: string; 607 + headers: { 608 + /** 609 + * This is the parameter that goes into the request header 610 + */ 611 + 'parameter.header': string; 612 + }; 613 + path: { 614 + /** 615 + * This is the parameter that goes into the path 616 + */ 617 + 'parameter.path.1'?: string; 618 + /** 619 + * This is the parameter that goes into the path 620 + */ 621 + 'parameter-path-2'?: string; 622 + /** 623 + * This is the parameter that goes into the path 624 + */ 625 + 'PARAMETER-PATH-3'?: string; 626 + /** 627 + * api-version should be required in standalone clients 628 + */ 629 + 'api-version': string; 630 + }; 631 + query: { 632 + /** 633 + * This is the parameter with a reserved keyword 634 + */ 635 + default?: string; 636 + /** 637 + * This is the parameter that goes into the request query params 638 + */ 639 + 'parameter-query': string; 640 + }; 641 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 642 + }; 643 + 644 + export type CallWithDefaultParametersData = { 645 + body?: never; 646 + path?: never; 647 + query: { 648 + /** 649 + * This is a simple string with default value 650 + */ 651 + parameterString: string; 652 + /** 653 + * This is a simple number with default value 654 + */ 655 + parameterNumber: number; 656 + /** 657 + * This is a simple boolean with default value 658 + */ 659 + parameterBoolean: boolean; 660 + /** 661 + * This is a simple enum with default value 662 + */ 663 + parameterEnum: 'Success' | 'Warning' | 'Error'; 664 + /** 665 + * This is a model with one string property 666 + */ 667 + parameterModel: { 668 + /** 669 + * This is a simple string property 670 + */ 671 + prop?: string; 672 + }; 673 + }; 674 + url: '/api/v{api-version}/defaults'; 675 + }; 676 + 677 + export type CallWithDefaultOptionalParametersData = { 678 + body?: never; 679 + path?: never; 680 + query?: { 681 + /** 682 + * This is a simple string that is optional with default value 683 + */ 684 + parameterString?: string; 685 + /** 686 + * This is a simple number that is optional with default value 687 + */ 688 + parameterNumber?: number; 689 + /** 690 + * This is a simple boolean that is optional with default value 691 + */ 692 + parameterBoolean?: boolean; 693 + /** 694 + * This is a simple enum that is optional with default value 695 + */ 696 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 697 + }; 698 + url: '/api/v{api-version}/defaults'; 699 + }; 700 + 701 + export type CallToTestOrderOfParamsData = { 702 + body?: never; 703 + path?: never; 704 + query: { 705 + /** 706 + * This is a optional string with default 707 + */ 708 + parameterOptionalStringWithDefault?: string; 709 + /** 710 + * This is a optional string with empty default 711 + */ 712 + parameterOptionalStringWithEmptyDefault?: string; 713 + /** 714 + * This is a optional string with no default 715 + */ 716 + parameterOptionalStringWithNoDefault?: string; 717 + /** 718 + * This is a string with default 719 + */ 720 + parameterStringWithDefault: string; 721 + /** 722 + * This is a string with empty default 723 + */ 724 + parameterStringWithEmptyDefault: string; 725 + /** 726 + * This is a string with no default 727 + */ 728 + parameterStringWithNoDefault: string; 729 + /** 730 + * This is a string that can be null with no default 731 + */ 732 + parameterStringNullableWithNoDefault?: string | null; 733 + /** 734 + * This is a string that can be null with default 735 + */ 736 + parameterStringNullableWithDefault?: string | null; 737 + }; 738 + url: '/api/v{api-version}/defaults'; 739 + }; 740 + 741 + export type DuplicateNameData = { 742 + body?: never; 743 + path?: never; 744 + query?: never; 745 + url: '/api/v{api-version}/duplicate'; 746 + }; 747 + 748 + export type DuplicateName2Data = { 749 + body?: never; 750 + path?: never; 751 + query?: never; 752 + url: '/api/v{api-version}/duplicate'; 753 + }; 754 + 755 + export type DuplicateName3Data = { 756 + body?: never; 757 + path?: never; 758 + query?: never; 759 + url: '/api/v{api-version}/duplicate'; 760 + }; 761 + 762 + export type DuplicateName4Data = { 763 + body?: never; 764 + path?: never; 765 + query?: never; 766 + url: '/api/v{api-version}/duplicate'; 767 + }; 768 + 769 + export type CallWithNoContentResponseData = { 770 + body?: never; 771 + path?: never; 772 + query?: never; 773 + url: '/api/v{api-version}/no-content'; 774 + }; 775 + 776 + export type CallWithNoContentResponseResponses = { 777 + /** 778 + * Success 779 + */ 780 + 204: unknown; 781 + }; 782 + 783 + export type CallWithResponseAndNoContentResponseData = { 784 + body?: never; 785 + path?: never; 786 + query?: never; 787 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 788 + }; 789 + 790 + export type CallWithResponseAndNoContentResponseResponses = { 791 + /** 792 + * Response is a simple number 793 + */ 794 + 200: number; 795 + /** 796 + * Success 797 + */ 798 + 204: unknown; 799 + }; 800 + 801 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 802 + 803 + export type DummyAData = { 804 + body?: never; 805 + path?: never; 806 + query?: never; 807 + url: '/api/v{api-version}/multiple-tags/a'; 808 + }; 809 + 810 + export type DummyAResponses = { 811 + /** 812 + * Success 813 + */ 814 + 204: unknown; 815 + }; 816 + 817 + export type DummyBData = { 818 + body?: never; 819 + path?: never; 820 + query?: never; 821 + url: '/api/v{api-version}/multiple-tags/b'; 822 + }; 823 + 824 + export type DummyBResponses = { 825 + /** 826 + * Success 827 + */ 828 + 204: unknown; 829 + }; 830 + 831 + export type CallWithResponseData = { 832 + body?: never; 833 + path?: never; 834 + query?: never; 835 + url: '/api/v{api-version}/response'; 836 + }; 837 + 838 + export type CallWithResponseResponses = { 839 + /** 840 + * Message for default response 841 + */ 842 + default: ModelWithString; 843 + }; 844 + 845 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 846 + 847 + export type CallWithDuplicateResponsesData = { 848 + body?: never; 849 + path?: never; 850 + query?: never; 851 + url: '/api/v{api-version}/response'; 852 + }; 853 + 854 + export type CallWithDuplicateResponsesErrors = { 855 + /** 856 + * Message for 500 error 857 + */ 858 + 500: ModelWithStringError; 859 + /** 860 + * Message for 501 error 861 + */ 862 + 501: ModelWithStringError; 863 + /** 864 + * Message for 502 error 865 + */ 866 + 502: ModelWithStringError; 867 + /** 868 + * Message for default response 869 + */ 870 + default: ModelWithString; 871 + }; 872 + 873 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 874 + 875 + export type CallWithDuplicateResponsesResponses = { 876 + /** 877 + * Message for 201 response 878 + */ 879 + 201: ModelWithString; 880 + /** 881 + * Message for 202 response 882 + */ 883 + 202: ModelWithString; 884 + }; 885 + 886 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 887 + 888 + export type CallWithResponsesData = { 889 + body?: never; 890 + path?: never; 891 + query?: never; 892 + url: '/api/v{api-version}/response'; 893 + }; 894 + 895 + export type CallWithResponsesErrors = { 896 + /** 897 + * Message for 500 error 898 + */ 899 + 500: ModelWithStringError; 900 + /** 901 + * Message for 501 error 902 + */ 903 + 501: ModelWithStringError; 904 + /** 905 + * Message for 502 error 906 + */ 907 + 502: ModelWithStringError; 908 + /** 909 + * Message for default response 910 + */ 911 + default: ModelWithString; 912 + }; 913 + 914 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 915 + 916 + export type CallWithResponsesResponses = { 917 + /** 918 + * Message for 200 response 919 + */ 920 + 200: { 921 + readonly '@namespace.string'?: string; 922 + readonly '@namespace.integer'?: number; 923 + readonly value?: Array<ModelWithString>; 924 + }; 925 + /** 926 + * Message for 201 response 927 + */ 928 + 201: ModelThatExtends; 929 + /** 930 + * Message for 202 response 931 + */ 932 + 202: ModelThatExtendsExtends; 933 + }; 934 + 935 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 936 + 937 + export type CollectionFormatData = { 938 + body?: never; 939 + path?: never; 940 + query: { 941 + /** 942 + * This is an array parameter that is sent as csv format (comma-separated values) 943 + */ 944 + parameterArrayCSV: Array<string>; 945 + /** 946 + * This is an array parameter that is sent as ssv format (space-separated values) 947 + */ 948 + parameterArraySSV: Array<string>; 949 + /** 950 + * This is an array parameter that is sent as tsv format (tab-separated values) 951 + */ 952 + parameterArrayTSV: Array<string>; 953 + /** 954 + * This is an array parameter that is sent as pipes format (pipe-separated values) 955 + */ 956 + parameterArrayPipes: Array<string>; 957 + /** 958 + * This is an array parameter that is sent as multi format (multiple parameter instances) 959 + */ 960 + parameterArrayMulti: Array<string>; 961 + }; 962 + url: '/api/v{api-version}/collectionFormat'; 963 + }; 964 + 965 + export type TypesData = { 966 + body?: never; 967 + path?: { 968 + /** 969 + * This is a number parameter 970 + */ 971 + id?: number; 972 + }; 973 + query: { 974 + /** 975 + * This is a number parameter 976 + */ 977 + parameterNumber: number; 978 + /** 979 + * This is a string parameter 980 + */ 981 + parameterString: string; 982 + /** 983 + * This is a boolean parameter 984 + */ 985 + parameterBoolean: boolean; 986 + /** 987 + * This is an array parameter 988 + */ 989 + parameterArray: Array<string>; 990 + /** 991 + * This is a dictionary parameter 992 + */ 993 + parameterDictionary: { 994 + [key: string]: unknown; 995 + }; 996 + /** 997 + * This is an enum parameter 998 + */ 999 + parameterEnum: 'Success' | 'Warning' | 'Error'; 1000 + }; 1001 + url: '/api/v{api-version}/types'; 1002 + }; 1003 + 1004 + export type TypesResponses = { 1005 + /** 1006 + * Response is a simple number 1007 + */ 1008 + 200: number; 1009 + /** 1010 + * Response is a simple string 1011 + */ 1012 + 201: string; 1013 + /** 1014 + * Response is a simple boolean 1015 + */ 1016 + 202: boolean; 1017 + /** 1018 + * Response is a simple object 1019 + */ 1020 + 203: { 1021 + [key: string]: unknown; 1022 + }; 1023 + }; 1024 + 1025 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1026 + 1027 + export type ComplexTypesData = { 1028 + body?: never; 1029 + path?: never; 1030 + query: { 1031 + /** 1032 + * Parameter containing object 1033 + */ 1034 + parameterObject: { 1035 + first?: { 1036 + second?: { 1037 + third?: string; 1038 + }; 1039 + }; 1040 + }; 1041 + /** 1042 + * This is a model with one string property 1043 + */ 1044 + parameterReference: { 1045 + /** 1046 + * This is a simple string property 1047 + */ 1048 + prop?: string; 1049 + }; 1050 + }; 1051 + url: '/api/v{api-version}/complex'; 1052 + }; 1053 + 1054 + export type ComplexTypesErrors = { 1055 + /** 1056 + * 400 server error 1057 + */ 1058 + 400: unknown; 1059 + /** 1060 + * 500 server error 1061 + */ 1062 + 500: unknown; 1063 + }; 1064 + 1065 + export type ComplexTypesResponses = { 1066 + /** 1067 + * Successful response 1068 + */ 1069 + 200: Array<ModelWithString>; 1070 + }; 1071 + 1072 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1073 + 1074 + export type CallWithResultFromHeaderData = { 1075 + body?: never; 1076 + path?: never; 1077 + query?: never; 1078 + url: '/api/v{api-version}/header'; 1079 + }; 1080 + 1081 + export type CallWithResultFromHeaderErrors = { 1082 + /** 1083 + * 400 server error 1084 + */ 1085 + 400: unknown; 1086 + /** 1087 + * 500 server error 1088 + */ 1089 + 500: unknown; 1090 + }; 1091 + 1092 + export type CallWithResultFromHeaderResponses = { 1093 + /** 1094 + * Successful response 1095 + */ 1096 + 200: unknown; 1097 + }; 1098 + 1099 + export type TestErrorCodeData = { 1100 + body?: never; 1101 + path?: never; 1102 + query: { 1103 + /** 1104 + * Status code to return 1105 + */ 1106 + status: string; 1107 + }; 1108 + url: '/api/v{api-version}/error'; 1109 + }; 1110 + 1111 + export type TestErrorCodeErrors = { 1112 + /** 1113 + * Custom message: Internal Server Error 1114 + */ 1115 + 500: unknown; 1116 + /** 1117 + * Custom message: Not Implemented 1118 + */ 1119 + 501: unknown; 1120 + /** 1121 + * Custom message: Bad Gateway 1122 + */ 1123 + 502: unknown; 1124 + /** 1125 + * Custom message: Service Unavailable 1126 + */ 1127 + 503: unknown; 1128 + }; 1129 + 1130 + export type TestErrorCodeResponses = { 1131 + /** 1132 + * Custom message: Successful response 1133 + */ 1134 + 200: unknown; 1135 + }; 1136 + 1137 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 1138 + body?: never; 1139 + path?: never; 1140 + query: { 1141 + /** 1142 + * Dummy input param 1143 + */ 1144 + nonAsciiParamæøåÆØÅöôêÊ: number; 1145 + }; 1146 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1147 + }; 1148 + 1149 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 1150 + /** 1151 + * Successful response 1152 + */ 1153 + 200: NonAsciiStringæøåÆøÅöôêÊ字符串; 1154 + }; 1155 + 1156 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 1157 + 1158 + export type PostApiVbyApiVersionBodyData = { 1159 + /** 1160 + * Body should not be unknown 1161 + */ 1162 + body: ParameterActivityParams; 1163 + path?: never; 1164 + query?: never; 1165 + url: '/api/v{api-version}/body'; 1166 + }; 1167 + 1168 + export type PostApiVbyApiVersionBodyErrors = { 1169 + /** 1170 + * Bad Request 1171 + */ 1172 + 400: FailureFailure; 1173 + /** 1174 + * Internal Server Error 1175 + */ 1176 + 500: FailureFailure; 1177 + }; 1178 + 1179 + export type PostApiVbyApiVersionBodyError = PostApiVbyApiVersionBodyErrors[keyof PostApiVbyApiVersionBodyErrors]; 1180 + 1181 + export type PostApiVbyApiVersionBodyResponses = { 1182 + /** 1183 + * OK 1184 + */ 1185 + 200: ResponsePostActivityResponse; 1186 + }; 1187 + 1188 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses];
+3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/nestjs/default/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen';
+54
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/nestjs/default/nestjs.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { ApiVVersionODataControllerCountResponse, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesResponse, CallWithNoContentResponseResponse, CallWithParametersData, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithResponsesResponse, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponse, ComplexTypesData, ComplexTypesResponse, DeleteFooData3, DeprecatedCallData, DummyAResponse, DummyBResponse, FileResponseData, FileResponseResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetCallWithOptionalParamData, ImportData, ImportResponse, MultipartRequestData, MultipartResponseResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PutWithFormUrlEncodedData, TestErrorCodeData, TypesData, TypesResponse, UploadFileData, UploadFileResponse } from './types.gen'; 4 + 5 + export type ControllerMethods = { 6 + export: () => Promise<void>; 7 + patchApiVbyApiVersionNoTag: () => Promise<void>; 8 + import: (body: ImportData['body']) => Promise<ImportResponse>; 9 + fooWow: () => Promise<void>; 10 + apiVVersionODataControllerCount: () => Promise<ApiVVersionODataControllerCountResponse>; 11 + getApiVbyApiVersionSimpleOperation: (path: GetApiVbyApiVersionSimpleOperationData['path']) => Promise<GetApiVbyApiVersionSimpleOperationResponse>; 12 + deleteCallWithoutParametersAndResponse: () => Promise<void>; 13 + getCallWithoutParametersAndResponse: () => Promise<void>; 14 + headCallWithoutParametersAndResponse: () => Promise<void>; 15 + optionsCallWithoutParametersAndResponse: () => Promise<void>; 16 + patchCallWithoutParametersAndResponse: () => Promise<void>; 17 + postCallWithoutParametersAndResponse: () => Promise<void>; 18 + putCallWithoutParametersAndResponse: () => Promise<void>; 19 + deleteFoo: (path: DeleteFooData3['path'], headers: DeleteFooData3['headers']) => Promise<void>; 20 + callWithDescriptions: (query?: CallWithDescriptionsData['query']) => Promise<void>; 21 + deprecatedCall: (headers: DeprecatedCallData['headers']) => Promise<void>; 22 + callWithParameters: (path: CallWithParametersData['path'], query: CallWithParametersData['query'], body: CallWithParametersData['body'], headers: CallWithParametersData['headers']) => Promise<void>; 23 + callWithWeirdParameterNames: (path: CallWithWeirdParameterNamesData['path'], query: CallWithWeirdParameterNamesData['query'], body: CallWithWeirdParameterNamesData['body'], headers: CallWithWeirdParameterNamesData['headers']) => Promise<void>; 24 + getCallWithOptionalParam: (body: GetCallWithOptionalParamData['body'], query?: GetCallWithOptionalParamData['query']) => Promise<void>; 25 + postCallWithOptionalParam: (query: PostCallWithOptionalParamData['query'], body?: PostCallWithOptionalParamData['body']) => Promise<PostCallWithOptionalParamResponse>; 26 + postApiVbyApiVersionRequestBody: (query?: PostApiVbyApiVersionRequestBodyData['query'], body?: PostApiVbyApiVersionRequestBodyData['body']) => Promise<void>; 27 + postApiVbyApiVersionFormData: (query?: PostApiVbyApiVersionFormDataData['query'], body?: PostApiVbyApiVersionFormDataData['body']) => Promise<void>; 28 + callWithDefaultParameters: (query?: CallWithDefaultParametersData['query']) => Promise<void>; 29 + callWithDefaultOptionalParameters: (query?: CallWithDefaultOptionalParametersData['query']) => Promise<void>; 30 + callToTestOrderOfParams: (query: CallToTestOrderOfParamsData['query']) => Promise<void>; 31 + duplicateName: () => Promise<void>; 32 + duplicateName2: () => Promise<void>; 33 + duplicateName3: () => Promise<void>; 34 + duplicateName4: () => Promise<void>; 35 + callWithNoContentResponse: () => Promise<CallWithNoContentResponseResponse>; 36 + callWithResponseAndNoContentResponse: () => Promise<CallWithResponseAndNoContentResponseResponse>; 37 + dummyA: () => Promise<DummyAResponse>; 38 + dummyB: () => Promise<DummyBResponse>; 39 + callWithResponse: () => Promise<CallWithResponseResponse>; 40 + callWithDuplicateResponses: () => Promise<CallWithDuplicateResponsesResponse>; 41 + callWithResponses: () => Promise<CallWithResponsesResponse>; 42 + collectionFormat: (query: CollectionFormatData['query']) => Promise<void>; 43 + types: (query: TypesData['query'], path?: TypesData['path']) => Promise<TypesResponse>; 44 + uploadFile: (path: UploadFileData['path'], body: UploadFileData['body']) => Promise<UploadFileResponse>; 45 + fileResponse: (path: FileResponseData['path']) => Promise<FileResponseResponse>; 46 + complexTypes: (query: ComplexTypesData['query']) => Promise<ComplexTypesResponse>; 47 + multipartResponse: () => Promise<MultipartResponseResponse>; 48 + multipartRequest: (body?: MultipartRequestData['body']) => Promise<void>; 49 + complexParams: (path: ComplexParamsData['path'], body?: ComplexParamsData['body']) => Promise<ComplexParamsResponse>; 50 + callWithResultFromHeader: () => Promise<void>; 51 + testErrorCode: (query: TestErrorCodeData['query']) => Promise<void>; 52 + nonAsciiæøåÆøÅöôêÊ字符串: (query: NonAsciiæøåÆøÅöôêÊ字符串Data['query']) => Promise<NonAsciiæøåÆøÅöôêÊ字符串Response>; 53 + putWithFormUrlEncoded: (body: PutWithFormUrlEncodedData['body']) => Promise<void>; 54 + };
+2072
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/nestjs/default/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + export type ExternalRefA = ExternalSharedExternalSharedModel; 13 + 14 + export type ExternalRefB = ExternalSharedExternalSharedModel; 15 + 16 + /** 17 + * Testing multiline comments in string: First line 18 + * Second line 19 + * 20 + * Fourth line 21 + */ 22 + export type CamelCaseCommentWithBreaks = number; 23 + 24 + /** 25 + * Testing multiline comments in string: First line 26 + * Second line 27 + * 28 + * Fourth line 29 + */ 30 + export type CommentWithBreaks = number; 31 + 32 + /** 33 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 34 + */ 35 + export type CommentWithBackticks = number; 36 + 37 + /** 38 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 39 + */ 40 + export type CommentWithBackticksAndQuotes = number; 41 + 42 + /** 43 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 44 + */ 45 + export type CommentWithSlashes = number; 46 + 47 + /** 48 + * Testing expression placeholders in string: ${expression} should work 49 + */ 50 + export type CommentWithExpressionPlaceholders = number; 51 + 52 + /** 53 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 54 + */ 55 + export type CommentWithQuotes = number; 56 + 57 + /** 58 + * Testing reserved characters in string: * inline * and ** inline ** should work 59 + */ 60 + export type CommentWithReservedCharacters = number; 61 + 62 + /** 63 + * This is a simple number 64 + */ 65 + export type SimpleInteger = number; 66 + 67 + /** 68 + * This is a simple boolean 69 + */ 70 + export type SimpleBoolean = boolean; 71 + 72 + /** 73 + * This is a simple string 74 + */ 75 + export type SimpleString = string; 76 + 77 + /** 78 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 79 + */ 80 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 81 + 82 + /** 83 + * This is a simple file 84 + */ 85 + export type SimpleFile = Blob | File; 86 + 87 + /** 88 + * This is a simple reference 89 + */ 90 + export type SimpleReference = ModelWithString; 91 + 92 + /** 93 + * This is a simple string 94 + */ 95 + export type SimpleStringWithPattern = string | null; 96 + 97 + /** 98 + * This is a simple enum with strings 99 + */ 100 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 101 + 102 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 103 + 104 + /** 105 + * This is a simple enum with numbers 106 + */ 107 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 108 + 109 + /** 110 + * Success=1,Warning=2,Error=3 111 + */ 112 + export type EnumFromDescription = number; 113 + 114 + /** 115 + * This is a simple enum with numbers 116 + */ 117 + export type EnumWithExtensions = 200 | 400 | 500; 118 + 119 + export type EnumWithXEnumNames = 0 | 1 | 2; 120 + 121 + /** 122 + * This is a simple array with numbers 123 + */ 124 + export type ArrayWithNumbers = Array<number>; 125 + 126 + /** 127 + * This is a simple array with booleans 128 + */ 129 + export type ArrayWithBooleans = Array<boolean>; 130 + 131 + /** 132 + * This is a simple array with strings 133 + */ 134 + export type ArrayWithStrings = Array<string>; 135 + 136 + /** 137 + * This is a simple array with references 138 + */ 139 + export type ArrayWithReferences = Array<ModelWithString>; 140 + 141 + /** 142 + * This is a simple array containing an array 143 + */ 144 + export type ArrayWithArray = Array<Array<ModelWithString>>; 145 + 146 + /** 147 + * This is a simple array with properties 148 + */ 149 + export type ArrayWithProperties = Array<{ 150 + '16x16'?: CamelCaseCommentWithBreaks; 151 + bar?: string; 152 + }>; 153 + 154 + /** 155 + * This is a simple array with any of properties 156 + */ 157 + export type ArrayWithAnyOfProperties = Array<{ 158 + foo?: string; 159 + } | { 160 + bar?: string; 161 + }>; 162 + 163 + export type AnyOfAnyAndNull = { 164 + data?: unknown; 165 + }; 166 + 167 + /** 168 + * This is a simple array with any of properties 169 + */ 170 + export type AnyOfArrays = { 171 + results?: Array<{ 172 + foo?: string; 173 + } | { 174 + bar?: string; 175 + }>; 176 + }; 177 + 178 + /** 179 + * This is a string dictionary 180 + */ 181 + export type DictionaryWithString = { 182 + [key: string]: string; 183 + }; 184 + 185 + export type DictionaryWithPropertiesAndAdditionalProperties = { 186 + foo?: number; 187 + bar?: boolean; 188 + [key: string]: string | number | boolean | undefined; 189 + }; 190 + 191 + /** 192 + * This is a string reference 193 + */ 194 + export type DictionaryWithReference = { 195 + [key: string]: ModelWithString; 196 + }; 197 + 198 + /** 199 + * This is a complex dictionary 200 + */ 201 + export type DictionaryWithArray = { 202 + [key: string]: Array<ModelWithString>; 203 + }; 204 + 205 + /** 206 + * This is a string dictionary 207 + */ 208 + export type DictionaryWithDictionary = { 209 + [key: string]: { 210 + [key: string]: string; 211 + }; 212 + }; 213 + 214 + /** 215 + * This is a complex dictionary 216 + */ 217 + export type DictionaryWithProperties = { 218 + [key: string]: { 219 + foo?: string; 220 + bar?: string; 221 + }; 222 + }; 223 + 224 + /** 225 + * This is a model with one number property 226 + */ 227 + export type ModelWithInteger = { 228 + /** 229 + * This is a simple number property 230 + */ 231 + prop?: number; 232 + }; 233 + 234 + /** 235 + * This is a model with one boolean property 236 + */ 237 + export type ModelWithBoolean = { 238 + /** 239 + * This is a simple boolean property 240 + */ 241 + prop?: boolean; 242 + }; 243 + 244 + /** 245 + * This is a model with one string property 246 + */ 247 + export type ModelWithString = { 248 + /** 249 + * This is a simple string property 250 + */ 251 + prop?: string; 252 + }; 253 + 254 + /** 255 + * This is a model with one string property 256 + */ 257 + export type ModelWithStringError = { 258 + /** 259 + * This is a simple string property 260 + */ 261 + prop?: string; 262 + }; 263 + 264 + /** 265 + * `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) 266 + */ 267 + export type ModelFromZendesk = string; 268 + 269 + /** 270 + * This is a model with one string property 271 + */ 272 + export type ModelWithNullableString = { 273 + /** 274 + * This is a simple string property 275 + */ 276 + nullableProp1?: string | null; 277 + /** 278 + * This is a simple string property 279 + */ 280 + nullableRequiredProp1: string | null; 281 + /** 282 + * This is a simple string property 283 + */ 284 + nullableProp2?: string | null; 285 + /** 286 + * This is a simple string property 287 + */ 288 + nullableRequiredProp2: string | null; 289 + /** 290 + * This is a simple enum with strings 291 + */ 292 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 293 + }; 294 + 295 + /** 296 + * This is a model with one enum 297 + */ 298 + export type ModelWithEnum = { 299 + /** 300 + * This is a simple enum with strings 301 + */ 302 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 303 + /** 304 + * These are the HTTP error code enums 305 + */ 306 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 307 + /** 308 + * Simple boolean enum 309 + */ 310 + bool?: true; 311 + }; 312 + 313 + /** 314 + * This is a model with one enum with escaped name 315 + */ 316 + export type ModelWithEnumWithHyphen = { 317 + /** 318 + * Foo-Bar-Baz-Qux 319 + */ 320 + 'foo-bar-baz-qux'?: '3.0'; 321 + }; 322 + 323 + /** 324 + * This is a model with one enum 325 + */ 326 + export type ModelWithEnumFromDescription = { 327 + /** 328 + * Success=1,Warning=2,Error=3 329 + */ 330 + test?: number; 331 + }; 332 + 333 + /** 334 + * This is a model with nested enums 335 + */ 336 + export type ModelWithNestedEnums = { 337 + dictionaryWithEnum?: { 338 + [key: string]: 'Success' | 'Warning' | 'Error'; 339 + }; 340 + dictionaryWithEnumFromDescription?: { 341 + [key: string]: number; 342 + }; 343 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 344 + arrayWithDescription?: Array<number>; 345 + /** 346 + * This is a simple enum with strings 347 + */ 348 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 349 + }; 350 + 351 + /** 352 + * This is a model with one property containing a reference 353 + */ 354 + export type ModelWithReference = { 355 + prop?: ModelWithProperties; 356 + }; 357 + 358 + /** 359 + * This is a model with one property containing an array 360 + */ 361 + export type ModelWithArrayReadOnlyAndWriteOnly = { 362 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 363 + propWithFile?: Array<Blob | File>; 364 + propWithNumber?: Array<number>; 365 + }; 366 + 367 + /** 368 + * This is a model with one property containing an array 369 + */ 370 + export type ModelWithArray = { 371 + prop?: Array<ModelWithString>; 372 + propWithFile?: Array<Blob | File>; 373 + propWithNumber?: Array<number>; 374 + }; 375 + 376 + /** 377 + * This is a model with one property containing a dictionary 378 + */ 379 + export type ModelWithDictionary = { 380 + prop?: { 381 + [key: string]: string; 382 + }; 383 + }; 384 + 385 + /** 386 + * This is a deprecated model with a deprecated property 387 + * 388 + * @deprecated 389 + */ 390 + export type DeprecatedModel = { 391 + /** 392 + * This is a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + prop?: string; 397 + }; 398 + 399 + /** 400 + * This is a model with one property containing a circular reference 401 + */ 402 + export type ModelWithCircularReference = { 403 + prop?: ModelWithCircularReference; 404 + }; 405 + 406 + /** 407 + * This is a model with one property with a 'one of' relationship 408 + */ 409 + export type CompositionWithOneOf = { 410 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 411 + }; 412 + 413 + /** 414 + * This is a model with one property with a 'one of' relationship where the options are not $ref 415 + */ 416 + export type CompositionWithOneOfAnonymous = { 417 + propA?: { 418 + propA?: string; 419 + } | string | number; 420 + }; 421 + 422 + /** 423 + * Circle 424 + */ 425 + export type ModelCircle = { 426 + kind: string; 427 + radius?: number; 428 + }; 429 + 430 + /** 431 + * Square 432 + */ 433 + export type ModelSquare = { 434 + kind: string; 435 + sideLength?: number; 436 + }; 437 + 438 + /** 439 + * This is a model with one property with a 'one of' relationship where the options are not $ref 440 + */ 441 + export type CompositionWithOneOfDiscriminator = ({ 442 + kind: 'circle'; 443 + } & ModelCircle) | ({ 444 + kind: 'square'; 445 + } & ModelSquare); 446 + 447 + /** 448 + * This is a model with one property with a 'any of' relationship 449 + */ 450 + export type CompositionWithAnyOf = { 451 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 452 + }; 453 + 454 + /** 455 + * This is a model with one property with a 'any of' relationship where the options are not $ref 456 + */ 457 + export type CompositionWithAnyOfAnonymous = { 458 + propA?: { 459 + propA?: string; 460 + } | string | number; 461 + }; 462 + 463 + /** 464 + * This is a model with nested 'any of' property with a type null 465 + */ 466 + export type CompositionWithNestedAnyAndTypeNull = { 467 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 468 + }; 469 + 470 + export type _3eNum1Период = 'Bird' | 'Dog'; 471 + 472 + export type ConstValue = 'ConstValue'; 473 + 474 + /** 475 + * This is a model with one property with a 'any of' relationship where the options are not $ref 476 + */ 477 + export type CompositionWithNestedAnyOfAndNull = { 478 + propA?: Array<_3eNum1Период | ConstValue> | null; 479 + }; 480 + 481 + /** 482 + * This is a model with one property with a 'one of' relationship 483 + */ 484 + export type CompositionWithOneOfAndNullable = { 485 + propA?: { 486 + boolean?: boolean; 487 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 488 + }; 489 + 490 + /** 491 + * This is a model that contains a simple dictionary within composition 492 + */ 493 + export type CompositionWithOneOfAndSimpleDictionary = { 494 + propA?: boolean | { 495 + [key: string]: number; 496 + }; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a dictionary of simple arrays within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 503 + propA?: boolean | { 504 + [key: string]: Array<boolean>; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of complex arrays (composited) within composition 510 + */ 511 + export type CompositionWithOneOfAndComplexArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<number | string>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model with one property with a 'all of' relationship 519 + */ 520 + export type CompositionWithAllOfAndNullable = { 521 + propA?: ({ 522 + boolean?: boolean; 523 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'any of' relationship 528 + */ 529 + export type CompositionWithAnyOfAndNullable = { 530 + propA?: { 531 + boolean?: boolean; 532 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 533 + }; 534 + 535 + /** 536 + * This is a base model with two simple optional properties 537 + */ 538 + export type CompositionBaseModel = { 539 + firstName?: string; 540 + lastname?: string; 541 + }; 542 + 543 + /** 544 + * This is a model that extends the base model 545 + */ 546 + export type CompositionExtendedModel = CompositionBaseModel & { 547 + age: number; 548 + firstName: string; 549 + lastname: string; 550 + }; 551 + 552 + /** 553 + * This is a model with one nested property 554 + */ 555 + export type ModelWithProperties = { 556 + required: string; 557 + readonly requiredAndReadOnly: string; 558 + requiredAndNullable: string | null; 559 + string?: string; 560 + number?: number; 561 + boolean?: boolean; 562 + reference?: ModelWithString; 563 + 'property with space'?: string; 564 + default?: string; 565 + try?: string; 566 + readonly '@namespace.string'?: string; 567 + readonly '@namespace.integer'?: number; 568 + }; 569 + 570 + /** 571 + * This is a model with one nested property 572 + */ 573 + export type ModelWithNestedProperties = { 574 + readonly first: { 575 + readonly second: { 576 + readonly third: string | null; 577 + } | null; 578 + } | null; 579 + }; 580 + 581 + /** 582 + * This is a model with duplicated properties 583 + */ 584 + export type ModelWithDuplicateProperties = { 585 + prop?: ModelWithString; 586 + }; 587 + 588 + /** 589 + * This is a model with ordered properties 590 + */ 591 + export type ModelWithOrderedProperties = { 592 + zebra?: string; 593 + apple?: string; 594 + hawaii?: string; 595 + }; 596 + 597 + /** 598 + * This is a model with duplicated imports 599 + */ 600 + export type ModelWithDuplicateImports = { 601 + propA?: ModelWithString; 602 + propB?: ModelWithString; 603 + propC?: ModelWithString; 604 + }; 605 + 606 + /** 607 + * This is a model that extends another model 608 + */ 609 + export type ModelThatExtends = ModelWithString & { 610 + propExtendsA?: string; 611 + propExtendsB?: ModelWithString; 612 + }; 613 + 614 + /** 615 + * This is a model that extends another model 616 + */ 617 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 618 + propExtendsC?: string; 619 + propExtendsD?: ModelWithString; 620 + }; 621 + 622 + /** 623 + * This is a model that contains a some patterns 624 + */ 625 + export type ModelWithPattern = { 626 + key: string; 627 + name: string; 628 + readonly enabled?: boolean; 629 + readonly modified?: string; 630 + id?: string; 631 + text?: string; 632 + patternWithSingleQuotes?: string; 633 + patternWithNewline?: string; 634 + patternWithBacktick?: string; 635 + }; 636 + 637 + export type File = { 638 + /** 639 + * Id 640 + */ 641 + readonly id?: string; 642 + /** 643 + * Updated at 644 + */ 645 + readonly updated_at?: string; 646 + /** 647 + * Created at 648 + */ 649 + readonly created_at?: string; 650 + /** 651 + * Mime 652 + */ 653 + mime: string; 654 + /** 655 + * File 656 + */ 657 + readonly file?: string; 658 + }; 659 + 660 + export type Default = { 661 + name?: string; 662 + }; 663 + 664 + export type Pageable = { 665 + page?: number; 666 + size?: number; 667 + sort?: Array<string>; 668 + }; 669 + 670 + /** 671 + * This is a free-form object without additionalProperties. 672 + */ 673 + export type FreeFormObjectWithoutAdditionalProperties = { 674 + [key: string]: unknown; 675 + }; 676 + 677 + /** 678 + * This is a free-form object with additionalProperties: true. 679 + */ 680 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 681 + [key: string]: unknown; 682 + }; 683 + 684 + /** 685 + * This is a free-form object with additionalProperties: {}. 686 + */ 687 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 688 + [key: string]: unknown; 689 + }; 690 + 691 + export type ModelWithConst = { 692 + String?: 'String'; 693 + number?: 0; 694 + null?: unknown; 695 + withType?: 'Some string'; 696 + }; 697 + 698 + /** 699 + * This is a model with one property and additionalProperties: true 700 + */ 701 + export type ModelWithAdditionalPropertiesEqTrue = { 702 + /** 703 + * This is a simple string property 704 + */ 705 + prop?: string; 706 + [key: string]: unknown | string | undefined; 707 + }; 708 + 709 + export type NestedAnyOfArraysNullable = { 710 + nullableArray?: Array<string | boolean> | null; 711 + }; 712 + 713 + export type CompositionWithOneOfAndProperties = ({ 714 + foo: SimpleParameter; 715 + } | { 716 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 717 + }) & { 718 + baz: number | null; 719 + qux: number; 720 + }; 721 + 722 + /** 723 + * An object that can be null 724 + */ 725 + export type NullableObject = { 726 + foo?: string; 727 + } | null; 728 + 729 + /** 730 + * Some % character 731 + */ 732 + export type CharactersInDescription = string; 733 + 734 + export type ModelWithNullableObject = { 735 + data?: NullableObject; 736 + }; 737 + 738 + export type ModelWithOneOfEnum = { 739 + foo: 'Bar'; 740 + } | { 741 + foo: 'Baz'; 742 + } | { 743 + foo: 'Qux'; 744 + } | { 745 + content: string; 746 + foo: 'Quux'; 747 + } | { 748 + content: [ 749 + string, 750 + string 751 + ]; 752 + foo: 'Corge'; 753 + }; 754 + 755 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 756 + 757 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 758 + 759 + export type ModelWithNestedArrayEnumsData = { 760 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 761 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnums = { 765 + array_strings?: Array<string>; 766 + data?: ModelWithNestedArrayEnumsData; 767 + }; 768 + 769 + export type ModelWithNestedCompositionEnums = { 770 + foo?: ModelWithNestedArrayEnumsDataFoo; 771 + }; 772 + 773 + export type ModelWithReadOnlyAndWriteOnly = { 774 + foo: string; 775 + readonly bar: string; 776 + }; 777 + 778 + export type ModelWithConstantSizeArray = [ 779 + number, 780 + number 781 + ]; 782 + 783 + export type ModelWithAnyOfConstantSizeArray = [ 784 + number | string, 785 + number | string, 786 + number | string 787 + ]; 788 + 789 + export type ModelWithPrefixItemsConstantSizeArray = Array<ModelWithInteger | number | string>; 790 + 791 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 792 + number | null | string, 793 + number | null | string, 794 + number | null | string 795 + ]; 796 + 797 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 798 + number | Import, 799 + number | Import 800 + ]; 801 + 802 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 803 + number & string, 804 + number & string 805 + ]; 806 + 807 + export type ModelWithNumericEnumUnion = { 808 + /** 809 + * Период 810 + */ 811 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 812 + }; 813 + 814 + /** 815 + * Some description with `back ticks` 816 + */ 817 + export type ModelWithBackticksInDescription = { 818 + /** 819 + * The template `that` should be used for parsing and importing the contents of the CSV file. 820 + * 821 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 822 + * <pre> 823 + * [ 824 + * { 825 + * "resourceType": "Asset", 826 + * "identifier": { 827 + * "name": "${1}", 828 + * "domain": { 829 + * "name": "${2}", 830 + * "community": { 831 + * "name": "Some Community" 832 + * } 833 + * } 834 + * }, 835 + * "attributes" : { 836 + * "00000000-0000-0000-0000-000000003115" : [ { 837 + * "value" : "${3}" 838 + * } ], 839 + * "00000000-0000-0000-0000-000000000222" : [ { 840 + * "value" : "${4}" 841 + * } ] 842 + * } 843 + * } 844 + * ] 845 + * </pre> 846 + */ 847 + template?: string; 848 + }; 849 + 850 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 851 + baz: number | null; 852 + qux: number; 853 + }; 854 + 855 + /** 856 + * Model used to test deduplication strategy (unused) 857 + */ 858 + export type ParameterSimpleParameterUnused = string; 859 + 860 + /** 861 + * Model used to test deduplication strategy 862 + */ 863 + export type PostServiceWithEmptyTagResponse = string; 864 + 865 + /** 866 + * Model used to test deduplication strategy 867 + */ 868 + export type PostServiceWithEmptyTagResponse2 = string; 869 + 870 + /** 871 + * Model used to test deduplication strategy 872 + */ 873 + export type DeleteFooData = string; 874 + 875 + /** 876 + * Model used to test deduplication strategy 877 + */ 878 + export type DeleteFooData2 = string; 879 + 880 + /** 881 + * Model with restricted keyword name 882 + */ 883 + export type Import = string; 884 + 885 + export type SchemaWithFormRestrictedKeys = { 886 + description?: string; 887 + 'x-enum-descriptions'?: string; 888 + 'x-enum-varnames'?: string; 889 + 'x-enumNames'?: string; 890 + title?: string; 891 + object?: { 892 + description?: string; 893 + 'x-enum-descriptions'?: string; 894 + 'x-enum-varnames'?: string; 895 + 'x-enumNames'?: string; 896 + title?: string; 897 + }; 898 + array?: Array<{ 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + }>; 905 + }; 906 + 907 + /** 908 + * This schema was giving PascalCase transformations a hard time 909 + */ 910 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 911 + /** 912 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 913 + */ 914 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 915 + }; 916 + 917 + /** 918 + * This schema was giving PascalCase transformations a hard time 919 + */ 920 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 921 + /** 922 + * Specifies the target ResourceVersion 923 + */ 924 + resourceVersion?: string; 925 + /** 926 + * Specifies the target UID. 927 + */ 928 + uid?: string; 929 + }; 930 + 931 + export type AdditionalPropertiesUnknownIssue = { 932 + [key: string]: string | number; 933 + }; 934 + 935 + export type AdditionalPropertiesUnknownIssue2 = { 936 + [key: string]: string | number; 937 + }; 938 + 939 + export type AdditionalPropertiesUnknownIssue3 = string & { 940 + entries: { 941 + [key: string]: AdditionalPropertiesUnknownIssue; 942 + }; 943 + }; 944 + 945 + export type AdditionalPropertiesIntegerIssue = { 946 + value: number; 947 + [key: string]: number; 948 + }; 949 + 950 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 951 + 952 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 953 + item?: boolean; 954 + error?: string | null; 955 + readonly hasError?: boolean; 956 + data?: { 957 + [key: string]: never; 958 + }; 959 + }; 960 + 961 + export type GenericSchemaDuplicateIssue1SystemString = { 962 + item?: string | null; 963 + error?: string | null; 964 + readonly hasError?: boolean; 965 + }; 966 + 967 + export type ExternalSharedExternalSharedModel = { 968 + id: string; 969 + name?: string; 970 + }; 971 + 972 + /** 973 + * This is a model with one property containing a reference 974 + */ 975 + export type ModelWithReferenceWritable = { 976 + prop?: ModelWithPropertiesWritable; 977 + }; 978 + 979 + /** 980 + * This is a model with one property containing an array 981 + */ 982 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 983 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 984 + propWithFile?: Array<Blob | File>; 985 + propWithNumber?: Array<number>; 986 + }; 987 + 988 + /** 989 + * This is a model with one nested property 990 + */ 991 + export type ModelWithPropertiesWritable = { 992 + required: string; 993 + requiredAndNullable: string | null; 994 + string?: string; 995 + number?: number; 996 + boolean?: boolean; 997 + reference?: ModelWithString; 998 + 'property with space'?: string; 999 + default?: string; 1000 + try?: string; 1001 + }; 1002 + 1003 + /** 1004 + * This is a model that contains a some patterns 1005 + */ 1006 + export type ModelWithPatternWritable = { 1007 + key: string; 1008 + name: string; 1009 + id?: string; 1010 + text?: string; 1011 + patternWithSingleQuotes?: string; 1012 + patternWithNewline?: string; 1013 + patternWithBacktick?: string; 1014 + }; 1015 + 1016 + export type FileWritable = { 1017 + /** 1018 + * Mime 1019 + */ 1020 + mime: string; 1021 + }; 1022 + 1023 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1024 + foo: string; 1025 + baz: string; 1026 + }; 1027 + 1028 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1029 + number | Import, 1030 + number | Import 1031 + ]; 1032 + 1033 + export type AdditionalPropertiesUnknownIssueWritable = { 1034 + [key: string]: string | number; 1035 + }; 1036 + 1037 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1038 + 1039 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1040 + item?: boolean; 1041 + error?: string | null; 1042 + data?: { 1043 + [key: string]: never; 1044 + }; 1045 + }; 1046 + 1047 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1048 + item?: string | null; 1049 + error?: string | null; 1050 + }; 1051 + 1052 + /** 1053 + * This is a reusable parameter 1054 + */ 1055 + export type SimpleParameter = string; 1056 + 1057 + /** 1058 + * Parameter with illegal characters 1059 + */ 1060 + export type XFooBar = ModelWithString; 1061 + 1062 + export type SimpleRequestBody = ModelWithString; 1063 + 1064 + export type SimpleFormData = ModelWithString; 1065 + 1066 + export type ExportData = { 1067 + body?: never; 1068 + path?: never; 1069 + query?: never; 1070 + url: '/api/v{api-version}/no+tag'; 1071 + }; 1072 + 1073 + export type PatchApiVbyApiVersionNoTagData = { 1074 + body?: never; 1075 + path?: never; 1076 + query?: never; 1077 + url: '/api/v{api-version}/no+tag'; 1078 + }; 1079 + 1080 + export type PatchApiVbyApiVersionNoTagResponses = { 1081 + /** 1082 + * OK 1083 + */ 1084 + default: unknown; 1085 + }; 1086 + 1087 + export type ImportData = { 1088 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1089 + path?: never; 1090 + query?: never; 1091 + url: '/api/v{api-version}/no+tag'; 1092 + }; 1093 + 1094 + export type ImportResponses = { 1095 + /** 1096 + * Success 1097 + */ 1098 + 200: ModelFromZendesk; 1099 + /** 1100 + * Default success response 1101 + */ 1102 + default: ModelWithReadOnlyAndWriteOnly; 1103 + }; 1104 + 1105 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1106 + 1107 + export type FooWowData = { 1108 + body?: never; 1109 + path?: never; 1110 + query?: never; 1111 + url: '/api/v{api-version}/no+tag'; 1112 + }; 1113 + 1114 + export type FooWowResponses = { 1115 + /** 1116 + * OK 1117 + */ 1118 + default: unknown; 1119 + }; 1120 + 1121 + export type ApiVVersionODataControllerCountData = { 1122 + body?: never; 1123 + path?: never; 1124 + query?: never; 1125 + url: '/api/v{api-version}/simple/$count'; 1126 + }; 1127 + 1128 + export type ApiVVersionODataControllerCountResponses = { 1129 + /** 1130 + * Success 1131 + */ 1132 + 200: ModelFromZendesk; 1133 + }; 1134 + 1135 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1136 + 1137 + export type GetApiVbyApiVersionSimpleOperationData = { 1138 + body?: never; 1139 + path: { 1140 + /** 1141 + * foo in method 1142 + */ 1143 + foo_param: string; 1144 + }; 1145 + query?: never; 1146 + url: '/api/v{api-version}/simple:operation'; 1147 + }; 1148 + 1149 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1150 + /** 1151 + * Default error response 1152 + */ 1153 + default: ModelWithBoolean; 1154 + }; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1157 + 1158 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1159 + /** 1160 + * Response is a simple number 1161 + */ 1162 + 200: number; 1163 + }; 1164 + 1165 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1166 + 1167 + export type DeleteCallWithoutParametersAndResponseData = { 1168 + body?: never; 1169 + path?: never; 1170 + query?: never; 1171 + url: '/api/v{api-version}/simple'; 1172 + }; 1173 + 1174 + export type GetCallWithoutParametersAndResponseData = { 1175 + body?: never; 1176 + path?: never; 1177 + query?: never; 1178 + url: '/api/v{api-version}/simple'; 1179 + }; 1180 + 1181 + export type HeadCallWithoutParametersAndResponseData = { 1182 + body?: never; 1183 + path?: never; 1184 + query?: never; 1185 + url: '/api/v{api-version}/simple'; 1186 + }; 1187 + 1188 + export type OptionsCallWithoutParametersAndResponseData = { 1189 + body?: never; 1190 + path?: never; 1191 + query?: never; 1192 + url: '/api/v{api-version}/simple'; 1193 + }; 1194 + 1195 + export type PatchCallWithoutParametersAndResponseData = { 1196 + body?: never; 1197 + path?: never; 1198 + query?: never; 1199 + url: '/api/v{api-version}/simple'; 1200 + }; 1201 + 1202 + export type PostCallWithoutParametersAndResponseData = { 1203 + body?: never; 1204 + path?: never; 1205 + query?: never; 1206 + url: '/api/v{api-version}/simple'; 1207 + }; 1208 + 1209 + export type PutCallWithoutParametersAndResponseData = { 1210 + body?: never; 1211 + path?: never; 1212 + query?: never; 1213 + url: '/api/v{api-version}/simple'; 1214 + }; 1215 + 1216 + export type DeleteFooData3 = { 1217 + body?: never; 1218 + headers: { 1219 + /** 1220 + * Parameter with illegal characters 1221 + */ 1222 + 'x-Foo-Bar': ModelWithString; 1223 + }; 1224 + path: { 1225 + /** 1226 + * foo in method 1227 + */ 1228 + foo_param: string; 1229 + /** 1230 + * bar in method 1231 + */ 1232 + BarParam: string; 1233 + }; 1234 + query?: never; 1235 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1236 + }; 1237 + 1238 + export type CallWithDescriptionsData = { 1239 + body?: never; 1240 + path?: never; 1241 + query?: { 1242 + /** 1243 + * Testing multiline comments in string: First line 1244 + * Second line 1245 + * 1246 + * Fourth line 1247 + */ 1248 + parameterWithBreaks?: string; 1249 + /** 1250 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1251 + */ 1252 + parameterWithBackticks?: string; 1253 + /** 1254 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1255 + */ 1256 + parameterWithSlashes?: string; 1257 + /** 1258 + * Testing expression placeholders in string: ${expression} should work 1259 + */ 1260 + parameterWithExpressionPlaceholders?: string; 1261 + /** 1262 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1263 + */ 1264 + parameterWithQuotes?: string; 1265 + /** 1266 + * Testing reserved characters in string: * inline * and ** inline ** should work 1267 + */ 1268 + parameterWithReservedCharacters?: string; 1269 + }; 1270 + url: '/api/v{api-version}/descriptions'; 1271 + }; 1272 + 1273 + export type DeprecatedCallData = { 1274 + body?: never; 1275 + headers: { 1276 + /** 1277 + * This parameter is deprecated 1278 + * 1279 + * @deprecated 1280 + */ 1281 + parameter: DeprecatedModel | null; 1282 + }; 1283 + path?: never; 1284 + query?: never; 1285 + url: '/api/v{api-version}/parameters/deprecated'; 1286 + }; 1287 + 1288 + export type CallWithParametersData = { 1289 + /** 1290 + * This is the parameter that goes into the body 1291 + */ 1292 + body: { 1293 + [key: string]: unknown; 1294 + } | null; 1295 + headers: { 1296 + /** 1297 + * This is the parameter that goes into the header 1298 + */ 1299 + parameterHeader: string | null; 1300 + }; 1301 + path: { 1302 + /** 1303 + * This is the parameter that goes into the path 1304 + */ 1305 + parameterPath: string | null; 1306 + /** 1307 + * api-version should be required in standalone clients 1308 + */ 1309 + 'api-version': string | null; 1310 + }; 1311 + query: { 1312 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1313 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1314 + /** 1315 + * This is the parameter that goes into the query params 1316 + */ 1317 + cursor: string | null; 1318 + }; 1319 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1320 + }; 1321 + 1322 + export type CallWithWeirdParameterNamesData = { 1323 + /** 1324 + * This is the parameter that goes into the body 1325 + */ 1326 + body: ModelWithString | null; 1327 + headers: { 1328 + /** 1329 + * This is the parameter that goes into the request header 1330 + */ 1331 + 'parameter.header': string | null; 1332 + }; 1333 + path: { 1334 + /** 1335 + * This is the parameter that goes into the path 1336 + */ 1337 + 'parameter.path.1'?: string; 1338 + /** 1339 + * This is the parameter that goes into the path 1340 + */ 1341 + 'parameter-path-2'?: string; 1342 + /** 1343 + * This is the parameter that goes into the path 1344 + */ 1345 + 'PARAMETER-PATH-3'?: string; 1346 + /** 1347 + * api-version should be required in standalone clients 1348 + */ 1349 + 'api-version': string | null; 1350 + }; 1351 + query: { 1352 + /** 1353 + * This is the parameter with a reserved keyword 1354 + */ 1355 + default?: string; 1356 + /** 1357 + * This is the parameter that goes into the request query params 1358 + */ 1359 + 'parameter-query': string | null; 1360 + }; 1361 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1362 + }; 1363 + 1364 + export type GetCallWithOptionalParamData = { 1365 + /** 1366 + * This is a required parameter 1367 + */ 1368 + body: ModelWithOneOfEnum; 1369 + path?: never; 1370 + query?: { 1371 + /** 1372 + * This is an optional parameter 1373 + */ 1374 + page?: number; 1375 + }; 1376 + url: '/api/v{api-version}/parameters'; 1377 + }; 1378 + 1379 + export type PostCallWithOptionalParamData = { 1380 + /** 1381 + * This is an optional parameter 1382 + */ 1383 + body?: { 1384 + offset?: number | null; 1385 + }; 1386 + path?: never; 1387 + query: { 1388 + /** 1389 + * This is a required parameter 1390 + */ 1391 + parameter: Pageable; 1392 + }; 1393 + url: '/api/v{api-version}/parameters'; 1394 + }; 1395 + 1396 + export type PostCallWithOptionalParamResponses = { 1397 + /** 1398 + * Response is a simple number 1399 + */ 1400 + 200: number; 1401 + /** 1402 + * Success 1403 + */ 1404 + 204: void; 1405 + }; 1406 + 1407 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1408 + 1409 + export type PostApiVbyApiVersionRequestBodyData = { 1410 + /** 1411 + * A reusable request body 1412 + */ 1413 + body?: SimpleRequestBody; 1414 + path?: never; 1415 + query?: { 1416 + /** 1417 + * This is a reusable parameter 1418 + */ 1419 + parameter?: string; 1420 + }; 1421 + url: '/api/v{api-version}/requestBody'; 1422 + }; 1423 + 1424 + export type PostApiVbyApiVersionFormDataData = { 1425 + /** 1426 + * A reusable request body 1427 + */ 1428 + body?: SimpleFormData; 1429 + path?: never; 1430 + query?: { 1431 + /** 1432 + * This is a reusable parameter 1433 + */ 1434 + parameter?: string; 1435 + }; 1436 + url: '/api/v{api-version}/formData'; 1437 + }; 1438 + 1439 + export type CallWithDefaultParametersData = { 1440 + body?: never; 1441 + path?: never; 1442 + query?: { 1443 + /** 1444 + * This is a simple string with default value 1445 + */ 1446 + parameterString?: string | null; 1447 + /** 1448 + * This is a simple number with default value 1449 + */ 1450 + parameterNumber?: number | null; 1451 + /** 1452 + * This is a simple boolean with default value 1453 + */ 1454 + parameterBoolean?: boolean | null; 1455 + /** 1456 + * This is a simple enum with default value 1457 + */ 1458 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1459 + /** 1460 + * This is a simple model with default value 1461 + */ 1462 + parameterModel?: ModelWithString | null; 1463 + }; 1464 + url: '/api/v{api-version}/defaults'; 1465 + }; 1466 + 1467 + export type CallWithDefaultOptionalParametersData = { 1468 + body?: never; 1469 + path?: never; 1470 + query?: { 1471 + /** 1472 + * This is a simple string that is optional with default value 1473 + */ 1474 + parameterString?: string; 1475 + /** 1476 + * This is a simple number that is optional with default value 1477 + */ 1478 + parameterNumber?: number; 1479 + /** 1480 + * This is a simple boolean that is optional with default value 1481 + */ 1482 + parameterBoolean?: boolean; 1483 + /** 1484 + * This is a simple enum that is optional with default value 1485 + */ 1486 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1487 + /** 1488 + * This is a simple model that is optional with default value 1489 + */ 1490 + parameterModel?: ModelWithString; 1491 + }; 1492 + url: '/api/v{api-version}/defaults'; 1493 + }; 1494 + 1495 + export type CallToTestOrderOfParamsData = { 1496 + body?: never; 1497 + path?: never; 1498 + query: { 1499 + /** 1500 + * This is a optional string with default 1501 + */ 1502 + parameterOptionalStringWithDefault?: string; 1503 + /** 1504 + * This is a optional string with empty default 1505 + */ 1506 + parameterOptionalStringWithEmptyDefault?: string; 1507 + /** 1508 + * This is a optional string with no default 1509 + */ 1510 + parameterOptionalStringWithNoDefault?: string; 1511 + /** 1512 + * This is a string with default 1513 + */ 1514 + parameterStringWithDefault: string; 1515 + /** 1516 + * This is a string with empty default 1517 + */ 1518 + parameterStringWithEmptyDefault: string; 1519 + /** 1520 + * This is a string with no default 1521 + */ 1522 + parameterStringWithNoDefault: string; 1523 + /** 1524 + * This is a string that can be null with no default 1525 + */ 1526 + parameterStringNullableWithNoDefault?: string | null; 1527 + /** 1528 + * This is a string that can be null with default 1529 + */ 1530 + parameterStringNullableWithDefault?: string | null; 1531 + }; 1532 + url: '/api/v{api-version}/defaults'; 1533 + }; 1534 + 1535 + export type DuplicateNameData = { 1536 + body?: never; 1537 + path?: never; 1538 + query?: never; 1539 + url: '/api/v{api-version}/duplicate'; 1540 + }; 1541 + 1542 + export type DuplicateName2Data = { 1543 + body?: never; 1544 + path?: never; 1545 + query?: never; 1546 + url: '/api/v{api-version}/duplicate'; 1547 + }; 1548 + 1549 + export type DuplicateName3Data = { 1550 + body?: never; 1551 + path?: never; 1552 + query?: never; 1553 + url: '/api/v{api-version}/duplicate'; 1554 + }; 1555 + 1556 + export type DuplicateName4Data = { 1557 + body?: never; 1558 + path?: never; 1559 + query?: never; 1560 + url: '/api/v{api-version}/duplicate'; 1561 + }; 1562 + 1563 + export type CallWithNoContentResponseData = { 1564 + body?: never; 1565 + path?: never; 1566 + query?: never; 1567 + url: '/api/v{api-version}/no-content'; 1568 + }; 1569 + 1570 + export type CallWithNoContentResponseResponses = { 1571 + /** 1572 + * Success 1573 + */ 1574 + 204: void; 1575 + }; 1576 + 1577 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1578 + 1579 + export type CallWithResponseAndNoContentResponseData = { 1580 + body?: never; 1581 + path?: never; 1582 + query?: never; 1583 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1584 + }; 1585 + 1586 + export type CallWithResponseAndNoContentResponseResponses = { 1587 + /** 1588 + * Response is a simple number 1589 + */ 1590 + 200: number; 1591 + /** 1592 + * Success 1593 + */ 1594 + 204: void; 1595 + }; 1596 + 1597 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1598 + 1599 + export type DummyAData = { 1600 + body?: never; 1601 + path?: never; 1602 + query?: never; 1603 + url: '/api/v{api-version}/multiple-tags/a'; 1604 + }; 1605 + 1606 + export type DummyAResponses = { 1607 + 200: _400; 1608 + }; 1609 + 1610 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1611 + 1612 + export type DummyBData = { 1613 + body?: never; 1614 + path?: never; 1615 + query?: never; 1616 + url: '/api/v{api-version}/multiple-tags/b'; 1617 + }; 1618 + 1619 + export type DummyBResponses = { 1620 + /** 1621 + * Success 1622 + */ 1623 + 204: void; 1624 + }; 1625 + 1626 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1627 + 1628 + export type CallWithResponseData = { 1629 + body?: never; 1630 + path?: never; 1631 + query?: never; 1632 + url: '/api/v{api-version}/response'; 1633 + }; 1634 + 1635 + export type CallWithResponseResponses = { 1636 + default: Import; 1637 + }; 1638 + 1639 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1640 + 1641 + export type CallWithDuplicateResponsesData = { 1642 + body?: never; 1643 + path?: never; 1644 + query?: never; 1645 + url: '/api/v{api-version}/response'; 1646 + }; 1647 + 1648 + export type CallWithDuplicateResponsesErrors = { 1649 + /** 1650 + * Message for 500 error 1651 + */ 1652 + 500: ModelWithStringError; 1653 + /** 1654 + * Message for 501 error 1655 + */ 1656 + 501: ModelWithStringError; 1657 + /** 1658 + * Message for 502 error 1659 + */ 1660 + 502: ModelWithStringError; 1661 + /** 1662 + * Message for 4XX errors 1663 + */ 1664 + '4XX': DictionaryWithArray; 1665 + /** 1666 + * Default error response 1667 + */ 1668 + default: ModelWithBoolean; 1669 + }; 1670 + 1671 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1672 + 1673 + export type CallWithDuplicateResponsesResponses = { 1674 + /** 1675 + * Message for 200 response 1676 + */ 1677 + 200: ModelWithBoolean & ModelWithInteger; 1678 + /** 1679 + * Message for 201 response 1680 + */ 1681 + 201: ModelWithString; 1682 + /** 1683 + * Message for 202 response 1684 + */ 1685 + 202: ModelWithString; 1686 + }; 1687 + 1688 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1689 + 1690 + export type CallWithResponsesData = { 1691 + body?: never; 1692 + path?: never; 1693 + query?: never; 1694 + url: '/api/v{api-version}/response'; 1695 + }; 1696 + 1697 + export type CallWithResponsesErrors = { 1698 + /** 1699 + * Message for 500 error 1700 + */ 1701 + 500: ModelWithStringError; 1702 + /** 1703 + * Message for 501 error 1704 + */ 1705 + 501: ModelWithStringError; 1706 + /** 1707 + * Message for 502 error 1708 + */ 1709 + 502: ModelWithStringError; 1710 + /** 1711 + * Message for default response 1712 + */ 1713 + default: ModelWithStringError; 1714 + }; 1715 + 1716 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1717 + 1718 + export type CallWithResponsesResponses = { 1719 + /** 1720 + * Message for 200 response 1721 + */ 1722 + 200: { 1723 + readonly '@namespace.string'?: string; 1724 + readonly '@namespace.integer'?: number; 1725 + readonly value?: Array<ModelWithString>; 1726 + }; 1727 + /** 1728 + * Message for 201 response 1729 + */ 1730 + 201: ModelThatExtends; 1731 + /** 1732 + * Message for 202 response 1733 + */ 1734 + 202: ModelThatExtendsExtends; 1735 + }; 1736 + 1737 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1738 + 1739 + export type CollectionFormatData = { 1740 + body?: never; 1741 + path?: never; 1742 + query: { 1743 + /** 1744 + * This is an array parameter that is sent as csv format (comma-separated values) 1745 + */ 1746 + parameterArrayCSV: Array<string> | null; 1747 + /** 1748 + * This is an array parameter that is sent as ssv format (space-separated values) 1749 + */ 1750 + parameterArraySSV: Array<string> | null; 1751 + /** 1752 + * This is an array parameter that is sent as tsv format (tab-separated values) 1753 + */ 1754 + parameterArrayTSV: Array<string> | null; 1755 + /** 1756 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1757 + */ 1758 + parameterArrayPipes: Array<string> | null; 1759 + /** 1760 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1761 + */ 1762 + parameterArrayMulti: Array<string> | null; 1763 + }; 1764 + url: '/api/v{api-version}/collectionFormat'; 1765 + }; 1766 + 1767 + export type TypesData = { 1768 + body?: never; 1769 + path?: { 1770 + /** 1771 + * This is a number parameter 1772 + */ 1773 + id?: number; 1774 + }; 1775 + query: { 1776 + /** 1777 + * This is a number parameter 1778 + */ 1779 + parameterNumber: number; 1780 + /** 1781 + * This is a string parameter 1782 + */ 1783 + parameterString: string | null; 1784 + /** 1785 + * This is a boolean parameter 1786 + */ 1787 + parameterBoolean: boolean | null; 1788 + /** 1789 + * This is an object parameter 1790 + */ 1791 + parameterObject: { 1792 + [key: string]: unknown; 1793 + } | null; 1794 + /** 1795 + * This is an array parameter 1796 + */ 1797 + parameterArray: Array<string> | null; 1798 + /** 1799 + * This is a dictionary parameter 1800 + */ 1801 + parameterDictionary: { 1802 + [key: string]: unknown; 1803 + } | null; 1804 + /** 1805 + * This is an enum parameter 1806 + */ 1807 + parameterEnum: 'Success' | 'Warning' | 'Error'; 1808 + }; 1809 + url: '/api/v{api-version}/types'; 1810 + }; 1811 + 1812 + export type TypesResponses = { 1813 + /** 1814 + * Response is a simple number 1815 + */ 1816 + 200: number; 1817 + /** 1818 + * Response is a simple string 1819 + */ 1820 + 201: string; 1821 + /** 1822 + * Response is a simple boolean 1823 + */ 1824 + 202: boolean; 1825 + /** 1826 + * Response is a simple object 1827 + */ 1828 + 203: { 1829 + [key: string]: unknown; 1830 + }; 1831 + }; 1832 + 1833 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1834 + 1835 + export type UploadFileData = { 1836 + body: Blob | File; 1837 + path: { 1838 + /** 1839 + * api-version should be required in standalone clients 1840 + */ 1841 + 'api-version': string | null; 1842 + }; 1843 + query?: never; 1844 + url: '/api/v{api-version}/upload'; 1845 + }; 1846 + 1847 + export type UploadFileResponses = { 1848 + 200: boolean; 1849 + }; 1850 + 1851 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1852 + 1853 + export type FileResponseData = { 1854 + body?: never; 1855 + path: { 1856 + id: string; 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/file/{id}'; 1864 + }; 1865 + 1866 + export type FileResponseResponses = { 1867 + /** 1868 + * Success 1869 + */ 1870 + 200: Blob | File; 1871 + }; 1872 + 1873 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1874 + 1875 + export type ComplexTypesData = { 1876 + body?: never; 1877 + path?: never; 1878 + query: { 1879 + /** 1880 + * Parameter containing object 1881 + */ 1882 + parameterObject: { 1883 + first?: { 1884 + second?: { 1885 + third?: string; 1886 + }; 1887 + }; 1888 + }; 1889 + /** 1890 + * Parameter containing reference 1891 + */ 1892 + parameterReference: ModelWithString; 1893 + }; 1894 + url: '/api/v{api-version}/complex'; 1895 + }; 1896 + 1897 + export type ComplexTypesErrors = { 1898 + /** 1899 + * 400 `server` error 1900 + */ 1901 + 400: unknown; 1902 + /** 1903 + * 500 server error 1904 + */ 1905 + 500: unknown; 1906 + }; 1907 + 1908 + export type ComplexTypesResponses = { 1909 + /** 1910 + * Successful response 1911 + */ 1912 + 200: Array<ModelWithString>; 1913 + }; 1914 + 1915 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1916 + 1917 + export type MultipartResponseData = { 1918 + body?: never; 1919 + path?: never; 1920 + query?: never; 1921 + url: '/api/v{api-version}/multipart'; 1922 + }; 1923 + 1924 + export type MultipartResponseResponses = { 1925 + /** 1926 + * OK 1927 + */ 1928 + 200: { 1929 + file?: Blob | File; 1930 + metadata?: { 1931 + foo?: string; 1932 + bar?: string; 1933 + }; 1934 + }; 1935 + }; 1936 + 1937 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1938 + 1939 + export type MultipartRequestData = { 1940 + body?: { 1941 + content?: Blob | File; 1942 + data?: ModelWithString | null; 1943 + }; 1944 + path?: never; 1945 + query?: never; 1946 + url: '/api/v{api-version}/multipart'; 1947 + }; 1948 + 1949 + export type ComplexParamsData = { 1950 + body?: { 1951 + readonly key: string | null; 1952 + name: string | null; 1953 + enabled?: boolean; 1954 + type: 'Monkey' | 'Horse' | 'Bird'; 1955 + listOfModels?: Array<ModelWithString> | null; 1956 + listOfStrings?: Array<string> | null; 1957 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1958 + readonly user?: { 1959 + readonly id?: number; 1960 + readonly name?: string | null; 1961 + }; 1962 + }; 1963 + path: { 1964 + id: number; 1965 + /** 1966 + * api-version should be required in standalone clients 1967 + */ 1968 + 'api-version': string; 1969 + }; 1970 + query?: never; 1971 + url: '/api/v{api-version}/complex/{id}'; 1972 + }; 1973 + 1974 + export type ComplexParamsResponses = { 1975 + /** 1976 + * Success 1977 + */ 1978 + 200: ModelWithString; 1979 + }; 1980 + 1981 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 1982 + 1983 + export type CallWithResultFromHeaderData = { 1984 + body?: never; 1985 + path?: never; 1986 + query?: never; 1987 + url: '/api/v{api-version}/header'; 1988 + }; 1989 + 1990 + export type CallWithResultFromHeaderErrors = { 1991 + /** 1992 + * 400 server error 1993 + */ 1994 + 400: unknown; 1995 + /** 1996 + * 500 server error 1997 + */ 1998 + 500: unknown; 1999 + }; 2000 + 2001 + export type CallWithResultFromHeaderResponses = { 2002 + /** 2003 + * Successful response 2004 + */ 2005 + 200: unknown; 2006 + }; 2007 + 2008 + export type TestErrorCodeData = { 2009 + body?: never; 2010 + path?: never; 2011 + query: { 2012 + /** 2013 + * Status code to return 2014 + */ 2015 + status: number; 2016 + }; 2017 + url: '/api/v{api-version}/error'; 2018 + }; 2019 + 2020 + export type TestErrorCodeErrors = { 2021 + /** 2022 + * Custom message: Internal Server Error 2023 + */ 2024 + 500: unknown; 2025 + /** 2026 + * Custom message: Not Implemented 2027 + */ 2028 + 501: unknown; 2029 + /** 2030 + * Custom message: Bad Gateway 2031 + */ 2032 + 502: unknown; 2033 + /** 2034 + * Custom message: Service Unavailable 2035 + */ 2036 + 503: unknown; 2037 + }; 2038 + 2039 + export type TestErrorCodeResponses = { 2040 + /** 2041 + * Custom message: Successful response 2042 + */ 2043 + 200: unknown; 2044 + }; 2045 + 2046 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2047 + body?: never; 2048 + path?: never; 2049 + query: { 2050 + /** 2051 + * Dummy input param 2052 + */ 2053 + nonAsciiParamæøåÆØÅöôêÊ: number; 2054 + }; 2055 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2056 + }; 2057 + 2058 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2059 + /** 2060 + * Successful response 2061 + */ 2062 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2066 + 2067 + export type PutWithFormUrlEncodedData = { 2068 + body: ArrayWithStrings; 2069 + path?: never; 2070 + query?: never; 2071 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2072 + };
+3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/nestjs/default/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type { _3eNum1Период, _400, AdditionalPropertiesIntegerIssue, AdditionalPropertiesUnknownIssue, AdditionalPropertiesUnknownIssue2, AdditionalPropertiesUnknownIssue3, AdditionalPropertiesUnknownIssueWritable, AnyOfAnyAndNull, AnyOfArrays, ApiVVersionODataControllerCountData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountResponses, ArrayWithAnyOfProperties, ArrayWithArray, ArrayWithBooleans, ArrayWithNumbers, ArrayWithProperties, ArrayWithReferences, ArrayWithStrings, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithDuplicateResponsesErrors, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesResponses, CallWithNoContentResponseData, CallWithNoContentResponseResponse, CallWithNoContentResponseResponses, CallWithParametersData, CallWithResponseAndNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseResponses, CallWithResponseData, CallWithResponseResponse, CallWithResponseResponses, CallWithResponsesData, CallWithResponsesError, CallWithResponsesErrors, CallWithResponsesResponse, CallWithResponsesResponses, CallWithResultFromHeaderData, CallWithResultFromHeaderErrors, CallWithResultFromHeaderResponses, CallWithWeirdParameterNamesData, CamelCaseCommentWithBreaks, CharactersInDescription, ClientOptions, CollectionFormatData, CommentWithBackticks, CommentWithBackticksAndQuotes, CommentWithBreaks, CommentWithExpressionPlaceholders, CommentWithQuotes, CommentWithReservedCharacters, CommentWithSlashes, ComplexParamsData, ComplexParamsResponse, ComplexParamsResponses, ComplexTypesData, ComplexTypesErrors, ComplexTypesResponse, ComplexTypesResponses, CompositionBaseModel, CompositionExtendedModel, CompositionWithAllOfAndNullable, CompositionWithAnyOf, CompositionWithAnyOfAndNullable, CompositionWithAnyOfAnonymous, CompositionWithNestedAnyAndTypeNull, CompositionWithNestedAnyOfAndNull, CompositionWithOneOf, CompositionWithOneOfAndComplexArrayDictionary, CompositionWithOneOfAndNullable, CompositionWithOneOfAndProperties, CompositionWithOneOfAndSimpleArrayDictionary, CompositionWithOneOfAndSimpleDictionary, CompositionWithOneOfAnonymous, CompositionWithOneOfDiscriminator, ConstValue, Default, DeleteCallWithoutParametersAndResponseData, DeleteFooData, DeleteFooData2, DeleteFooData3, DeprecatedCallData, DeprecatedModel, DictionaryWithArray, DictionaryWithDictionary, DictionaryWithProperties, DictionaryWithPropertiesAndAdditionalProperties, DictionaryWithReference, DictionaryWithString, DummyAData, DummyAResponse, DummyAResponses, DummyBData, DummyBResponse, DummyBResponses, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, DuplicateNameData, EnumFromDescription, EnumWithExtensions, EnumWithNumbers, EnumWithReplacedCharacters, EnumWithStrings, EnumWithXEnumNames, ExportData, ExternalRefA, ExternalRefB, ExternalSharedExternalSharedModel, File, FileResponseData, FileResponseResponse, FileResponseResponses, FileWritable, FooWowData, FooWowResponses, FreeFormObjectWithAdditionalPropertiesEqEmptyObject, FreeFormObjectWithAdditionalPropertiesEqTrue, FreeFormObjectWithoutAdditionalProperties, GenericSchemaDuplicateIssue1SystemBoolean, GenericSchemaDuplicateIssue1SystemBooleanWritable, GenericSchemaDuplicateIssue1SystemString, GenericSchemaDuplicateIssue1SystemStringWritable, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, GetApiVbyApiVersionSimpleOperationErrors, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationResponses, GetCallWithOptionalParamData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, Import, ImportData, ImportResponse, ImportResponses, IoK8sApimachineryPkgApisMetaV1DeleteOptions, IoK8sApimachineryPkgApisMetaV1Preconditions, ModelCircle, ModelFromZendesk, ModelSquare, ModelThatExtends, ModelThatExtendsExtends, ModelWithAdditionalPropertiesEqTrue, ModelWithAnyOfConstantSizeArray, ModelWithAnyOfConstantSizeArrayAndIntersect, ModelWithAnyOfConstantSizeArrayNullable, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions, ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable, ModelWithArray, ModelWithArrayReadOnlyAndWriteOnly, ModelWithArrayReadOnlyAndWriteOnlyWritable, ModelWithBackticksInDescription, ModelWithBoolean, ModelWithCircularReference, ModelWithConst, ModelWithConstantSizeArray, ModelWithDictionary, ModelWithDuplicateImports, ModelWithDuplicateProperties, ModelWithEnum, ModelWithEnumFromDescription, ModelWithEnumWithHyphen, ModelWithInteger, ModelWithNestedArrayEnums, ModelWithNestedArrayEnumsData, ModelWithNestedArrayEnumsDataBar, ModelWithNestedArrayEnumsDataFoo, ModelWithNestedCompositionEnums, ModelWithNestedEnums, ModelWithNestedProperties, ModelWithNullableObject, ModelWithNullableString, ModelWithNumericEnumUnion, ModelWithOneOfAndProperties, ModelWithOneOfEnum, ModelWithOrderedProperties, ModelWithPattern, ModelWithPatternWritable, ModelWithPrefixItemsConstantSizeArray, ModelWithProperties, ModelWithPropertiesWritable, ModelWithReadOnlyAndWriteOnly, ModelWithReadOnlyAndWriteOnlyWritable, ModelWithReference, ModelWithReferenceWritable, ModelWithString, ModelWithStringError, MultipartRequestData, MultipartResponseData, MultipartResponseResponse, MultipartResponseResponses, NestedAnyOfArraysNullable, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Responses, NonAsciiStringæøåÆøÅöôêÊ字符串, NullableObject, OneOfAllOfIssue, OneOfAllOfIssueWritable, OptionsCallWithoutParametersAndResponseData, Pageable, ParameterSimpleParameterUnused, PatchApiVbyApiVersionNoTagData, PatchApiVbyApiVersionNoTagResponses, PatchCallWithoutParametersAndResponseData, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamResponses, PostCallWithoutParametersAndResponseData, PostServiceWithEmptyTagResponse, PostServiceWithEmptyTagResponse2, PutCallWithoutParametersAndResponseData, PutWithFormUrlEncodedData, SchemaWithFormRestrictedKeys, SimpleBoolean, SimpleFile, SimpleFormData, SimpleInteger, SimpleParameter, SimpleReference, SimpleRequestBody, SimpleString, SimpleStringWithPattern, TestErrorCodeData, TestErrorCodeErrors, TestErrorCodeResponses, TypesData, TypesResponse, TypesResponses, UploadFileData, UploadFileResponse, UploadFileResponses, XFooBar } from './types.gen';
+54
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/nestjs/default/nestjs.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import type { ApiVVersionODataControllerCountResponse, CallToTestOrderOfParamsData, CallWithDefaultOptionalParametersData, CallWithDefaultParametersData, CallWithDescriptionsData, CallWithDuplicateResponsesResponse, CallWithNoContentResponseResponse, CallWithParametersData, CallWithResponseAndNoContentResponseResponse, CallWithResponseResponse, CallWithResponsesResponse, CallWithWeirdParameterNamesData, CollectionFormatData, ComplexParamsData, ComplexParamsResponse, ComplexTypesData, ComplexTypesResponse, DeleteFooData3, DeprecatedCallData, DummyAResponse, DummyBResponse, FileResponseData, FileResponseResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationResponse, GetCallWithOptionalParamData, ImportData, ImportResponse, MultipartRequestData, MultipartResponseResponse, NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PostApiVbyApiVersionFormDataData, PostApiVbyApiVersionRequestBodyData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse, PutWithFormUrlEncodedData, TestErrorCodeData, TypesData, TypesResponse, UploadFileData, UploadFileResponse } from './types.gen'; 4 + 5 + export type ControllerMethods = { 6 + export: () => Promise<void>; 7 + patchApiVbyApiVersionNoTag: () => Promise<void>; 8 + import: (body: ImportData['body']) => Promise<ImportResponse>; 9 + fooWow: () => Promise<void>; 10 + apiVVersionODataControllerCount: () => Promise<ApiVVersionODataControllerCountResponse>; 11 + getApiVbyApiVersionSimpleOperation: (path: GetApiVbyApiVersionSimpleOperationData['path']) => Promise<GetApiVbyApiVersionSimpleOperationResponse>; 12 + deleteCallWithoutParametersAndResponse: () => Promise<void>; 13 + getCallWithoutParametersAndResponse: () => Promise<void>; 14 + headCallWithoutParametersAndResponse: () => Promise<void>; 15 + optionsCallWithoutParametersAndResponse: () => Promise<void>; 16 + patchCallWithoutParametersAndResponse: () => Promise<void>; 17 + postCallWithoutParametersAndResponse: () => Promise<void>; 18 + putCallWithoutParametersAndResponse: () => Promise<void>; 19 + deleteFoo: (path: DeleteFooData3['path'], headers: DeleteFooData3['headers']) => Promise<void>; 20 + callWithDescriptions: (query?: CallWithDescriptionsData['query']) => Promise<void>; 21 + deprecatedCall: (headers: DeprecatedCallData['headers']) => Promise<void>; 22 + callWithParameters: (path: CallWithParametersData['path'], query: CallWithParametersData['query'], body: CallWithParametersData['body'], headers: CallWithParametersData['headers']) => Promise<void>; 23 + callWithWeirdParameterNames: (path: CallWithWeirdParameterNamesData['path'], query: CallWithWeirdParameterNamesData['query'], body: CallWithWeirdParameterNamesData['body'], headers: CallWithWeirdParameterNamesData['headers']) => Promise<void>; 24 + getCallWithOptionalParam: (body: GetCallWithOptionalParamData['body'], query?: GetCallWithOptionalParamData['query']) => Promise<void>; 25 + postCallWithOptionalParam: (query: PostCallWithOptionalParamData['query'], body?: PostCallWithOptionalParamData['body']) => Promise<PostCallWithOptionalParamResponse>; 26 + postApiVbyApiVersionRequestBody: (query?: PostApiVbyApiVersionRequestBodyData['query'], body?: PostApiVbyApiVersionRequestBodyData['body']) => Promise<void>; 27 + postApiVbyApiVersionFormData: (query?: PostApiVbyApiVersionFormDataData['query'], body?: PostApiVbyApiVersionFormDataData['body']) => Promise<void>; 28 + callWithDefaultParameters: (query?: CallWithDefaultParametersData['query']) => Promise<void>; 29 + callWithDefaultOptionalParameters: (query?: CallWithDefaultOptionalParametersData['query']) => Promise<void>; 30 + callToTestOrderOfParams: (query: CallToTestOrderOfParamsData['query']) => Promise<void>; 31 + duplicateName: () => Promise<void>; 32 + duplicateName2: () => Promise<void>; 33 + duplicateName3: () => Promise<void>; 34 + duplicateName4: () => Promise<void>; 35 + callWithNoContentResponse: () => Promise<CallWithNoContentResponseResponse>; 36 + callWithResponseAndNoContentResponse: () => Promise<CallWithResponseAndNoContentResponseResponse>; 37 + dummyA: () => Promise<DummyAResponse>; 38 + dummyB: () => Promise<DummyBResponse>; 39 + callWithResponse: () => Promise<CallWithResponseResponse>; 40 + callWithDuplicateResponses: () => Promise<CallWithDuplicateResponsesResponse>; 41 + callWithResponses: () => Promise<CallWithResponsesResponse>; 42 + collectionFormat: (query: CollectionFormatData['query']) => Promise<void>; 43 + types: (query: TypesData['query'], path?: TypesData['path']) => Promise<TypesResponse>; 44 + uploadFile: (path: UploadFileData['path'], body: UploadFileData['body']) => Promise<UploadFileResponse>; 45 + fileResponse: (path: FileResponseData['path']) => Promise<FileResponseResponse>; 46 + complexTypes: (query: ComplexTypesData['query']) => Promise<ComplexTypesResponse>; 47 + multipartResponse: () => Promise<MultipartResponseResponse>; 48 + multipartRequest: (body?: MultipartRequestData['body']) => Promise<void>; 49 + complexParams: (path: ComplexParamsData['path'], body?: ComplexParamsData['body']) => Promise<ComplexParamsResponse>; 50 + callWithResultFromHeader: () => Promise<void>; 51 + testErrorCode: (query: TestErrorCodeData['query']) => Promise<void>; 52 + nonAsciiæøåÆøÅöôêÊ字符串: (query: NonAsciiæøåÆøÅöôêÊ字符串Data['query']) => Promise<NonAsciiæøåÆøÅöôêÊ字符串Response>; 53 + putWithFormUrlEncoded: (body: PutWithFormUrlEncodedData['body']) => Promise<void>; 54 + };
+2091
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/nestjs/default/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type ClientOptions = { 4 + baseUrl: 'http://localhost:3000/base' | (string & {}); 5 + }; 6 + 7 + /** 8 + * Model with number-only name 9 + */ 10 + export type _400 = string; 11 + 12 + /** 13 + * External ref to shared model (A) 14 + */ 15 + export type ExternalRefA = ExternalSharedExternalSharedModel; 16 + 17 + /** 18 + * External ref to shared model (B) 19 + */ 20 + export type ExternalRefB = ExternalSharedExternalSharedModel; 21 + 22 + /** 23 + * Testing multiline comments in string: First line 24 + * Second line 25 + * 26 + * Fourth line 27 + */ 28 + export type CamelCaseCommentWithBreaks = number; 29 + 30 + /** 31 + * Testing multiline comments in string: First line 32 + * Second line 33 + * 34 + * Fourth line 35 + */ 36 + export type CommentWithBreaks = number; 37 + 38 + /** 39 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 40 + */ 41 + export type CommentWithBackticks = number; 42 + 43 + /** 44 + * Testing backticks and quotes in string: `backticks`, 'quotes', "double quotes" and ```multiple backticks``` should work 45 + */ 46 + export type CommentWithBackticksAndQuotes = number; 47 + 48 + /** 49 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 50 + */ 51 + export type CommentWithSlashes = number; 52 + 53 + /** 54 + * Testing expression placeholders in string: ${expression} should work 55 + */ 56 + export type CommentWithExpressionPlaceholders = number; 57 + 58 + /** 59 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 60 + */ 61 + export type CommentWithQuotes = number; 62 + 63 + /** 64 + * Testing reserved characters in string: * inline * and ** inline ** should work 65 + */ 66 + export type CommentWithReservedCharacters = number; 67 + 68 + /** 69 + * This is a simple number 70 + */ 71 + export type SimpleInteger = number; 72 + 73 + /** 74 + * This is a simple boolean 75 + */ 76 + export type SimpleBoolean = boolean; 77 + 78 + /** 79 + * This is a simple string 80 + */ 81 + export type SimpleString = string; 82 + 83 + /** 84 + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) 85 + */ 86 + export type NonAsciiStringæøåÆøÅöôêÊ字符串 = string; 87 + 88 + /** 89 + * This is a simple file 90 + */ 91 + export type SimpleFile = Blob | File; 92 + 93 + /** 94 + * This is a simple reference 95 + */ 96 + export type SimpleReference = ModelWithString; 97 + 98 + /** 99 + * This is a simple string 100 + */ 101 + export type SimpleStringWithPattern = string | null; 102 + 103 + /** 104 + * This is a simple enum with strings 105 + */ 106 + export type EnumWithStrings = 'Success' | 'Warning' | 'Error' | '\'Single Quote\'' | '"Double Quotes"' | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; 107 + 108 + export type EnumWithReplacedCharacters = '\'Single Quote\'' | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; 109 + 110 + /** 111 + * This is a simple enum with numbers 112 + */ 113 + export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; 114 + 115 + /** 116 + * Success=1,Warning=2,Error=3 117 + */ 118 + export type EnumFromDescription = number; 119 + 120 + /** 121 + * This is a simple enum with numbers 122 + */ 123 + export type EnumWithExtensions = 200 | 400 | 500; 124 + 125 + export type EnumWithXEnumNames = 0 | 1 | 2; 126 + 127 + /** 128 + * This is a simple array with numbers 129 + */ 130 + export type ArrayWithNumbers = Array<number>; 131 + 132 + /** 133 + * This is a simple array with booleans 134 + */ 135 + export type ArrayWithBooleans = Array<boolean>; 136 + 137 + /** 138 + * This is a simple array with strings 139 + */ 140 + export type ArrayWithStrings = Array<string>; 141 + 142 + /** 143 + * This is a simple array with references 144 + */ 145 + export type ArrayWithReferences = Array<ModelWithString>; 146 + 147 + /** 148 + * This is a simple array containing an array 149 + */ 150 + export type ArrayWithArray = Array<Array<ModelWithString>>; 151 + 152 + /** 153 + * This is a simple array with properties 154 + */ 155 + export type ArrayWithProperties = Array<{ 156 + '16x16'?: CamelCaseCommentWithBreaks; 157 + bar?: string; 158 + }>; 159 + 160 + /** 161 + * This is a simple array with any of properties 162 + */ 163 + export type ArrayWithAnyOfProperties = Array<{ 164 + foo?: string; 165 + } | { 166 + bar?: string; 167 + }>; 168 + 169 + export type AnyOfAnyAndNull = { 170 + data?: unknown | null; 171 + }; 172 + 173 + /** 174 + * This is a simple array with any of properties 175 + */ 176 + export type AnyOfArrays = { 177 + results?: Array<{ 178 + foo?: string; 179 + } | { 180 + bar?: string; 181 + }>; 182 + }; 183 + 184 + /** 185 + * This is a string dictionary 186 + */ 187 + export type DictionaryWithString = { 188 + [key: string]: string; 189 + }; 190 + 191 + export type DictionaryWithPropertiesAndAdditionalProperties = { 192 + foo?: number; 193 + bar?: boolean; 194 + [key: string]: string | number | boolean | undefined; 195 + }; 196 + 197 + /** 198 + * This is a string reference 199 + */ 200 + export type DictionaryWithReference = { 201 + [key: string]: ModelWithString; 202 + }; 203 + 204 + /** 205 + * This is a complex dictionary 206 + */ 207 + export type DictionaryWithArray = { 208 + [key: string]: Array<ModelWithString>; 209 + }; 210 + 211 + /** 212 + * This is a string dictionary 213 + */ 214 + export type DictionaryWithDictionary = { 215 + [key: string]: { 216 + [key: string]: string; 217 + }; 218 + }; 219 + 220 + /** 221 + * This is a complex dictionary 222 + */ 223 + export type DictionaryWithProperties = { 224 + [key: string]: { 225 + foo?: string; 226 + bar?: string; 227 + }; 228 + }; 229 + 230 + /** 231 + * This is a model with one number property 232 + */ 233 + export type ModelWithInteger = { 234 + /** 235 + * This is a simple number property 236 + */ 237 + prop?: number; 238 + }; 239 + 240 + /** 241 + * This is a model with one boolean property 242 + */ 243 + export type ModelWithBoolean = { 244 + /** 245 + * This is a simple boolean property 246 + */ 247 + prop?: boolean; 248 + }; 249 + 250 + /** 251 + * This is a model with one string property 252 + */ 253 + export type ModelWithString = { 254 + /** 255 + * This is a simple string property 256 + */ 257 + prop?: string; 258 + }; 259 + 260 + /** 261 + * This is a model with one string property 262 + */ 263 + export type ModelWithStringError = { 264 + /** 265 + * This is a simple string property 266 + */ 267 + prop?: string; 268 + }; 269 + 270 + /** 271 + * `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) 272 + */ 273 + export type ModelFromZendesk = string; 274 + 275 + /** 276 + * This is a model with one string property 277 + */ 278 + export type ModelWithNullableString = { 279 + /** 280 + * This is a simple string property 281 + */ 282 + nullableProp1?: string | null; 283 + /** 284 + * This is a simple string property 285 + */ 286 + nullableRequiredProp1: string | null; 287 + /** 288 + * This is a simple string property 289 + */ 290 + nullableProp2?: string | null; 291 + /** 292 + * This is a simple string property 293 + */ 294 + nullableRequiredProp2: string | null; 295 + /** 296 + * This is a simple enum with strings 297 + */ 298 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 299 + }; 300 + 301 + /** 302 + * This is a model with one enum 303 + */ 304 + export type ModelWithEnum = { 305 + /** 306 + * This is a simple enum with strings 307 + */ 308 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 309 + /** 310 + * These are the HTTP error code enums 311 + */ 312 + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; 313 + /** 314 + * Simple boolean enum 315 + */ 316 + bool?: true; 317 + }; 318 + 319 + /** 320 + * This is a model with one enum with escaped name 321 + */ 322 + export type ModelWithEnumWithHyphen = { 323 + /** 324 + * Foo-Bar-Baz-Qux 325 + */ 326 + 'foo-bar-baz-qux'?: '3.0'; 327 + }; 328 + 329 + /** 330 + * This is a model with one enum 331 + */ 332 + export type ModelWithEnumFromDescription = { 333 + /** 334 + * Success=1,Warning=2,Error=3 335 + */ 336 + test?: number; 337 + }; 338 + 339 + /** 340 + * This is a model with nested enums 341 + */ 342 + export type ModelWithNestedEnums = { 343 + dictionaryWithEnum?: { 344 + [key: string]: 'Success' | 'Warning' | 'Error'; 345 + }; 346 + dictionaryWithEnumFromDescription?: { 347 + [key: string]: number; 348 + }; 349 + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; 350 + arrayWithDescription?: Array<number>; 351 + /** 352 + * This is a simple enum with strings 353 + */ 354 + 'foo_bar-enum'?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; 355 + }; 356 + 357 + /** 358 + * This is a model with one property containing a reference 359 + */ 360 + export type ModelWithReference = { 361 + prop?: ModelWithProperties; 362 + }; 363 + 364 + /** 365 + * This is a model with one property containing an array 366 + */ 367 + export type ModelWithArrayReadOnlyAndWriteOnly = { 368 + prop?: Array<ModelWithReadOnlyAndWriteOnly>; 369 + propWithFile?: Array<Blob | File>; 370 + propWithNumber?: Array<number>; 371 + }; 372 + 373 + /** 374 + * This is a model with one property containing an array 375 + */ 376 + export type ModelWithArray = { 377 + prop?: Array<ModelWithString>; 378 + propWithFile?: Array<Blob | File>; 379 + propWithNumber?: Array<number>; 380 + }; 381 + 382 + /** 383 + * This is a model with one property containing a dictionary 384 + */ 385 + export type ModelWithDictionary = { 386 + prop?: { 387 + [key: string]: string; 388 + }; 389 + }; 390 + 391 + /** 392 + * This is a deprecated model with a deprecated property 393 + * 394 + * @deprecated 395 + */ 396 + export type DeprecatedModel = { 397 + /** 398 + * This is a deprecated property 399 + * 400 + * @deprecated 401 + */ 402 + prop?: string; 403 + }; 404 + 405 + /** 406 + * This is a model with one property containing a circular reference 407 + */ 408 + export type ModelWithCircularReference = { 409 + prop?: ModelWithCircularReference; 410 + }; 411 + 412 + /** 413 + * This is a model with one property with a 'one of' relationship 414 + */ 415 + export type CompositionWithOneOf = { 416 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 417 + }; 418 + 419 + /** 420 + * This is a model with one property with a 'one of' relationship where the options are not $ref 421 + */ 422 + export type CompositionWithOneOfAnonymous = { 423 + propA?: { 424 + propA?: string; 425 + } | string | number; 426 + }; 427 + 428 + /** 429 + * Circle 430 + */ 431 + export type ModelCircle = { 432 + kind: string; 433 + radius?: number; 434 + }; 435 + 436 + /** 437 + * Square 438 + */ 439 + export type ModelSquare = { 440 + kind: string; 441 + sideLength?: number; 442 + }; 443 + 444 + /** 445 + * This is a model with one property with a 'one of' relationship where the options are not $ref 446 + */ 447 + export type CompositionWithOneOfDiscriminator = ({ 448 + kind: 'circle'; 449 + } & ModelCircle) | ({ 450 + kind: 'square'; 451 + } & ModelSquare); 452 + 453 + /** 454 + * This is a model with one property with a 'any of' relationship 455 + */ 456 + export type CompositionWithAnyOf = { 457 + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 458 + }; 459 + 460 + /** 461 + * This is a model with one property with a 'any of' relationship where the options are not $ref 462 + */ 463 + export type CompositionWithAnyOfAnonymous = { 464 + propA?: { 465 + propA?: string; 466 + } | string | number; 467 + }; 468 + 469 + /** 470 + * This is a model with nested 'any of' property with a type null 471 + */ 472 + export type CompositionWithNestedAnyAndTypeNull = { 473 + propA?: Array<ModelWithDictionary | null> | Array<ModelWithArray | null>; 474 + }; 475 + 476 + export type _3eNum1Период = 'Bird' | 'Dog'; 477 + 478 + export type ConstValue = 'ConstValue'; 479 + 480 + /** 481 + * This is a model with one property with a 'any of' relationship where the options are not $ref 482 + */ 483 + export type CompositionWithNestedAnyOfAndNull = { 484 + /** 485 + * Scopes 486 + */ 487 + propA?: Array<_3eNum1Период | ConstValue> | null; 488 + }; 489 + 490 + /** 491 + * This is a model with one property with a 'one of' relationship 492 + */ 493 + export type CompositionWithOneOfAndNullable = { 494 + propA?: { 495 + boolean?: boolean; 496 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 497 + }; 498 + 499 + /** 500 + * This is a model that contains a simple dictionary within composition 501 + */ 502 + export type CompositionWithOneOfAndSimpleDictionary = { 503 + propA?: boolean | { 504 + [key: string]: number; 505 + }; 506 + }; 507 + 508 + /** 509 + * This is a model that contains a dictionary of simple arrays within composition 510 + */ 511 + export type CompositionWithOneOfAndSimpleArrayDictionary = { 512 + propA?: boolean | { 513 + [key: string]: Array<boolean>; 514 + }; 515 + }; 516 + 517 + /** 518 + * This is a model that contains a dictionary of complex arrays (composited) within composition 519 + */ 520 + export type CompositionWithOneOfAndComplexArrayDictionary = { 521 + propA?: boolean | { 522 + [key: string]: Array<number | string>; 523 + }; 524 + }; 525 + 526 + /** 527 + * This is a model with one property with a 'all of' relationship 528 + */ 529 + export type CompositionWithAllOfAndNullable = { 530 + propA?: ({ 531 + boolean?: boolean; 532 + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; 533 + }; 534 + 535 + /** 536 + * This is a model with one property with a 'any of' relationship 537 + */ 538 + export type CompositionWithAnyOfAndNullable = { 539 + propA?: { 540 + boolean?: boolean; 541 + } | ModelWithEnum | ModelWithArray | ModelWithDictionary | null; 542 + }; 543 + 544 + /** 545 + * This is a base model with two simple optional properties 546 + */ 547 + export type CompositionBaseModel = { 548 + firstName?: string; 549 + lastname?: string; 550 + }; 551 + 552 + /** 553 + * This is a model that extends the base model 554 + */ 555 + export type CompositionExtendedModel = CompositionBaseModel & { 556 + age: number; 557 + firstName: string; 558 + lastname: string; 559 + }; 560 + 561 + /** 562 + * This is a model with one nested property 563 + */ 564 + export type ModelWithProperties = { 565 + required: string; 566 + readonly requiredAndReadOnly: string; 567 + requiredAndNullable: string | null; 568 + string?: string; 569 + number?: number; 570 + boolean?: boolean; 571 + reference?: ModelWithString; 572 + 'property with space'?: string; 573 + default?: string; 574 + try?: string; 575 + readonly '@namespace.string'?: string; 576 + readonly '@namespace.integer'?: number; 577 + }; 578 + 579 + /** 580 + * This is a model with one nested property 581 + */ 582 + export type ModelWithNestedProperties = { 583 + readonly first: { 584 + readonly second: { 585 + readonly third: string | null; 586 + } | null; 587 + } | null; 588 + }; 589 + 590 + /** 591 + * This is a model with duplicated properties 592 + */ 593 + export type ModelWithDuplicateProperties = { 594 + prop?: ModelWithString; 595 + }; 596 + 597 + /** 598 + * This is a model with ordered properties 599 + */ 600 + export type ModelWithOrderedProperties = { 601 + zebra?: string; 602 + apple?: string; 603 + hawaii?: string; 604 + }; 605 + 606 + /** 607 + * This is a model with duplicated imports 608 + */ 609 + export type ModelWithDuplicateImports = { 610 + propA?: ModelWithString; 611 + propB?: ModelWithString; 612 + propC?: ModelWithString; 613 + }; 614 + 615 + /** 616 + * This is a model that extends another model 617 + */ 618 + export type ModelThatExtends = ModelWithString & { 619 + propExtendsA?: string; 620 + propExtendsB?: ModelWithString; 621 + }; 622 + 623 + /** 624 + * This is a model that extends another model 625 + */ 626 + export type ModelThatExtendsExtends = ModelWithString & ModelThatExtends & { 627 + propExtendsC?: string; 628 + propExtendsD?: ModelWithString; 629 + }; 630 + 631 + /** 632 + * This is a model that contains a some patterns 633 + */ 634 + export type ModelWithPattern = { 635 + key: string; 636 + name: string; 637 + readonly enabled?: boolean; 638 + readonly modified?: string; 639 + id?: string; 640 + text?: string; 641 + patternWithSingleQuotes?: string; 642 + patternWithNewline?: string; 643 + patternWithBacktick?: string; 644 + }; 645 + 646 + export type File = { 647 + /** 648 + * Id 649 + */ 650 + readonly id?: string; 651 + /** 652 + * Updated at 653 + */ 654 + readonly updated_at?: string; 655 + /** 656 + * Created at 657 + */ 658 + readonly created_at?: string; 659 + /** 660 + * Mime 661 + */ 662 + mime: string; 663 + /** 664 + * File 665 + */ 666 + readonly file?: string; 667 + }; 668 + 669 + export type Default = { 670 + name?: string; 671 + }; 672 + 673 + export type Pageable = { 674 + page?: number; 675 + size?: number; 676 + sort?: Array<string>; 677 + }; 678 + 679 + /** 680 + * This is a free-form object without additionalProperties. 681 + */ 682 + export type FreeFormObjectWithoutAdditionalProperties = { 683 + [key: string]: unknown; 684 + }; 685 + 686 + /** 687 + * This is a free-form object with additionalProperties: true. 688 + */ 689 + export type FreeFormObjectWithAdditionalPropertiesEqTrue = { 690 + [key: string]: unknown; 691 + }; 692 + 693 + /** 694 + * This is a free-form object with additionalProperties: {}. 695 + */ 696 + export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { 697 + [key: string]: unknown; 698 + }; 699 + 700 + export type ModelWithConst = { 701 + String?: 'String'; 702 + number?: 0; 703 + null?: null; 704 + withType?: 'Some string'; 705 + }; 706 + 707 + /** 708 + * This is a model with one property and additionalProperties: true 709 + */ 710 + export type ModelWithAdditionalPropertiesEqTrue = { 711 + /** 712 + * This is a simple string property 713 + */ 714 + prop?: string; 715 + [key: string]: unknown | string | undefined; 716 + }; 717 + 718 + export type NestedAnyOfArraysNullable = { 719 + nullableArray?: Array<string | boolean> | null; 720 + }; 721 + 722 + export type CompositionWithOneOfAndProperties = ({ 723 + foo: SimpleParameter; 724 + } | { 725 + bar: NonAsciiStringæøåÆøÅöôêÊ字符串; 726 + }) & { 727 + baz: number | null; 728 + qux: number; 729 + }; 730 + 731 + /** 732 + * An object that can be null 733 + */ 734 + export type NullableObject = { 735 + foo?: string; 736 + } | null; 737 + 738 + /** 739 + * Some % character 740 + */ 741 + export type CharactersInDescription = string; 742 + 743 + export type ModelWithNullableObject = { 744 + data?: NullableObject; 745 + }; 746 + 747 + export type ModelWithOneOfEnum = { 748 + foo: 'Bar'; 749 + } | { 750 + foo: 'Baz'; 751 + } | { 752 + foo: 'Qux'; 753 + } | { 754 + content: string; 755 + foo: 'Quux'; 756 + } | { 757 + content: [ 758 + string, 759 + string 760 + ]; 761 + foo: 'Corge'; 762 + }; 763 + 764 + export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; 765 + 766 + export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; 767 + 768 + export type ModelWithNestedArrayEnumsData = { 769 + foo?: Array<ModelWithNestedArrayEnumsDataFoo>; 770 + bar?: Array<ModelWithNestedArrayEnumsDataBar>; 771 + }; 772 + 773 + export type ModelWithNestedArrayEnums = { 774 + array_strings?: Array<string>; 775 + data?: ModelWithNestedArrayEnumsData; 776 + }; 777 + 778 + export type ModelWithNestedCompositionEnums = { 779 + foo?: ModelWithNestedArrayEnumsDataFoo; 780 + }; 781 + 782 + export type ModelWithReadOnlyAndWriteOnly = { 783 + foo: string; 784 + readonly bar: string; 785 + }; 786 + 787 + export type ModelWithConstantSizeArray = [ 788 + number, 789 + number 790 + ]; 791 + 792 + export type ModelWithAnyOfConstantSizeArray = [ 793 + number | string, 794 + number | string, 795 + number | string 796 + ]; 797 + 798 + export type ModelWithPrefixItemsConstantSizeArray = [ 799 + ModelWithInteger, 800 + number | string, 801 + string 802 + ]; 803 + 804 + export type ModelWithAnyOfConstantSizeArrayNullable = [ 805 + number | null | string, 806 + number | null | string, 807 + number | null | string 808 + ]; 809 + 810 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptions = [ 811 + number | Import, 812 + number | Import 813 + ]; 814 + 815 + export type ModelWithAnyOfConstantSizeArrayAndIntersect = [ 816 + number & string, 817 + number & string 818 + ]; 819 + 820 + export type ModelWithNumericEnumUnion = { 821 + /** 822 + * Период 823 + */ 824 + value?: -10 | -1 | 0 | 1 | 3 | 6 | 12; 825 + }; 826 + 827 + /** 828 + * Some description with `back ticks` 829 + */ 830 + export type ModelWithBackticksInDescription = { 831 + /** 832 + * The template `that` should be used for parsing and importing the contents of the CSV file. 833 + * 834 + * <br/><p>There is one placeholder currently supported:<ul> <li><b>${x}</b> - refers to the n-th column in the CSV file, e.g. ${1}, ${2}, ...)</li></ul><p>Example of a correct JSON template:</p> 835 + * <pre> 836 + * [ 837 + * { 838 + * "resourceType": "Asset", 839 + * "identifier": { 840 + * "name": "${1}", 841 + * "domain": { 842 + * "name": "${2}", 843 + * "community": { 844 + * "name": "Some Community" 845 + * } 846 + * } 847 + * }, 848 + * "attributes" : { 849 + * "00000000-0000-0000-0000-000000003115" : [ { 850 + * "value" : "${3}" 851 + * } ], 852 + * "00000000-0000-0000-0000-000000000222" : [ { 853 + * "value" : "${4}" 854 + * } ] 855 + * } 856 + * } 857 + * ] 858 + * </pre> 859 + */ 860 + template?: string; 861 + }; 862 + 863 + export type ModelWithOneOfAndProperties = (SimpleParameter | NonAsciiStringæøåÆøÅöôêÊ字符串) & { 864 + baz: number | null; 865 + qux: number; 866 + }; 867 + 868 + /** 869 + * Model used to test deduplication strategy (unused) 870 + */ 871 + export type ParameterSimpleParameterUnused = string; 872 + 873 + /** 874 + * Model used to test deduplication strategy 875 + */ 876 + export type PostServiceWithEmptyTagResponse = string; 877 + 878 + /** 879 + * Model used to test deduplication strategy 880 + */ 881 + export type PostServiceWithEmptyTagResponse2 = string; 882 + 883 + /** 884 + * Model used to test deduplication strategy 885 + */ 886 + export type DeleteFooData = string; 887 + 888 + /** 889 + * Model used to test deduplication strategy 890 + */ 891 + export type DeleteFooData2 = string; 892 + 893 + /** 894 + * Model with restricted keyword name 895 + */ 896 + export type Import = string; 897 + 898 + export type SchemaWithFormRestrictedKeys = { 899 + description?: string; 900 + 'x-enum-descriptions'?: string; 901 + 'x-enum-varnames'?: string; 902 + 'x-enumNames'?: string; 903 + title?: string; 904 + object?: { 905 + description?: string; 906 + 'x-enum-descriptions'?: string; 907 + 'x-enum-varnames'?: string; 908 + 'x-enumNames'?: string; 909 + title?: string; 910 + }; 911 + array?: Array<{ 912 + description?: string; 913 + 'x-enum-descriptions'?: string; 914 + 'x-enum-varnames'?: string; 915 + 'x-enumNames'?: string; 916 + title?: string; 917 + }>; 918 + }; 919 + 920 + /** 921 + * This schema was giving PascalCase transformations a hard time 922 + */ 923 + export type IoK8sApimachineryPkgApisMetaV1DeleteOptions = { 924 + /** 925 + * Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned. 926 + */ 927 + preconditions?: IoK8sApimachineryPkgApisMetaV1Preconditions; 928 + }; 929 + 930 + /** 931 + * This schema was giving PascalCase transformations a hard time 932 + */ 933 + export type IoK8sApimachineryPkgApisMetaV1Preconditions = { 934 + /** 935 + * Specifies the target ResourceVersion 936 + */ 937 + resourceVersion?: string; 938 + /** 939 + * Specifies the target UID. 940 + */ 941 + uid?: string; 942 + }; 943 + 944 + export type AdditionalPropertiesUnknownIssue = { 945 + [key: string]: string | number; 946 + }; 947 + 948 + export type AdditionalPropertiesUnknownIssue2 = { 949 + [key: string]: string | number; 950 + }; 951 + 952 + export type AdditionalPropertiesUnknownIssue3 = string & { 953 + entries: { 954 + [key: string]: AdditionalPropertiesUnknownIssue; 955 + }; 956 + }; 957 + 958 + export type AdditionalPropertiesIntegerIssue = { 959 + value: number; 960 + [key: string]: number; 961 + }; 962 + 963 + export type OneOfAllOfIssue = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 964 + 965 + export type GenericSchemaDuplicateIssue1SystemBoolean = { 966 + item?: boolean; 967 + error?: string | null; 968 + readonly hasError?: boolean; 969 + data?: { 970 + [key: string]: never; 971 + }; 972 + }; 973 + 974 + export type GenericSchemaDuplicateIssue1SystemString = { 975 + item?: string | null; 976 + error?: string | null; 977 + readonly hasError?: boolean; 978 + }; 979 + 980 + export type ExternalSharedExternalSharedModel = { 981 + id: string; 982 + name?: string; 983 + }; 984 + 985 + /** 986 + * This is a model with one property containing a reference 987 + */ 988 + export type ModelWithReferenceWritable = { 989 + prop?: ModelWithPropertiesWritable; 990 + }; 991 + 992 + /** 993 + * This is a model with one property containing an array 994 + */ 995 + export type ModelWithArrayReadOnlyAndWriteOnlyWritable = { 996 + prop?: Array<ModelWithReadOnlyAndWriteOnlyWritable>; 997 + propWithFile?: Array<Blob | File>; 998 + propWithNumber?: Array<number>; 999 + }; 1000 + 1001 + /** 1002 + * This is a model with one nested property 1003 + */ 1004 + export type ModelWithPropertiesWritable = { 1005 + required: string; 1006 + requiredAndNullable: string | null; 1007 + string?: string; 1008 + number?: number; 1009 + boolean?: boolean; 1010 + reference?: ModelWithString; 1011 + 'property with space'?: string; 1012 + default?: string; 1013 + try?: string; 1014 + }; 1015 + 1016 + /** 1017 + * This is a model that contains a some patterns 1018 + */ 1019 + export type ModelWithPatternWritable = { 1020 + key: string; 1021 + name: string; 1022 + id?: string; 1023 + text?: string; 1024 + patternWithSingleQuotes?: string; 1025 + patternWithNewline?: string; 1026 + patternWithBacktick?: string; 1027 + }; 1028 + 1029 + export type FileWritable = { 1030 + /** 1031 + * Mime 1032 + */ 1033 + mime: string; 1034 + }; 1035 + 1036 + export type ModelWithReadOnlyAndWriteOnlyWritable = { 1037 + foo: string; 1038 + baz: string; 1039 + }; 1040 + 1041 + export type ModelWithAnyOfConstantSizeArrayWithNSizeAndOptionsWritable = [ 1042 + number | Import, 1043 + number | Import 1044 + ]; 1045 + 1046 + export type AdditionalPropertiesUnknownIssueWritable = { 1047 + [key: string]: string | number; 1048 + }; 1049 + 1050 + export type OneOfAllOfIssueWritable = ((ConstValue | GenericSchemaDuplicateIssue1SystemBoolean) & _3eNum1Период) | GenericSchemaDuplicateIssue1SystemString; 1051 + 1052 + export type GenericSchemaDuplicateIssue1SystemBooleanWritable = { 1053 + item?: boolean; 1054 + error?: string | null; 1055 + data?: { 1056 + [key: string]: never; 1057 + }; 1058 + }; 1059 + 1060 + export type GenericSchemaDuplicateIssue1SystemStringWritable = { 1061 + item?: string | null; 1062 + error?: string | null; 1063 + }; 1064 + 1065 + /** 1066 + * This is a reusable parameter 1067 + */ 1068 + export type SimpleParameter = string; 1069 + 1070 + /** 1071 + * Parameter with illegal characters 1072 + */ 1073 + export type XFooBar = ModelWithString; 1074 + 1075 + /** 1076 + * A reusable request body 1077 + */ 1078 + export type SimpleRequestBody = ModelWithString; 1079 + 1080 + /** 1081 + * A reusable request body 1082 + */ 1083 + export type SimpleFormData = ModelWithString; 1084 + 1085 + export type ExportData = { 1086 + body?: never; 1087 + path?: never; 1088 + query?: never; 1089 + url: '/api/v{api-version}/no+tag'; 1090 + }; 1091 + 1092 + export type PatchApiVbyApiVersionNoTagData = { 1093 + body?: never; 1094 + path?: never; 1095 + query?: never; 1096 + url: '/api/v{api-version}/no+tag'; 1097 + }; 1098 + 1099 + export type PatchApiVbyApiVersionNoTagResponses = { 1100 + /** 1101 + * OK 1102 + */ 1103 + default: unknown; 1104 + }; 1105 + 1106 + export type ImportData = { 1107 + body: ModelWithReadOnlyAndWriteOnlyWritable | ModelWithArrayReadOnlyAndWriteOnlyWritable; 1108 + path?: never; 1109 + query?: never; 1110 + url: '/api/v{api-version}/no+tag'; 1111 + }; 1112 + 1113 + export type ImportResponses = { 1114 + /** 1115 + * Success 1116 + */ 1117 + 200: ModelFromZendesk; 1118 + /** 1119 + * Default success response 1120 + */ 1121 + default: ModelWithReadOnlyAndWriteOnly; 1122 + }; 1123 + 1124 + export type ImportResponse = ImportResponses[keyof ImportResponses]; 1125 + 1126 + export type FooWowData = { 1127 + body?: never; 1128 + path?: never; 1129 + query?: never; 1130 + url: '/api/v{api-version}/no+tag'; 1131 + }; 1132 + 1133 + export type FooWowResponses = { 1134 + /** 1135 + * OK 1136 + */ 1137 + default: unknown; 1138 + }; 1139 + 1140 + export type ApiVVersionODataControllerCountData = { 1141 + body?: never; 1142 + path?: never; 1143 + query?: never; 1144 + url: '/api/v{api-version}/simple/$count'; 1145 + }; 1146 + 1147 + export type ApiVVersionODataControllerCountResponses = { 1148 + /** 1149 + * Success 1150 + */ 1151 + 200: ModelFromZendesk; 1152 + }; 1153 + 1154 + export type ApiVVersionODataControllerCountResponse = ApiVVersionODataControllerCountResponses[keyof ApiVVersionODataControllerCountResponses]; 1155 + 1156 + export type GetApiVbyApiVersionSimpleOperationData = { 1157 + body?: never; 1158 + path: { 1159 + /** 1160 + * foo in method 1161 + */ 1162 + foo_param: string; 1163 + }; 1164 + query?: never; 1165 + url: '/api/v{api-version}/simple:operation'; 1166 + }; 1167 + 1168 + export type GetApiVbyApiVersionSimpleOperationErrors = { 1169 + /** 1170 + * Default error response 1171 + */ 1172 + default: ModelWithBoolean; 1173 + }; 1174 + 1175 + export type GetApiVbyApiVersionSimpleOperationError = GetApiVbyApiVersionSimpleOperationErrors[keyof GetApiVbyApiVersionSimpleOperationErrors]; 1176 + 1177 + export type GetApiVbyApiVersionSimpleOperationResponses = { 1178 + /** 1179 + * Response is a simple number 1180 + */ 1181 + 200: number; 1182 + }; 1183 + 1184 + export type GetApiVbyApiVersionSimpleOperationResponse = GetApiVbyApiVersionSimpleOperationResponses[keyof GetApiVbyApiVersionSimpleOperationResponses]; 1185 + 1186 + export type DeleteCallWithoutParametersAndResponseData = { 1187 + body?: never; 1188 + path?: never; 1189 + query?: never; 1190 + url: '/api/v{api-version}/simple'; 1191 + }; 1192 + 1193 + export type GetCallWithoutParametersAndResponseData = { 1194 + body?: never; 1195 + path?: never; 1196 + query?: never; 1197 + url: '/api/v{api-version}/simple'; 1198 + }; 1199 + 1200 + export type HeadCallWithoutParametersAndResponseData = { 1201 + body?: never; 1202 + path?: never; 1203 + query?: never; 1204 + url: '/api/v{api-version}/simple'; 1205 + }; 1206 + 1207 + export type OptionsCallWithoutParametersAndResponseData = { 1208 + body?: never; 1209 + path?: never; 1210 + query?: never; 1211 + url: '/api/v{api-version}/simple'; 1212 + }; 1213 + 1214 + export type PatchCallWithoutParametersAndResponseData = { 1215 + body?: never; 1216 + path?: never; 1217 + query?: never; 1218 + url: '/api/v{api-version}/simple'; 1219 + }; 1220 + 1221 + export type PostCallWithoutParametersAndResponseData = { 1222 + body?: never; 1223 + path?: never; 1224 + query?: never; 1225 + url: '/api/v{api-version}/simple'; 1226 + }; 1227 + 1228 + export type PutCallWithoutParametersAndResponseData = { 1229 + body?: never; 1230 + path?: never; 1231 + query?: never; 1232 + url: '/api/v{api-version}/simple'; 1233 + }; 1234 + 1235 + export type DeleteFooData3 = { 1236 + body?: never; 1237 + headers: { 1238 + /** 1239 + * Parameter with illegal characters 1240 + */ 1241 + 'x-Foo-Bar': ModelWithString; 1242 + }; 1243 + path: { 1244 + /** 1245 + * foo in method 1246 + */ 1247 + foo_param: string; 1248 + /** 1249 + * bar in method 1250 + */ 1251 + BarParam: string; 1252 + }; 1253 + query?: never; 1254 + url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}'; 1255 + }; 1256 + 1257 + export type CallWithDescriptionsData = { 1258 + body?: never; 1259 + path?: never; 1260 + query?: { 1261 + /** 1262 + * Testing multiline comments in string: First line 1263 + * Second line 1264 + * 1265 + * Fourth line 1266 + */ 1267 + parameterWithBreaks?: string; 1268 + /** 1269 + * Testing backticks in string: `backticks` and ```multiple backticks``` should work 1270 + */ 1271 + parameterWithBackticks?: string; 1272 + /** 1273 + * Testing slashes in string: \backwards\\\ and /forwards/// should work 1274 + */ 1275 + parameterWithSlashes?: string; 1276 + /** 1277 + * Testing expression placeholders in string: ${expression} should work 1278 + */ 1279 + parameterWithExpressionPlaceholders?: string; 1280 + /** 1281 + * Testing quotes in string: 'single quote''' and "double quotes""" should work 1282 + */ 1283 + parameterWithQuotes?: string; 1284 + /** 1285 + * Testing reserved characters in string: * inline * and ** inline ** should work 1286 + */ 1287 + parameterWithReservedCharacters?: string; 1288 + }; 1289 + url: '/api/v{api-version}/descriptions'; 1290 + }; 1291 + 1292 + export type DeprecatedCallData = { 1293 + body?: never; 1294 + headers: { 1295 + /** 1296 + * This parameter is deprecated 1297 + * 1298 + * @deprecated 1299 + */ 1300 + parameter: DeprecatedModel | null; 1301 + }; 1302 + path?: never; 1303 + query?: never; 1304 + url: '/api/v{api-version}/parameters/deprecated'; 1305 + }; 1306 + 1307 + export type CallWithParametersData = { 1308 + /** 1309 + * This is the parameter that goes into the body 1310 + */ 1311 + body: { 1312 + [key: string]: unknown; 1313 + } | null; 1314 + headers: { 1315 + /** 1316 + * This is the parameter that goes into the header 1317 + */ 1318 + parameterHeader: string | null; 1319 + }; 1320 + path: { 1321 + /** 1322 + * This is the parameter that goes into the path 1323 + */ 1324 + parameterPath: string | null; 1325 + /** 1326 + * api-version should be required in standalone clients 1327 + */ 1328 + 'api-version': string | null; 1329 + }; 1330 + query: { 1331 + foo_ref_enum?: ModelWithNestedArrayEnumsDataFoo; 1332 + foo_all_of_enum: ModelWithNestedArrayEnumsDataFoo; 1333 + /** 1334 + * This is the parameter that goes into the query params 1335 + */ 1336 + cursor: string | null; 1337 + }; 1338 + url: '/api/v{api-version}/parameters/{parameterPath}'; 1339 + }; 1340 + 1341 + export type CallWithWeirdParameterNamesData = { 1342 + /** 1343 + * This is the parameter that goes into the body 1344 + */ 1345 + body: ModelWithString | null; 1346 + headers: { 1347 + /** 1348 + * This is the parameter that goes into the request header 1349 + */ 1350 + 'parameter.header': string | null; 1351 + }; 1352 + path: { 1353 + /** 1354 + * This is the parameter that goes into the path 1355 + */ 1356 + 'parameter.path.1'?: string; 1357 + /** 1358 + * This is the parameter that goes into the path 1359 + */ 1360 + 'parameter-path-2'?: string; 1361 + /** 1362 + * This is the parameter that goes into the path 1363 + */ 1364 + 'PARAMETER-PATH-3'?: string; 1365 + /** 1366 + * api-version should be required in standalone clients 1367 + */ 1368 + 'api-version': string | null; 1369 + }; 1370 + query: { 1371 + /** 1372 + * This is the parameter with a reserved keyword 1373 + */ 1374 + default?: string; 1375 + /** 1376 + * This is the parameter that goes into the request query params 1377 + */ 1378 + 'parameter-query': string | null; 1379 + }; 1380 + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}'; 1381 + }; 1382 + 1383 + export type GetCallWithOptionalParamData = { 1384 + /** 1385 + * This is a required parameter 1386 + */ 1387 + body: ModelWithOneOfEnum; 1388 + path?: never; 1389 + query?: { 1390 + /** 1391 + * This is an optional parameter 1392 + */ 1393 + page?: number; 1394 + }; 1395 + url: '/api/v{api-version}/parameters'; 1396 + }; 1397 + 1398 + export type PostCallWithOptionalParamData = { 1399 + /** 1400 + * This is an optional parameter 1401 + */ 1402 + body?: { 1403 + offset?: number | null; 1404 + }; 1405 + path?: never; 1406 + query: { 1407 + /** 1408 + * This is a required parameter 1409 + */ 1410 + parameter: Pageable; 1411 + }; 1412 + url: '/api/v{api-version}/parameters'; 1413 + }; 1414 + 1415 + export type PostCallWithOptionalParamResponses = { 1416 + /** 1417 + * Response is a simple number 1418 + */ 1419 + 200: number; 1420 + /** 1421 + * Success 1422 + */ 1423 + 204: void; 1424 + }; 1425 + 1426 + export type PostCallWithOptionalParamResponse = PostCallWithOptionalParamResponses[keyof PostCallWithOptionalParamResponses]; 1427 + 1428 + export type PostApiVbyApiVersionRequestBodyData = { 1429 + /** 1430 + * A reusable request body 1431 + */ 1432 + body?: SimpleRequestBody; 1433 + path?: never; 1434 + query?: { 1435 + /** 1436 + * This is a reusable parameter 1437 + */ 1438 + parameter?: string; 1439 + }; 1440 + url: '/api/v{api-version}/requestBody'; 1441 + }; 1442 + 1443 + export type PostApiVbyApiVersionFormDataData = { 1444 + /** 1445 + * A reusable request body 1446 + */ 1447 + body?: SimpleFormData; 1448 + path?: never; 1449 + query?: { 1450 + /** 1451 + * This is a reusable parameter 1452 + */ 1453 + parameter?: string; 1454 + }; 1455 + url: '/api/v{api-version}/formData'; 1456 + }; 1457 + 1458 + export type CallWithDefaultParametersData = { 1459 + body?: never; 1460 + path?: never; 1461 + query?: { 1462 + /** 1463 + * This is a simple string with default value 1464 + */ 1465 + parameterString?: string | null; 1466 + /** 1467 + * This is a simple number with default value 1468 + */ 1469 + parameterNumber?: number | null; 1470 + /** 1471 + * This is a simple boolean with default value 1472 + */ 1473 + parameterBoolean?: boolean | null; 1474 + /** 1475 + * This is a simple enum with default value 1476 + */ 1477 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1478 + /** 1479 + * This is a simple model with default value 1480 + */ 1481 + parameterModel?: ModelWithString | null; 1482 + }; 1483 + url: '/api/v{api-version}/defaults'; 1484 + }; 1485 + 1486 + export type CallWithDefaultOptionalParametersData = { 1487 + body?: never; 1488 + path?: never; 1489 + query?: { 1490 + /** 1491 + * This is a simple string that is optional with default value 1492 + */ 1493 + parameterString?: string; 1494 + /** 1495 + * This is a simple number that is optional with default value 1496 + */ 1497 + parameterNumber?: number; 1498 + /** 1499 + * This is a simple boolean that is optional with default value 1500 + */ 1501 + parameterBoolean?: boolean; 1502 + /** 1503 + * This is a simple enum that is optional with default value 1504 + */ 1505 + parameterEnum?: 'Success' | 'Warning' | 'Error'; 1506 + /** 1507 + * This is a simple model that is optional with default value 1508 + */ 1509 + parameterModel?: ModelWithString; 1510 + }; 1511 + url: '/api/v{api-version}/defaults'; 1512 + }; 1513 + 1514 + export type CallToTestOrderOfParamsData = { 1515 + body?: never; 1516 + path?: never; 1517 + query: { 1518 + /** 1519 + * This is a optional string with default 1520 + */ 1521 + parameterOptionalStringWithDefault?: string; 1522 + /** 1523 + * This is a optional string with empty default 1524 + */ 1525 + parameterOptionalStringWithEmptyDefault?: string; 1526 + /** 1527 + * This is a optional string with no default 1528 + */ 1529 + parameterOptionalStringWithNoDefault?: string; 1530 + /** 1531 + * This is a string with default 1532 + */ 1533 + parameterStringWithDefault: string; 1534 + /** 1535 + * This is a string with empty default 1536 + */ 1537 + parameterStringWithEmptyDefault: string; 1538 + /** 1539 + * This is a string with no default 1540 + */ 1541 + parameterStringWithNoDefault: string; 1542 + /** 1543 + * This is a string that can be null with no default 1544 + */ 1545 + parameterStringNullableWithNoDefault?: string | null; 1546 + /** 1547 + * This is a string that can be null with default 1548 + */ 1549 + parameterStringNullableWithDefault?: string | null; 1550 + }; 1551 + url: '/api/v{api-version}/defaults'; 1552 + }; 1553 + 1554 + export type DuplicateNameData = { 1555 + body?: never; 1556 + path?: never; 1557 + query?: never; 1558 + url: '/api/v{api-version}/duplicate'; 1559 + }; 1560 + 1561 + export type DuplicateName2Data = { 1562 + body?: never; 1563 + path?: never; 1564 + query?: never; 1565 + url: '/api/v{api-version}/duplicate'; 1566 + }; 1567 + 1568 + export type DuplicateName3Data = { 1569 + body?: never; 1570 + path?: never; 1571 + query?: never; 1572 + url: '/api/v{api-version}/duplicate'; 1573 + }; 1574 + 1575 + export type DuplicateName4Data = { 1576 + body?: never; 1577 + path?: never; 1578 + query?: never; 1579 + url: '/api/v{api-version}/duplicate'; 1580 + }; 1581 + 1582 + export type CallWithNoContentResponseData = { 1583 + body?: never; 1584 + path?: never; 1585 + query?: never; 1586 + url: '/api/v{api-version}/no-content'; 1587 + }; 1588 + 1589 + export type CallWithNoContentResponseResponses = { 1590 + /** 1591 + * Success 1592 + */ 1593 + 204: void; 1594 + }; 1595 + 1596 + export type CallWithNoContentResponseResponse = CallWithNoContentResponseResponses[keyof CallWithNoContentResponseResponses]; 1597 + 1598 + export type CallWithResponseAndNoContentResponseData = { 1599 + body?: never; 1600 + path?: never; 1601 + query?: never; 1602 + url: '/api/v{api-version}/multiple-tags/response-and-no-content'; 1603 + }; 1604 + 1605 + export type CallWithResponseAndNoContentResponseResponses = { 1606 + /** 1607 + * Response is a simple number 1608 + */ 1609 + 200: number; 1610 + /** 1611 + * Success 1612 + */ 1613 + 204: void; 1614 + }; 1615 + 1616 + export type CallWithResponseAndNoContentResponseResponse = CallWithResponseAndNoContentResponseResponses[keyof CallWithResponseAndNoContentResponseResponses]; 1617 + 1618 + export type DummyAData = { 1619 + body?: never; 1620 + path?: never; 1621 + query?: never; 1622 + url: '/api/v{api-version}/multiple-tags/a'; 1623 + }; 1624 + 1625 + export type DummyAResponses = { 1626 + 200: _400; 1627 + }; 1628 + 1629 + export type DummyAResponse = DummyAResponses[keyof DummyAResponses]; 1630 + 1631 + export type DummyBData = { 1632 + body?: never; 1633 + path?: never; 1634 + query?: never; 1635 + url: '/api/v{api-version}/multiple-tags/b'; 1636 + }; 1637 + 1638 + export type DummyBResponses = { 1639 + /** 1640 + * Success 1641 + */ 1642 + 204: void; 1643 + }; 1644 + 1645 + export type DummyBResponse = DummyBResponses[keyof DummyBResponses]; 1646 + 1647 + export type CallWithResponseData = { 1648 + body?: never; 1649 + path?: never; 1650 + query?: never; 1651 + url: '/api/v{api-version}/response'; 1652 + }; 1653 + 1654 + export type CallWithResponseResponses = { 1655 + default: Import; 1656 + }; 1657 + 1658 + export type CallWithResponseResponse = CallWithResponseResponses[keyof CallWithResponseResponses]; 1659 + 1660 + export type CallWithDuplicateResponsesData = { 1661 + body?: never; 1662 + path?: never; 1663 + query?: never; 1664 + url: '/api/v{api-version}/response'; 1665 + }; 1666 + 1667 + export type CallWithDuplicateResponsesErrors = { 1668 + /** 1669 + * Message for 500 error 1670 + */ 1671 + 500: ModelWithStringError; 1672 + /** 1673 + * Message for 501 error 1674 + */ 1675 + 501: ModelWithStringError; 1676 + /** 1677 + * Message for 502 error 1678 + */ 1679 + 502: ModelWithStringError; 1680 + /** 1681 + * Message for 4XX errors 1682 + */ 1683 + '4XX': DictionaryWithArray; 1684 + /** 1685 + * Default error response 1686 + */ 1687 + default: ModelWithBoolean; 1688 + }; 1689 + 1690 + export type CallWithDuplicateResponsesError = CallWithDuplicateResponsesErrors[keyof CallWithDuplicateResponsesErrors]; 1691 + 1692 + export type CallWithDuplicateResponsesResponses = { 1693 + /** 1694 + * Message for 200 response 1695 + */ 1696 + 200: ModelWithBoolean & ModelWithInteger; 1697 + /** 1698 + * Message for 201 response 1699 + */ 1700 + 201: ModelWithString; 1701 + /** 1702 + * Message for 202 response 1703 + */ 1704 + 202: ModelWithString; 1705 + }; 1706 + 1707 + export type CallWithDuplicateResponsesResponse = CallWithDuplicateResponsesResponses[keyof CallWithDuplicateResponsesResponses]; 1708 + 1709 + export type CallWithResponsesData = { 1710 + body?: never; 1711 + path?: never; 1712 + query?: never; 1713 + url: '/api/v{api-version}/response'; 1714 + }; 1715 + 1716 + export type CallWithResponsesErrors = { 1717 + /** 1718 + * Message for 500 error 1719 + */ 1720 + 500: ModelWithStringError; 1721 + /** 1722 + * Message for 501 error 1723 + */ 1724 + 501: ModelWithStringError; 1725 + /** 1726 + * Message for 502 error 1727 + */ 1728 + 502: ModelWithStringError; 1729 + /** 1730 + * Message for default response 1731 + */ 1732 + default: ModelWithStringError; 1733 + }; 1734 + 1735 + export type CallWithResponsesError = CallWithResponsesErrors[keyof CallWithResponsesErrors]; 1736 + 1737 + export type CallWithResponsesResponses = { 1738 + /** 1739 + * Message for 200 response 1740 + */ 1741 + 200: { 1742 + readonly '@namespace.string'?: string; 1743 + readonly '@namespace.integer'?: number; 1744 + readonly value?: Array<ModelWithString>; 1745 + }; 1746 + /** 1747 + * Message for 201 response 1748 + */ 1749 + 201: ModelThatExtends; 1750 + /** 1751 + * Message for 202 response 1752 + */ 1753 + 202: ModelThatExtendsExtends; 1754 + }; 1755 + 1756 + export type CallWithResponsesResponse = CallWithResponsesResponses[keyof CallWithResponsesResponses]; 1757 + 1758 + export type CollectionFormatData = { 1759 + body?: never; 1760 + path?: never; 1761 + query: { 1762 + /** 1763 + * This is an array parameter that is sent as csv format (comma-separated values) 1764 + */ 1765 + parameterArrayCSV: Array<string> | null; 1766 + /** 1767 + * This is an array parameter that is sent as ssv format (space-separated values) 1768 + */ 1769 + parameterArraySSV: Array<string> | null; 1770 + /** 1771 + * This is an array parameter that is sent as tsv format (tab-separated values) 1772 + */ 1773 + parameterArrayTSV: Array<string> | null; 1774 + /** 1775 + * This is an array parameter that is sent as pipes format (pipe-separated values) 1776 + */ 1777 + parameterArrayPipes: Array<string> | null; 1778 + /** 1779 + * This is an array parameter that is sent as multi format (multiple parameter instances) 1780 + */ 1781 + parameterArrayMulti: Array<string> | null; 1782 + }; 1783 + url: '/api/v{api-version}/collectionFormat'; 1784 + }; 1785 + 1786 + export type TypesData = { 1787 + body?: never; 1788 + path?: { 1789 + /** 1790 + * This is a number parameter 1791 + */ 1792 + id?: number; 1793 + }; 1794 + query: { 1795 + /** 1796 + * This is a number parameter 1797 + */ 1798 + parameterNumber: number; 1799 + /** 1800 + * This is a string parameter 1801 + */ 1802 + parameterString: string | null; 1803 + /** 1804 + * This is a boolean parameter 1805 + */ 1806 + parameterBoolean: boolean | null; 1807 + /** 1808 + * This is an object parameter 1809 + */ 1810 + parameterObject: { 1811 + [key: string]: unknown; 1812 + } | null; 1813 + /** 1814 + * This is an array parameter 1815 + */ 1816 + parameterArray: Array<string> | null; 1817 + /** 1818 + * This is a dictionary parameter 1819 + */ 1820 + parameterDictionary: { 1821 + [key: string]: unknown; 1822 + } | null; 1823 + /** 1824 + * This is an enum parameter 1825 + */ 1826 + parameterEnum: 'Success' | 'Warning' | 'Error' | null; 1827 + }; 1828 + url: '/api/v{api-version}/types'; 1829 + }; 1830 + 1831 + export type TypesResponses = { 1832 + /** 1833 + * Response is a simple number 1834 + */ 1835 + 200: number; 1836 + /** 1837 + * Response is a simple string 1838 + */ 1839 + 201: string; 1840 + /** 1841 + * Response is a simple boolean 1842 + */ 1843 + 202: boolean; 1844 + /** 1845 + * Response is a simple object 1846 + */ 1847 + 203: { 1848 + [key: string]: unknown; 1849 + }; 1850 + }; 1851 + 1852 + export type TypesResponse = TypesResponses[keyof TypesResponses]; 1853 + 1854 + export type UploadFileData = { 1855 + body: Blob | File; 1856 + path: { 1857 + /** 1858 + * api-version should be required in standalone clients 1859 + */ 1860 + 'api-version': string | null; 1861 + }; 1862 + query?: never; 1863 + url: '/api/v{api-version}/upload'; 1864 + }; 1865 + 1866 + export type UploadFileResponses = { 1867 + 200: boolean; 1868 + }; 1869 + 1870 + export type UploadFileResponse = UploadFileResponses[keyof UploadFileResponses]; 1871 + 1872 + export type FileResponseData = { 1873 + body?: never; 1874 + path: { 1875 + id: string; 1876 + /** 1877 + * api-version should be required in standalone clients 1878 + */ 1879 + 'api-version': string; 1880 + }; 1881 + query?: never; 1882 + url: '/api/v{api-version}/file/{id}'; 1883 + }; 1884 + 1885 + export type FileResponseResponses = { 1886 + /** 1887 + * Success 1888 + */ 1889 + 200: Blob | File; 1890 + }; 1891 + 1892 + export type FileResponseResponse = FileResponseResponses[keyof FileResponseResponses]; 1893 + 1894 + export type ComplexTypesData = { 1895 + body?: never; 1896 + path?: never; 1897 + query: { 1898 + /** 1899 + * Parameter containing object 1900 + */ 1901 + parameterObject: { 1902 + first?: { 1903 + second?: { 1904 + third?: string; 1905 + }; 1906 + }; 1907 + }; 1908 + /** 1909 + * Parameter containing reference 1910 + */ 1911 + parameterReference: ModelWithString; 1912 + }; 1913 + url: '/api/v{api-version}/complex'; 1914 + }; 1915 + 1916 + export type ComplexTypesErrors = { 1917 + /** 1918 + * 400 `server` error 1919 + */ 1920 + 400: unknown; 1921 + /** 1922 + * 500 server error 1923 + */ 1924 + 500: unknown; 1925 + }; 1926 + 1927 + export type ComplexTypesResponses = { 1928 + /** 1929 + * Successful response 1930 + */ 1931 + 200: Array<ModelWithString>; 1932 + }; 1933 + 1934 + export type ComplexTypesResponse = ComplexTypesResponses[keyof ComplexTypesResponses]; 1935 + 1936 + export type MultipartResponseData = { 1937 + body?: never; 1938 + path?: never; 1939 + query?: never; 1940 + url: '/api/v{api-version}/multipart'; 1941 + }; 1942 + 1943 + export type MultipartResponseResponses = { 1944 + /** 1945 + * OK 1946 + */ 1947 + 200: { 1948 + file?: Blob | File; 1949 + metadata?: { 1950 + foo?: string; 1951 + bar?: string; 1952 + }; 1953 + }; 1954 + }; 1955 + 1956 + export type MultipartResponseResponse = MultipartResponseResponses[keyof MultipartResponseResponses]; 1957 + 1958 + export type MultipartRequestData = { 1959 + body?: { 1960 + content?: Blob | File; 1961 + data?: ModelWithString | null; 1962 + }; 1963 + path?: never; 1964 + query?: never; 1965 + url: '/api/v{api-version}/multipart'; 1966 + }; 1967 + 1968 + export type ComplexParamsData = { 1969 + body?: { 1970 + readonly key: string | null; 1971 + name: string | null; 1972 + enabled?: boolean; 1973 + type: 'Monkey' | 'Horse' | 'Bird'; 1974 + listOfModels?: Array<ModelWithString> | null; 1975 + listOfStrings?: Array<string> | null; 1976 + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; 1977 + readonly user?: { 1978 + readonly id?: number; 1979 + readonly name?: string | null; 1980 + }; 1981 + }; 1982 + path: { 1983 + id: number; 1984 + /** 1985 + * api-version should be required in standalone clients 1986 + */ 1987 + 'api-version': string; 1988 + }; 1989 + query?: never; 1990 + url: '/api/v{api-version}/complex/{id}'; 1991 + }; 1992 + 1993 + export type ComplexParamsResponses = { 1994 + /** 1995 + * Success 1996 + */ 1997 + 200: ModelWithString; 1998 + }; 1999 + 2000 + export type ComplexParamsResponse = ComplexParamsResponses[keyof ComplexParamsResponses]; 2001 + 2002 + export type CallWithResultFromHeaderData = { 2003 + body?: never; 2004 + path?: never; 2005 + query?: never; 2006 + url: '/api/v{api-version}/header'; 2007 + }; 2008 + 2009 + export type CallWithResultFromHeaderErrors = { 2010 + /** 2011 + * 400 server error 2012 + */ 2013 + 400: unknown; 2014 + /** 2015 + * 500 server error 2016 + */ 2017 + 500: unknown; 2018 + }; 2019 + 2020 + export type CallWithResultFromHeaderResponses = { 2021 + /** 2022 + * Successful response 2023 + */ 2024 + 200: unknown; 2025 + }; 2026 + 2027 + export type TestErrorCodeData = { 2028 + body?: never; 2029 + path?: never; 2030 + query: { 2031 + /** 2032 + * Status code to return 2033 + */ 2034 + status: number; 2035 + }; 2036 + url: '/api/v{api-version}/error'; 2037 + }; 2038 + 2039 + export type TestErrorCodeErrors = { 2040 + /** 2041 + * Custom message: Internal Server Error 2042 + */ 2043 + 500: unknown; 2044 + /** 2045 + * Custom message: Not Implemented 2046 + */ 2047 + 501: unknown; 2048 + /** 2049 + * Custom message: Bad Gateway 2050 + */ 2051 + 502: unknown; 2052 + /** 2053 + * Custom message: Service Unavailable 2054 + */ 2055 + 503: unknown; 2056 + }; 2057 + 2058 + export type TestErrorCodeResponses = { 2059 + /** 2060 + * Custom message: Successful response 2061 + */ 2062 + 200: unknown; 2063 + }; 2064 + 2065 + export type NonAsciiæøåÆøÅöôêÊ字符串Data = { 2066 + body?: never; 2067 + path?: never; 2068 + query: { 2069 + /** 2070 + * Dummy input param 2071 + */ 2072 + nonAsciiParamæøåÆØÅöôêÊ: number; 2073 + }; 2074 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2075 + }; 2076 + 2077 + export type NonAsciiæøåÆøÅöôêÊ字符串Responses = { 2078 + /** 2079 + * Successful response 2080 + */ 2081 + 200: Array<NonAsciiStringæøåÆøÅöôêÊ字符串>; 2082 + }; 2083 + 2084 + export type NonAsciiæøåÆøÅöôêÊ字符串Response = NonAsciiæøåÆøÅöôêÊ字符串Responses[keyof NonAsciiæøåÆøÅöôêÊ字符串Responses]; 2085 + 2086 + export type PutWithFormUrlEncodedData = { 2087 + body: ArrayWithStrings; 2088 + path?: never; 2089 + query?: never; 2090 + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 2091 + };
+7
packages/openapi-ts-tests/main/test/plugins.test.ts
··· 470 470 }, 471 471 { 472 472 config: createConfig({ 473 + output: 'default', 474 + plugins: ['nestjs'], 475 + }), 476 + description: 'generate NestJS types with NestJS plugin', 477 + }, 478 + { 479 + config: createConfig({ 473 480 input: 'transforms-read-write.yaml', 474 481 output: 'transforms-read-write-ignore', 475 482 parser: {
+6
packages/openapi-ts/src/index.ts
··· 80 80 '@tanstack/vue-query': Plugins.TanStackVueQuery.Types['Types']; 81 81 arktype: Plugins.Arktype.Types['Types']; 82 82 fastify: Plugins.Fastify.Types['Types']; 83 + nestjs: Plugins.NestJS.Types['Types']; 83 84 swr: Plugins.Swr.Types['Types']; 84 85 valibot: Plugins.Valibot.Types['Types']; 85 86 zod: Plugins.Zod.Types['Types']; ··· 140 141 import type { TanStackVueQueryPlugin } from './plugins/@tanstack/vue-query'; 141 142 import type { ArktypePlugin } from './plugins/arktype'; 142 143 import type { FastifyPlugin } from './plugins/fastify'; 144 + import type { NestJSPlugin } from './plugins/nestjs'; 143 145 import type { SwrPlugin } from './plugins/swr'; 144 146 import type { ValibotPlugin, ValibotResolvers } from './plugins/valibot'; 145 147 import type { ZodPlugin, ZodResolvers } from './plugins/zod'; ··· 207 209 208 210 export namespace Fastify { 209 211 export type Types = FastifyPlugin; 212 + } 213 + 214 + export namespace NestJS { 215 + export type Types = NestJSPlugin; 210 216 } 211 217 212 218 export namespace HeyApiClientAngular {
+2
packages/openapi-ts/src/plugins/config.ts
··· 22 22 import { defaultConfig as tanStackVueQuery } from '../plugins/@tanstack/vue-query'; 23 23 import { defaultConfig as arktype } from '../plugins/arktype'; 24 24 import { defaultConfig as fastify } from '../plugins/fastify'; 25 + import { defaultConfig as nestjs } from '../plugins/nestjs'; 25 26 import { defaultConfig as swr } from '../plugins/swr'; 26 27 import { defaultConfig as valibot } from '../plugins/valibot'; 27 28 import { defaultConfig as zod } from '../plugins/zod'; ··· 51 52 '@tanstack/vue-query': tanStackVueQuery, 52 53 arktype, 53 54 fastify, 55 + nestjs, 54 56 swr, 55 57 valibot, 56 58 zod,
+18
packages/openapi-ts/src/plugins/nestjs/config.ts
··· 1 + import { definePluginConfig } from '@hey-api/shared'; 2 + 3 + import { handler } from './plugin'; 4 + import type { NestJSPlugin } from './types'; 5 + 6 + export const defaultConfig: NestJSPlugin['Config'] = { 7 + config: { 8 + includeInEntry: false, 9 + }, 10 + dependencies: ['@hey-api/typescript'], 11 + handler, 12 + name: 'nestjs', 13 + }; 14 + 15 + /** 16 + * Type helper for `nestjs` plugin, returns {@link Plugin.Config} object 17 + */ 18 + export const defineConfig = definePluginConfig(defaultConfig);
+2
packages/openapi-ts/src/plugins/nestjs/index.ts
··· 1 + export { defaultConfig, defineConfig } from './config'; 2 + export type { NestJSPlugin } from './types';
+116
packages/openapi-ts/src/plugins/nestjs/plugin.ts
··· 1 + import type { IR } from '@hey-api/shared'; 2 + import { hasParameterGroupObjectRequired, operationResponsesMap } from '@hey-api/shared'; 3 + 4 + import { $ } from '../../ts-dsl'; 5 + import type { NestJSPlugin } from './types'; 6 + 7 + const operationToMethod = ({ 8 + operation, 9 + plugin, 10 + }: { 11 + operation: IR.OperationObject; 12 + plugin: NestJSPlugin['Instance']; 13 + }) => { 14 + const funcType = $.type.func(); 15 + 16 + const symbolDataType = plugin.querySymbol({ 17 + category: 'type', 18 + resource: 'operation', 19 + resourceId: operation.id, 20 + role: 'data', 21 + tool: 'typescript', 22 + }); 23 + 24 + if (symbolDataType) { 25 + // Collect params so we can sort required before optional. 26 + // Without this, TypeScript would reject signatures like 27 + // (query?: T, body: U) => ... where optional precedes required. 28 + const params: Array<{ 29 + isRequired: boolean; 30 + key: string; 31 + }> = []; 32 + 33 + if (operation.parameters?.path) { 34 + params.push({ 35 + isRequired: hasParameterGroupObjectRequired(operation.parameters.path), 36 + key: 'path', 37 + }); 38 + } 39 + 40 + if (operation.parameters?.query) { 41 + params.push({ 42 + isRequired: hasParameterGroupObjectRequired(operation.parameters.query), 43 + key: 'query', 44 + }); 45 + } 46 + 47 + if (operation.body) { 48 + params.push({ 49 + isRequired: operation.body.required ?? false, 50 + key: 'body', 51 + }); 52 + } 53 + 54 + if (operation.parameters?.header) { 55 + params.push({ 56 + isRequired: hasParameterGroupObjectRequired(operation.parameters.header), 57 + key: 'headers', 58 + }); 59 + } 60 + 61 + // Stable sort: required params first, optional params last 62 + params.sort((a, b) => (a.isRequired === b.isRequired ? 0 : a.isRequired ? -1 : 1)); 63 + 64 + for (const param of params) { 65 + funcType.param(param.key, (p) => 66 + p.required(param.isRequired).type($.type(symbolDataType).idx($.type.literal(param.key))), 67 + ); 68 + } 69 + } 70 + 71 + // Use the response type alias (union of success bodies), not the 72 + // status-code-indexed responses map. NestJS controllers return values 73 + // directly, not status-code mappings. 74 + const { responses } = operationResponsesMap(operation); 75 + 76 + const symbolResponseType = plugin.querySymbol({ 77 + category: 'type', 78 + resource: 'operation', 79 + resourceId: operation.id, 80 + role: 'response', 81 + tool: 'typescript', 82 + }); 83 + 84 + if (symbolResponseType && responses) { 85 + funcType.returns($.type('Promise', (t) => t.generic($.type(symbolResponseType)))); 86 + } else { 87 + funcType.returns($.type('Promise', (t) => t.generic($.type('void')))); 88 + } 89 + 90 + return { 91 + name: operation.id, 92 + type: funcType, 93 + }; 94 + }; 95 + 96 + export const handler: NestJSPlugin['Handler'] = ({ plugin }) => { 97 + const symbolControllerMethods = plugin.symbol('ControllerMethods'); 98 + 99 + const type = $.type.object(); 100 + 101 + plugin.forEach( 102 + 'operation', 103 + ({ operation }) => { 104 + const method = operationToMethod({ operation, plugin }); 105 + if (method) { 106 + type.prop(method.name, (p) => p.type(method.type)); 107 + } 108 + }, 109 + { 110 + order: 'declarations', 111 + }, 112 + ); 113 + 114 + const node = $.type.alias(symbolControllerMethods).export().type(type); 115 + plugin.node(node); 116 + };
+5
packages/openapi-ts/src/plugins/nestjs/types.ts
··· 1 + import type { DefinePlugin, Plugin } from '@hey-api/shared'; 2 + 3 + export type UserConfig = Plugin.Name<'nestjs'> & Plugin.Hooks & Plugin.UserExports; 4 + 5 + export type NestJSPlugin = DefinePlugin<UserConfig, UserConfig>;