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.

Merge pull request #441 from hey-api/feat/move-operation-id-config-option

feat: move operationId config option to services object

authored by

Jordan Shatford and committed by
GitHub
fbf5de79 9eadc04c

+37 -36
+5
.changeset/proud-worms-exercise.md
··· 1 + --- 2 + "@hey-api/openapi-ts": minor 3 + --- 4 + 5 + feat: move operationId config option to services object
+16
docs/openapi-ts/migrating.md
··· 48 48 49 49 This config option is deprecated and will be removed. 50 50 51 + ## v0.42.0 52 + 53 + ### Moved `operationId` 54 + 55 + This config option has been moved. You can now configure it using the `services.operationId` option. 56 + 57 + ```js{5} 58 + export default { 59 + input: 'path/to/openapi.json', 60 + output: 'src/client', 61 + services: { 62 + operationId: true, 63 + }, 64 + } 65 + ``` 66 + 51 67 ## v0.41.0 52 68 53 69 ### Removed `postfixServices`
-2
packages/openapi-ts/bin/index.cjs
··· 32 32 .option('--format [value]', 'Process output folder with formatter?') 33 33 .option('--lint [value]', 'Process output folder with linter?') 34 34 .option('--name <value>', 'Custom client class name') 35 - .option('--operationId [value]', 'Use operationd ID?') 36 35 .option('--request <value>', 'Path to custom request file') 37 36 .option('--schemas [value]', 'Write schemas to disk') 38 37 .option('--services [value]', 'Write services to disk') ··· 74 73 'exportCore', 75 74 'format', 76 75 'lint', 77 - 'operationId', 78 76 'schemas', 79 77 'services', 80 78 'types',
+1 -2
packages/openapi-ts/src/index.ts
··· 108 108 let services: Config['services'] = { 109 109 export: true, 110 110 name: '{{name}}Service', 111 + operationId: true, 111 112 response: 'body', 112 113 }; 113 114 if (typeof userConfig.services === 'boolean') { ··· 168 169 input, 169 170 lint = false, 170 171 name, 171 - operationId = true, 172 172 request, 173 173 useOptions = true, 174 174 } = userConfig; ··· 212 212 input, 213 213 lint, 214 214 name, 215 - operationId, 216 215 output, 217 216 request, 218 217 schemas,
+2 -2
packages/openapi-ts/src/openApi/common/parser/__tests__/operation.spec.ts
··· 17 17 format: false, 18 18 input: '', 19 19 lint: false, 20 - operationId: true, 21 20 output: '', 22 21 schemas: { 23 22 export: false, 24 23 }, 25 24 services: { 26 25 export: false, 26 + operationId: true, 27 27 response: 'body', 28 28 }, 29 29 types: { ··· 41 41 format: false, 42 42 input: '', 43 43 lint: false, 44 - operationId: false, 45 44 output: '', 46 45 schemas: { 47 46 export: false, 48 47 }, 49 48 services: { 50 49 export: false, 50 + operationId: false, 51 51 response: 'body', 52 52 }, 53 53 types: {
+1 -1
packages/openapi-ts/src/openApi/common/parser/operation.ts
··· 20 20 ): string => { 21 21 const config = getConfig(); 22 22 23 - if (config.operationId && operationId) { 23 + if (config.services.operationId && operationId) { 24 24 return camelCase(sanitizeNamespaceIdentifier(operationId).trim()); 25 25 } 26 26
+3 -2
packages/openapi-ts/src/openApi/v2/parser/__tests__/getServices.spec.ts
··· 14 14 format: false, 15 15 input: '', 16 16 lint: false, 17 - operationId: false, 18 17 output: '', 19 18 schemas: {}, 20 - services: {}, 19 + services: { 20 + operationId: false, 21 + }, 21 22 types: {}, 22 23 useOptions: true, 23 24 });
+3 -2
packages/openapi-ts/src/openApi/v3/parser/__tests__/getServices.spec.ts
··· 14 14 format: false, 15 15 input: '', 16 16 lint: false, 17 - operationId: true, 18 17 output: '', 19 18 schemas: {}, 20 - services: {}, 19 + services: { 20 + operationId: true, 21 + }, 21 22 types: {}, 22 23 useOptions: true, 23 24 });
+6 -6
packages/openapi-ts/src/types/config.ts
··· 19 19 */ 20 20 dryRun?: boolean; 21 21 /** 22 - * Export enum definitions? 22 + * Generate enum definitions? 23 23 * @default false 24 24 */ 25 25 enums?: 'javascript' | 'typescript' | false; ··· 46 46 * Custom client class name 47 47 */ 48 48 name?: string; 49 - /** 50 - * Use operation ID to generate operation names? 51 - * @default true 52 - */ 53 - operationId?: boolean; 54 49 /** 55 50 * The relative location of the output directory 56 51 */ ··· 101 96 * @default '{{name}}Service' 102 97 */ 103 98 name?: string; 99 + /** 100 + * Use operation ID to generate operation names? 101 + * @default true 102 + */ 103 + operationId?: boolean; 104 104 /** 105 105 * Define shape of returned value from service calls 106 106 * @default 'body'
-2
packages/openapi-ts/src/utils/__tests__/handlebars.spec.ts
··· 18 18 format: true, 19 19 input: '', 20 20 lint: false, 21 - operationId: true, 22 21 output: '', 23 22 schemas: {}, 24 23 services: {}, ··· 46 45 format: true, 47 46 input: '', 48 47 lint: false, 49 - operationId: true, 50 48 output: '', 51 49 schemas: {}, 52 50 services: {},
-1
packages/openapi-ts/src/utils/write/__tests__/class.spec.ts
··· 21 21 input: '', 22 22 lint: false, 23 23 name: 'AppClient', 24 - operationId: true, 25 24 output: '', 26 25 schemas: {}, 27 26 services: {},
-1
packages/openapi-ts/src/utils/write/__tests__/client.spec.ts
··· 20 20 format: true, 21 21 input: '', 22 22 lint: false, 23 - operationId: true, 24 23 output: './dist', 25 24 schemas: {}, 26 25 services: {},
-3
packages/openapi-ts/src/utils/write/__tests__/core.spec.ts
··· 35 35 input: '', 36 36 lint: false, 37 37 name: 'AppClient', 38 - operationId: true, 39 38 output: '', 40 39 schemas: {}, 41 40 services: {}, ··· 90 89 input: '', 91 90 lint: false, 92 91 name: 'AppClient', 93 - operationId: true, 94 92 output: '', 95 93 schemas: {}, 96 94 services: {}, ··· 128 126 input: '', 129 127 lint: false, 130 128 name: 'AppClient', 131 - operationId: true, 132 129 output: '', 133 130 schemas: {}, 134 131 services: {},
-1
packages/openapi-ts/src/utils/write/__tests__/index.spec.ts
··· 20 20 format: false, 21 21 input: '', 22 22 lint: false, 23 - operationId: true, 24 23 output: '', 25 24 schemas: {}, 26 25 services: {},
-1
packages/openapi-ts/src/utils/write/__tests__/models.spec.ts
··· 21 21 input: '', 22 22 lint: false, 23 23 name: 'AppClient', 24 - operationId: true, 25 24 output: '', 26 25 schemas: {}, 27 26 services: {},
-1
packages/openapi-ts/src/utils/write/__tests__/schemas.spec.ts
··· 22 22 input: '', 23 23 lint: false, 24 24 name: 'AppClient', 25 - operationId: true, 26 25 output: '', 27 26 schemas: {}, 28 27 services: {},
-1
packages/openapi-ts/src/utils/write/__tests__/services.spec.ts
··· 20 20 format: false, 21 21 input: '', 22 22 lint: false, 23 - operationId: true, 24 23 output: '', 25 24 schemas: {}, 26 25 services: {},
-8
packages/openapi-ts/test/bin.spec.ts
··· 223 223 'false', 224 224 '--lint', 225 225 'false', 226 - '--operationId', 227 - 'false', 228 226 '--useOptions', 229 227 'false', 230 228 '--dry-run', ··· 237 235 expect(result.stderr.toString()).toContain('services: false'); 238 236 expect(result.stderr.toString()).toContain('format: false'); 239 237 expect(result.stderr.toString()).toContain('lint: false'); 240 - expect(result.stderr.toString()).toContain('operationId: false'); 241 238 expect(result.stderr.toString()).toContain('schemas: false'); 242 239 expect(result.stderr.toString()).toContain('useOptions: false'); 243 240 }); ··· 262 259 'true', 263 260 '--lint', 264 261 'true', 265 - '--operationId', 266 - 'true', 267 262 '--useOptions', 268 263 'true', 269 264 '--dry-run', ··· 276 271 expect(result.stderr.toString()).toContain('services: true'); 277 272 expect(result.stderr.toString()).toContain('format: true'); 278 273 expect(result.stderr.toString()).toContain('lint: true'); 279 - expect(result.stderr.toString()).toContain('operationId: true'); 280 274 expect(result.stderr.toString()).toContain('schemas: true'); 281 275 expect(result.stderr.toString()).toContain('useOptions: true'); 282 276 }); ··· 297 291 'bar', 298 292 '--format', 299 293 '--lint', 300 - '--operationId', 301 294 '--useOptions', 302 295 '--dry-run', 303 296 'true', ··· 307 300 expect(result.stderr.toString()).toContain('exportCore: true'); 308 301 expect(result.stderr.toString()).toContain('format: true'); 309 302 expect(result.stderr.toString()).toContain('lint: true'); 310 - expect(result.stderr.toString()).toContain('operationId: true'); 311 303 expect(result.stderr.toString()).toContain('schemas: true'); 312 304 expect(result.stderr.toString()).toContain('useOptions: true'); 313 305 expect(result.stderr.toString()).toContain("types: 'foo");