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.

refactor: clean up some types and diff

Lubos 71588cb8 4ebe34c2

+62 -71
+2 -3
.changeset/dry-jeans-ring.md
··· 1 1 --- 2 - '@hey-api/openapi-ts': minor 3 - '@docs/openapi-ts': patch 2 + '@hey-api/openapi-ts': patch 4 3 --- 5 4 6 - feat: expand configuration by allowing multiple configs, inputs and outputs 5 + feat: add support for array configuration, input, and output objects
-3
packages/openapi-ts-tests/main/test/clients.test.ts
··· 171 171 172 172 const outputPath = 173 173 typeof config.output === 'string' ? config.output : config.output.path; 174 - 175 174 const filePaths = getFilePaths(outputPath); 176 175 177 176 await Promise.all( ··· 329 328 330 329 const outputPath = 331 330 typeof config.output === 'string' ? config.output : config.output.path; 332 - 333 331 const filePaths = getFilePaths(outputPath); 334 332 335 333 await Promise.all( ··· 476 474 477 475 const outputPath = 478 476 typeof config.output === 'string' ? config.output : config.output.path; 479 - 480 477 const filePaths = getFilePaths(outputPath); 481 478 482 479 await Promise.all(
+56 -53
packages/openapi-ts-tests/main/test/openapi-ts.config.ts
··· 16 16 // ... 17 17 return { 18 18 // experimentalParser: false, 19 - input: { 20 - // branch: 'main', 21 - // fetch: { 22 - // headers: { 23 - // 'x-foo': 'bar', 24 - // }, 25 - // }, 26 - // organization: 'hey-api', 27 - // path: { 28 - // components: {}, 29 - // info: { 30 - // version: '1.0.0', 31 - // }, 32 - // openapi: '3.1.0', 33 - // paths: {}, 34 - // }, 35 - path: path.resolve( 36 - getSpecsPath(), 37 - '3.0.x', 38 - // 'circular.yaml', 39 - 'dutchie.json', 40 - // 'invalid', 41 - // 'openai.yaml', 42 - // 'full.yaml', 43 - // 'opencode.yaml', 44 - // 'sdk-instance.yaml', 45 - // 'string-with-format.yaml', 46 - // 'transformers.json', 47 - // 'type-format.yaml', 48 - // 'validators.yaml', 49 - // 'validators-circular-ref-2.yaml', 50 - // 'zoom-video-sdk.json', 51 - ), 52 - // path: 'scalar:@scalar/access-service', 53 - // path: 'hey-api/backend', 54 - // path: 'hey-api/backend?branch=main&version=1.0.0', 55 - // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', 56 - // path: 'http://localhost:4000/', 57 - // path: 'http://localhost:8000/openapi.json', 58 - // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 59 - // path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml', 60 - // project: 'backend', 61 - // project: 'upload-openapi-spec', 62 - // version: '1.0.0', 63 - // watch: { 64 - // enabled: true, 65 - // interval: 500, 66 - // timeout: 30_000, 67 - // }, 68 - }, 19 + input: [ 20 + { 21 + // branch: 'main', 22 + // fetch: { 23 + // headers: { 24 + // 'x-foo': 'bar', 25 + // }, 26 + // }, 27 + // organization: 'hey-api', 28 + // path: { 29 + // components: {}, 30 + // info: { 31 + // version: '1.0.0', 32 + // }, 33 + // openapi: '3.1.0', 34 + // paths: {}, 35 + // }, 36 + path: path.resolve( 37 + getSpecsPath(), 38 + '3.0.x', 39 + // 'circular.yaml', 40 + 'dutchie.json', 41 + // 'invalid', 42 + // 'openai.yaml', 43 + // 'full.yaml', 44 + // 'opencode.yaml', 45 + // 'sdk-instance.yaml', 46 + // 'string-with-format.yaml', 47 + // 'transformers.json', 48 + // 'type-format.yaml', 49 + // 'validators.yaml', 50 + // 'validators-circular-ref-2.yaml', 51 + // 'zoom-video-sdk.json', 52 + ), 53 + // path: 'scalar:@scalar/access-service', 54 + // path: 'hey-api/backend', 55 + // path: 'hey-api/backend?branch=main&version=1.0.0', 56 + // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', 57 + // path: 'http://localhost:4000/', 58 + // path: 'http://localhost:8000/openapi.json', 59 + // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 60 + // path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml', 61 + // project: 'backend', 62 + // project: 'upload-openapi-spec', 63 + // version: '1.0.0', 64 + // watch: { 65 + // enabled: true, 66 + // interval: 500, 67 + // timeout: 30_000, 68 + // }, 69 + }, 70 + path.resolve(getSpecsPath(), '3.1.x', 'full.yaml'), 71 + ], 69 72 logs: { 70 - // level: 'debug', 73 + level: 'debug', 71 74 path: './logs', 72 75 }, 73 76 // name: 'foo', ··· 148 151 // mode: 'root', 149 152 // // name: '{{name}}', 150 153 // }, 151 - propertiesRequiredByDefault: true, 154 + // propertiesRequiredByDefault: true, 152 155 // readWrite: { 153 156 // // enabled: false, 154 157 // requests: '{{name}}Writable', 155 158 // responses: '{{name}}', 156 159 // }, 157 160 }, 158 - validate_EXPERIMENTAL: true, 161 + // validate_EXPERIMENTAL: true, 159 162 }, 160 163 plugins: [ 161 164 // customClientPlugin({
-1
packages/openapi-ts-tests/main/test/plugins.test.ts
··· 568 568 569 569 const outputPath = 570 570 typeof config.output === 'string' ? config.output : config.output.path; 571 - 572 571 const filePaths = getFilePaths(outputPath); 573 572 574 573 await Promise.all(
-1
packages/openapi-ts-tests/zod/v3/test/3.1.x.test.ts
··· 152 152 153 153 const outputPath = 154 154 typeof config.output === 'string' ? config.output : config.output.path; 155 - 156 155 const filePaths = getFilePaths(outputPath); 157 156 158 157 await Promise.all(
-1
packages/openapi-ts-tests/zod/v4/test/3.0.x.test.ts
··· 70 70 71 71 const outputPath = 72 72 typeof config.output === 'string' ? config.output : config.output.path; 73 - 74 73 const filePaths = getFilePaths(outputPath); 75 74 76 75 await Promise.all(
-1
packages/openapi-ts-tests/zod/v4/test/3.1.x.test.ts
··· 152 152 153 153 const outputPath = 154 154 typeof config.output === 'string' ? config.output : config.output.path; 155 - 156 155 const filePaths = getFilePaths(outputPath); 157 156 158 157 await Promise.all(
+2 -5
packages/openapi-ts/src/index.ts
··· 117 117 }; 118 118 119 119 /** 120 - * Type helper for openapi-ts.config.ts, preserves input shape (object vs array) 120 + * Type helper for openapi-ts.config.ts, returns {@link ConfigValue} object 121 121 */ 122 122 export const defineConfig = async <T extends ConfigValue>( 123 123 config: ConfigInput<T>, 124 - ): Promise<T> => 125 - typeof config === 'function' 126 - ? await (config as () => T | Promise<T>)() 127 - : (config as T); 124 + ): Promise<T> => (typeof config === 'function' ? await config() : config); 128 125 129 126 export { defaultPaginationKeywords } from './config/parser'; 130 127 export { defaultPlugins } from './config/plugins';
+2 -3
packages/openapi-ts/src/types/config.d.ts
··· 46 46 */ 47 47 logs?: string | Logs; 48 48 /** 49 - * The relative location of the output folder. You can specify multiple 50 - * outputs to generate different versions of your SDK with different 51 - * configurations (e.g., different plugins, formatters, or paths). 49 + * Path to the output folder. You can define an array to generate 50 + * multiple outputs from your input. 52 51 */ 53 52 output: string | UserOutput; 54 53 /**