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 #3235 from hey-api/refactor/logger-core

refactor: move logger to codegen-core

authored by

Lubos and committed by
GitHub
c2cf380d a801a1d2

+973 -81
+6
.changeset/fuzzy-cobras-beam.md
··· 1 + --- 2 + '@hey-api/codegen-core': patch 3 + '@hey-api/openapi-ts': patch 4 + --- 5 + 6 + **internal**: move logger to codegen-core
+1 -1
.vscode/extensions.json
··· 2 2 "recommendations": [ 3 3 "dbaeumer.vscode-eslint", 4 4 "EditorConfig.EditorConfig", 5 + "esbenp.prettier-vscode", 5 6 "hilleer.yaml-plus-json", 6 7 "oxc.oxc-vscode", 7 - "prettier.prettier-vscode", 8 8 "streetsidesoftware.code-spell-checker", 9 9 "usernamehw.errorlens" 10 10 ]
+12
.vscode/launch.json
··· 19 19 "env": { 20 20 "DEBUG": "false" 21 21 } 22 + }, 23 + { 24 + "type": "node", 25 + "request": "launch", 26 + "name": "openapi-python", 27 + "skipFiles": ["<node_internals>/**"], 28 + "cwd": "${workspaceFolder}/dev", 29 + "runtimeExecutable": "node", 30 + "program": "${workspaceFolder}/packages/openapi-python/dist/run.mjs", 31 + "env": { 32 + "DEBUG": "false" 33 + } 22 34 } 23 35 ] 24 36 }
+732
dev/openapi-python.config.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unused-vars, arrow-body-style */ 2 + // @ts-ignore 3 + import path from 'node:path'; 4 + 5 + // @ts-ignore 6 + import { customClientPlugin } from '@hey-api/custom-client/plugin'; 7 + import { 8 + // @ts-ignore 9 + defineConfig, 10 + } from '@hey-api/openapi-python'; 11 + import { 12 + // @ts-ignore 13 + OperationPath, 14 + // @ts-ignore 15 + OperationStrategy, 16 + // @ts-ignore 17 + reserved, 18 + // @ts-ignore 19 + utils, 20 + } from '@hey-api/openapi-ts'; 21 + 22 + // @ts-ignore 23 + import { myClientPlugin } from '../packages/openapi-ts-tests/main/test/custom/client/plugin'; 24 + // @ts-ignore 25 + import { getSpecsPath } from '../packages/openapi-ts-tests/utils'; 26 + 27 + reserved.runtime.set((list) => [...list, 'Agent']); 28 + reserved.type.set((list) => [...list, 'Agent']); 29 + 30 + console.log('yo'); 31 + 32 + // @ts-ignore 33 + export default defineConfig(() => { 34 + // ... 35 + return [ 36 + { 37 + input: [ 38 + { 39 + // fetch: { 40 + // headers: { 41 + // 'x-foo': 'bar', 42 + // }, 43 + // }, 44 + // path: { 45 + // components: {}, 46 + // info: { 47 + // version: '1.0.0', 48 + // }, 49 + // openapi: '3.1.0', 50 + // paths: {}, 51 + // }, 52 + path: path.resolve( 53 + getSpecsPath(), 54 + // '2.0.x', 55 + // '3.0.x', 56 + '3.1.x', 57 + // 'circular.yaml', 58 + // 'dutchie.json', 59 + // 'enum-names-values.yaml', 60 + // 'full.yaml', 61 + // 'integer-formats.yaml', 62 + // 'invalid', 63 + // 'object-property-names.yaml', 64 + // 'openai.yaml', 65 + // 'opencode.yaml', 66 + // 'pagination-ref.yaml', 67 + // 'schema-const.yaml', 68 + // 'sdk-instance.yaml', 69 + // 'sdk-method-class-conflict.yaml', 70 + // 'sdk-nested-classes.yaml', 71 + // 'sdk-nested-conflict.yaml', 72 + 'security-api-key.yaml', 73 + // 'string-with-format.yaml', 74 + // 'transformers.json', 75 + // 'transformers-recursive.json', 76 + // 'type-format.yaml', 77 + // 'validators.yaml', 78 + // 'validators-circular-ref.json', 79 + // 'validators-circular-ref-2.yaml', 80 + // 'zoom-video-sdk.json', 81 + ), 82 + // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0', 83 + // path: 'http://localhost:4000/', 84 + // path: 'http://localhost:8000/openapi.json', 85 + // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 86 + // path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml', 87 + // watch: { 88 + // enabled: true, 89 + // interval: 500, 90 + // timeout: 30_000, 91 + // }, 92 + }, 93 + // path.resolve(getSpecsPath(), '3.1.x', 'full.yaml'), 94 + // { 95 + // branch: 'main', 96 + // organization: 'hey-api', 97 + // path: 'hey-api/backend', 98 + // project: 'backend', 99 + // project: 'upload-openapi-spec', 100 + // version: '1.0.0', 101 + // }, 102 + // 'hey-api/backend?branch=main&version=1.0.0', 103 + // 'scalar:@scalar/access-service', 104 + // 'readme:@developers/v2.0#nysezql0wwo236', 105 + // 'readme:nysezql0wwo236', 106 + // 'https://dash.readme.com/api/v1/api-registry/nysezql0wwo236', 107 + // 'https://somefakedomain.com/openapi.yaml', 108 + ], 109 + logs: { 110 + // level: 'debug', 111 + path: './logs', 112 + }, 113 + output: [ 114 + { 115 + // case: 'snake_case', 116 + // clean: true, 117 + // fileName: { 118 + // // case: 'snake_case', 119 + // // name: '{{name}}.renamed', 120 + // suffix: '.meh', 121 + // }, 122 + // header: null, 123 + header: [ 124 + '/* eslint-disable */', 125 + '// This file is auto-generated by @hey-api/openapi-ts', 126 + ], 127 + // importFileExtension: '.js', 128 + // indexFile: false, 129 + // nameConflictResolver({ attempt, baseName }) { 130 + // // console.log('resolving conflict for:', { attempt, baseName }); 131 + // return attempt === 0 ? baseName : `${baseName}_N${attempt + 1}`; 132 + // }, 133 + path: path.resolve(__dirname, '.gen'), 134 + postProcess: ['eslint'], 135 + // preferExportAll: true, 136 + resolveModuleName: (moduleName) => { 137 + if (moduleName === 'valibot') { 138 + return 'valibot'; 139 + } 140 + return; 141 + }, 142 + source: { 143 + // callback(source) { 144 + // console.log('Source generated, length:', source.length); 145 + // }, 146 + enabled: false, 147 + // extension: 'yaml', 148 + // fileName: 'spec', 149 + // path: null, 150 + // serialize(input) { 151 + // return JSON.stringify(input, null, 0); 152 + // }, 153 + }, 154 + // tsConfigPath: path.resolve( 155 + // __dirname, 156 + // 'tsconfig', 157 + // 'tsconfig.nodenext.json', 158 + // ), 159 + }, 160 + // '.gen', 161 + ], 162 + parser: { 163 + filters: { 164 + // deprecated: false, 165 + operations: { 166 + include: [ 167 + // 'GET /event', 168 + // '/^[A-Z]+ /v1//', 169 + ], 170 + }, 171 + // orphans: true, 172 + // preserveOrder: true, 173 + // schemas: { 174 + // include: ['Foo'], 175 + // }, 176 + // tags: { 177 + // exclude: ['bar'], 178 + // }, 179 + }, 180 + hooks: { 181 + events: { 182 + // 'node:set:after': ({ node, plugin }) => { 183 + // if (node) { 184 + // console.log(`(${plugin.name}) set node:`, node.symbol); 185 + // } 186 + // }, 187 + // 'node:set:before': ({ node, plugin }) => { 188 + // console.log(`(${plugin.name}) setting node:`, node?.symbol?.id); 189 + // }, 190 + // 'plugin:handler:after': ({ plugin }) => { 191 + // console.log(`(${plugin.name}): handler finished`); 192 + // }, 193 + // 'plugin:handler:before': ({ plugin }) => { 194 + // console.log(`(${plugin.name}): handler starting`); 195 + // }, 196 + // 'symbol:register:after': ({ plugin, symbol }) => { 197 + // console.log(`(global, ${plugin.name}) registered:`, symbol.id); 198 + // }, 199 + 'symbol:register:before': ({ plugin, symbol }) => { 200 + // if (!symbol.external && !symbol.meta?.resourceType) { 201 + // console.log(`[${plugin.name}]:`, symbol.name); 202 + // } 203 + if (plugin && !symbol.external && !symbol.meta?.path) { 204 + // console.log(`[${plugin.name}]:`, symbol.name, symbol.meta); 205 + } 206 + // if (symbol.meta?.tags && symbol.meta?.tags.size > 0) { 207 + // console.log( 208 + // `[${plugin.name}]:`, 209 + // symbol.name, 210 + // symbol.meta.path, 211 + // symbol.meta.tags, 212 + // ); 213 + // } 214 + }, 215 + }, 216 + operations: { 217 + getKind() { 218 + // noop 219 + }, 220 + isMutation() { 221 + // noop 222 + }, 223 + isQuery: (op) => { 224 + if (op.method === 'post' && op.path === '/search') { 225 + return true; 226 + } 227 + return; 228 + }, 229 + }, 230 + symbols: { 231 + // getFilePath: (symbol) => { 232 + // if (symbol.name) { 233 + // return symbol.name[0]?.toLowerCase(); 234 + // } 235 + // return; 236 + // }, 237 + }, 238 + }, 239 + pagination: { 240 + // keywords: ['aa'], 241 + }, 242 + patch: { 243 + // operations: { 244 + // 'GET /foo': (operation: any) => { 245 + // operation.responses['200'].description = 'foo'; 246 + // }, 247 + // }, 248 + // version: () => '3.1.1', 249 + }, 250 + transforms: { 251 + // enums: { 252 + // enabled: false, 253 + // mode: 'root', 254 + // // name: '{{name}}', 255 + // }, 256 + // propertiesRequiredByDefault: true, 257 + // readWrite: { 258 + // // enabled: false, 259 + // requests: '{{name}}Writable', 260 + // responses: '{{name}}', 261 + // }, 262 + }, 263 + // validate_EXPERIMENTAL: true, 264 + }, 265 + plugins: [ 266 + // customClientPlugin({ 267 + // baseUrl: false, 268 + // }), 269 + // myClientPlugin(), 270 + { 271 + // baseUrl: false, 272 + // exportFromIndex: true, 273 + // name: '@hey-api/client-angular', 274 + // runtimeConfigPath: path.resolve(__dirname, 'hey-api.ts'), 275 + // runtimeConfigPath: './src/hey-api.ts', 276 + // strictBaseUrl: true, 277 + throwOnError: true, 278 + }, 279 + { 280 + // case: 'snake_case', 281 + // definitions: '你_snake_{{name}}', 282 + enums: { 283 + // case: 'PascalCase', 284 + // constantsIgnoreNull: true, 285 + // enabled: false, 286 + // mode: 'typescript', 287 + }, 288 + // errors: { 289 + // error: '他們_error_{{name}}', 290 + // name: '你們_errors_{{name}}', 291 + // }, 292 + // exportFromIndex: false, 293 + // name: '@hey-api/typescript', 294 + // requests: '我們_data_{{name}}', 295 + // responses: { 296 + // name: '我_responses_{{name}}', 297 + // response: '他_response_{{name}}', 298 + // }, 299 + // topType: 'any', 300 + // tree: true, 301 + // webhooks: { 302 + // name: 'Webby{{name}}Hook', 303 + // payload: '{{name}}WebhookEvent', 304 + // }, 305 + }, 306 + { 307 + // auth: false, 308 + // client: false, 309 + examples: { 310 + // enabled: false, 311 + importKind: 'default', 312 + importName: 'CatStore', 313 + importSetup: ({ $, node }) => 314 + $.new( 315 + node.name, 316 + $.object().pretty().prop('apiKey', $.literal('YOUR_API_KEY')), 317 + ), 318 + // language: 'TypeScript', 319 + moduleName: '@petstore/client', 320 + payload(operation, ctx) { 321 + const { $ } = ctx; 322 + if ( 323 + operation.path === '/pet/{petId}' || 324 + operation.path === '/pet' 325 + ) { 326 + return $.object().pretty().prop('petId', $.literal(1234)); 327 + } 328 + return; 329 + }, 330 + setupName: 'client', 331 + // transform: (example) => example.replace(/\({}\)/, '({\n ...\n})'), 332 + }, 333 + // getSignature: ({ fields, signature, operation }) => { 334 + // // ... 335 + // fields.unwrap('path') 336 + // }, 337 + // include... 338 + name: '@hey-api/sdk', 339 + operations: { 340 + // container: 'object', 341 + // containerName: { 342 + // // casing: 'snake_case', 343 + // name: 'OpencodeClient', 344 + // }, 345 + containerName: 'PetStore', 346 + // nesting(operation) { 347 + // if (operation.path === '/pet/{petId}' || operation.path === '/pet') { 348 + // return ['pet', operation.operationId?.replace(/Pet/, '') || operation.method.toLocaleLowerCase()]; 349 + // } 350 + // return OperationPath.fromOperationId()(operation); 351 + // }, 352 + // methodName: { 353 + // // casing: 'SCREAMING_SNAKE_CASE', 354 + // name: '{{name}}Yummy', 355 + // }, 356 + // methods: 'static', 357 + // nesting: 'id', 358 + // segmentName: '{{name}}Seggy', 359 + strategy: 'single', 360 + // strategy(operation) { 361 + // const locations = OperationStrategy.byTags({ 362 + // fallback: 'default', 363 + // path: OperationPath.fromOperationId({ 364 + // delimiters: /[./]/, 365 + // }), 366 + // })(operation) 367 + // return locations.map((loc) => { 368 + // if (loc[0] && loc[1] && loc[0] === loc[1]) { 369 + // return loc.slice(1); 370 + // } 371 + // return loc; 372 + // }); 373 + // }, 374 + // strategyDefaultTag: 'DaxLikedThis', 375 + }, 376 + paramsStructure: 'flat', 377 + // responseStyle: 'data', 378 + // signature: 'auto', 379 + // signature: 'client', 380 + // signature: 'object', 381 + // transformer: '@hey-api/transformers', 382 + // transformer: true, 383 + // validator: 'valibot', 384 + // validator: { 385 + // request: 'zod', 386 + // response: 'zod', 387 + // }, 388 + '~hooks': { 389 + symbols: { 390 + // getFilePath: (symbol) => { 391 + // if (symbol.name) { 392 + // return utils.toCase(symbol.name, 'camelCase'); 393 + // } 394 + // return; 395 + // }, 396 + }, 397 + }, 398 + }, 399 + { 400 + // bigInt: true, 401 + dates: true, 402 + // name: '@hey-api/transformers', 403 + }, 404 + { 405 + // name: 'fastify', 406 + }, 407 + { 408 + // name: 'swr', 409 + }, 410 + { 411 + // case: 'SCREAMING_SNAKE_CASE', 412 + // comments: false, 413 + exportFromIndex: true, 414 + infiniteQueryKeys: { 415 + // name: '{{name}}IQK', 416 + // name: 'options', 417 + }, 418 + infiniteQueryOptions: { 419 + meta() { 420 + return { 421 + custom: 'value', 422 + }; 423 + }, 424 + // name: '{{name}}IQO', 425 + // name: 'options', 426 + }, 427 + mutationOptions: { 428 + meta() { 429 + return { 430 + custom: 'value', 431 + }; 432 + }, 433 + // name: '{{name}}MO', 434 + // name: 'options', 435 + }, 436 + // name: '@tanstack/react-query', 437 + queryKeys: { 438 + // name: '{{name}}QK', 439 + // name: 'options', 440 + tags: true, 441 + }, 442 + // queryOptions: false, 443 + queryOptions: { 444 + // meta() { 445 + // return { 446 + // custom: 'value', 447 + // } 448 + // }, 449 + // name: '{{name}}QO', 450 + // name: 'options', 451 + }, 452 + useQuery: true, 453 + '~hooks': { 454 + operations: { 455 + getKind: (op) => { 456 + if (op.method === 'post' && op.path === '/search') { 457 + return ['query']; 458 + } 459 + return; 460 + }, 461 + isMutation() { 462 + // noop 463 + }, 464 + isQuery: () => { 465 + // noop 466 + }, 467 + }, 468 + }, 469 + }, 470 + { 471 + // name: 'arktype', 472 + types: { 473 + infer: true, 474 + }, 475 + }, 476 + { 477 + // case: 'SCREAMING_SNAKE_CASE', 478 + // comments: false, 479 + // definitions: 'z{{name}}', 480 + exportFromIndex: true, 481 + // metadata: true, 482 + // name: 'valibot', 483 + // requests: { 484 + // case: 'PascalCase', 485 + // name: '{{name}}Data', 486 + // }, 487 + // responses: { 488 + // // case: 'snake_case', 489 + // name: 'z{{name}}TestResponse', 490 + // }, 491 + // webhooks: { 492 + // name: 'q{{name}}CoolWebhook', 493 + // }, 494 + '~hooks': { 495 + events: { 496 + // 'symbol:register:after': ({ plugin, symbol }) => { 497 + // console.log(`(${plugin.name}) registered:`, symbol.id); 498 + // }, 499 + // 'symbol:register:before': ({ plugin, symbol }) => { 500 + // console.log(`(${plugin.name}):`, symbol.name); 501 + // }, 502 + }, 503 + symbols: { 504 + // getFilePath: (symbol) => { 505 + // if (symbol.name) { 506 + // return utils.toCase(symbol.name, 'camelCase'); 507 + // } 508 + // return; 509 + // }, 510 + }, 511 + }, 512 + '~resolvers': { 513 + // number(ctx) { 514 + // const { $, plugin, symbols } = ctx; 515 + // const { v } = symbols; 516 + // // ctx.nodes.base = () => { 517 + // // // implement custom base number resolver 518 + // // } 519 + // const big = plugin.symbolOnce('Big', { 520 + // external: 'big.js', 521 + // importKind: 'default', 522 + // }); 523 + // return $(v).attr('instance').call(big); 524 + // }, 525 + object(ctx) { 526 + const { $, symbols } = ctx; 527 + const { v } = symbols; 528 + const additional = ctx.nodes.additionalProperties(ctx); 529 + if (additional === undefined) { 530 + const shape = ctx.nodes.shape(ctx); 531 + ctx.nodes.base = () => $(v).attr('looseObject').call(shape); 532 + } 533 + }, 534 + // string(ctx) { 535 + // const { $, schema, symbols } = ctx; 536 + // const { v } = symbols; 537 + // if (schema.format === 'date' || schema.format === 'date-time') { 538 + // ctx.nodes.format = () => $(v).attr('isoDateTime').call(); 539 + // } 540 + // }, 541 + // validator(ctx) { 542 + // const { $, plugin, symbols } = ctx; 543 + // const { schema, v } = symbols; 544 + // const vShadow = plugin.symbol('v'); 545 + // const test = plugin.symbol('test'); 546 + // const e = plugin.symbol('err'); 547 + // return [ 548 + // $.const(vShadow).assign($.literal('hi')), 549 + // $('console').attr('log').call(vShadow), 550 + // $.try( 551 + // $.const(test).assign($.literal('test')), 552 + // $('console').attr('log').call($.literal('hi'), test), 553 + // ).catchArg(e), 554 + // $.const('parsed').assign( 555 + // $(v).attr('safeParseAsync').call(schema, 'data').await(), 556 + // ), 557 + // $('parsed').return(), 558 + // ]; 559 + // }, 560 + }, 561 + }, 562 + { 563 + // case: 'snake_case', 564 + // comments: false, 565 + compatibilityVersion: 'mini', 566 + dates: { 567 + // local: true, 568 + // offset: true, 569 + }, 570 + definitions: { 571 + // name: 'z{{name}}Definition', 572 + // types: { 573 + // infer: 'D{{name}}ZodType', 574 + // }, 575 + }, 576 + exportFromIndex: true, 577 + metadata: true, 578 + // name: 'zod', 579 + // requests: { 580 + // // case: 'SCREAMING_SNAKE_CASE', 581 + // // name: 'z{{name}}TestData', 582 + // types: { 583 + // infer: 'E{{name}}DataZodType', 584 + // }, 585 + // }, 586 + responses: { 587 + // case: 'snake_case', 588 + // name: (name) => { 589 + // if (name === 'complexTypes') { 590 + // return 'z'; 591 + // } 592 + // return 'z{{name}}Response'; 593 + // }, 594 + // types: { 595 + // infer: 'F{{name}}ResponseZodType', 596 + // }, 597 + }, 598 + types: { 599 + // infer: { 600 + // case: 'snake_case', 601 + // }, 602 + }, 603 + '~hooks': { 604 + symbols: { 605 + // getFilePath: (symbol) => { 606 + // if (symbol.name === 'z') { 607 + // return 'complexService'; 608 + // } 609 + // return; 610 + // }, 611 + }, 612 + }, 613 + '~resolvers': { 614 + // number(ctx) { 615 + // const { $, plugin, symbols } = ctx; 616 + // const { z } = symbols; 617 + // // ctx.nodes.base = () => { 618 + // // // implement custom base number resolver 619 + // // } 620 + // const big = plugin.symbolOnce('Big', { 621 + // external: 'big.js', 622 + // importKind: 'default', 623 + // }); 624 + // return $(z).attr('instanceof').call(big); 625 + // }, 626 + // object(ctx) { 627 + // const { $, symbols } = ctx; 628 + // const { z } = symbols; 629 + // const additional = ctx.nodes.additionalProperties(ctx); 630 + // if (additional === undefined) { 631 + // const shape = ctx.nodes.shape(ctx); 632 + // // return $('z').attr('object').call(shape).attr('passthrough').call() 633 + // ctx.nodes.base = () => 634 + // $(z).attr('object').call(shape).attr('strict').call(); 635 + // } 636 + // }, 637 + // string(ctx) { 638 + // const { $, schema, symbols } = ctx; 639 + // const { z } = symbols; 640 + // if (schema.format === 'date' || schema.format === 'date-time') { 641 + // ctx.nodes.format = () => $(z).attr('date').call(); 642 + // } 643 + // if (schema.format === 'int64') { 644 + // ctx.nodes.format = () => 645 + // $(z) 646 + // .attr('string') 647 + // .call() 648 + // .attr('refine') 649 + // .call( 650 + // $.func() 651 + // .param('val') 652 + // .do( 653 + // $.try( 654 + // $(z) 655 + // .attr('int64') 656 + // .call() 657 + // .attr('parse') 658 + // .call($('BigInt').call('val')), 659 + // $.return($.literal(true)), 660 + // ).catch($.return($.literal(false))), 661 + // ), 662 + // $.object().prop( 663 + // 'message', 664 + // $.literal('Must be a valid int64 string'), 665 + // ), 666 + // ); 667 + // } 668 + // }, 669 + // validator({ $, schema }) { 670 + // return [ 671 + // $.const('parsed').assign( 672 + // $(schema).attr('safeParseAsync').call('data').await(), 673 + // ), 674 + // $('parsed').return(), 675 + // ]; 676 + // }, 677 + }, 678 + }, 679 + { 680 + exportFromIndex: true, 681 + // name: '@hey-api/schemas', 682 + // type: 'json', 683 + }, 684 + { 685 + exportFromIndex: true, 686 + httpRequests: { 687 + // enabled: false, 688 + // containerName: 'AngularTest', 689 + // segmentName: '{{name}}Seggy', 690 + // strategy: 'byTags', 691 + }, 692 + httpResources: { 693 + // enabled: false, 694 + // segmentName: '{{name}}Seggy', 695 + strategy: 'byTags', 696 + }, 697 + // name: '@angular/common', 698 + }, 699 + { 700 + exportFromIndex: true, 701 + // mutationOptions: '{{name}}Mutationssss', 702 + // name: '@pinia/colada', 703 + // queryOptions: { 704 + // name: '{{name}}Queryyyyy', 705 + // }, 706 + queryKeys: { 707 + tags: true, 708 + }, 709 + '~hooks': { 710 + operations: { 711 + getKind: (op) => { 712 + if (op.method === 'post' && op.path === '/search') { 713 + return ['query']; 714 + } 715 + return; 716 + }, 717 + }, 718 + }, 719 + }, 720 + ], 721 + // watch: 3_000, 722 + }, 723 + // { 724 + // input: 'scalar:@scalar/access-service', 725 + // logs: { 726 + // // level: 'debug', 727 + // path: './logs', 728 + // }, 729 + // output: '.gen', 730 + // }, 731 + ]; 732 + });
-2
dev/openapi-ts.config.ts
··· 30 30 // ... 31 31 return [ 32 32 { 33 - // experimentalParser: false, 34 33 input: [ 35 34 { 36 35 // fetch: { ··· 107 106 // level: 'debug', 108 107 path: './logs', 109 108 }, 110 - // name: 'foo', 111 109 output: [ 112 110 { 113 111 // case: 'snake_case',
+1
dev/package.json
··· 13 13 "@angular/common": "19.2.17", 14 14 "@angular/core": "19.2.17", 15 15 "@hey-api/codegen-core": "workspace:*", 16 + "@hey-api/openapi-python": "workspace:*", 16 17 "@hey-api/openapi-ts": "workspace:*", 17 18 "@opencode-ai/sdk": "1.0.221", 18 19 "@pinia/colada": "0.19.1",
+1 -1
docs/openapi-ts/configuration.md
··· 242 242 243 243 ## API 244 244 245 - You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/types/config.d.ts) interface. 245 + You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/config/types.d.ts) interface. 246 246 247 247 <!--@include: ../partials/examples.md--> 248 248 <!--@include: ../partials/sponsors.md-->
+1
packages/codegen-core/src/__tests__/exports.test.ts
··· 14 14 'isSymbol', 15 15 'isSymbolRef', 16 16 'log', 17 + 'Logger', 17 18 'nodeBrand', 18 19 'Project', 19 20 'ref',
+1
packages/codegen-core/src/index.ts
··· 20 20 NameConflictResolvers, 21 21 } from './languages/types'; 22 22 export { log } from './log'; 23 + export { Logger } from './logger'; 23 24 export type { 24 25 INode as Node, 25 26 NodeName,
+12 -12
packages/openapi-python/src/cli.ts
··· 1 1 import type { OptionValues } from 'commander'; 2 2 import { Command } from 'commander'; 3 3 4 - // import { createClient } from '~/index'; 4 + import { createClient } from '~/index'; 5 + 5 6 import pkg from '../package.json' assert { type: 'json' }; 6 7 7 8 const stringToBoolean = ( ··· 103 104 delete userConfig.logs; 104 105 } 105 106 106 - // const context = await createClient( 107 - // userConfig as unknown as Required<Parameters<typeof createClient>>[0], 108 - // ); 109 - // if ( 110 - // !context[0]?.config.input.some( 111 - // (input) => input.watch && input.watch.enabled, 112 - // ) 113 - // ) { 114 - // process.exit(0); 115 - // } 116 - process.exit(0); 107 + const context = await createClient( 108 + userConfig as unknown as Required<Parameters<typeof createClient>>[0], 109 + ); 110 + if ( 111 + !context[0]?.config.input.some( 112 + (input) => input.watch && input.watch.enabled, 113 + ) 114 + ) { 115 + process.exit(0); 116 + } 117 117 } catch { 118 118 process.exit(1); 119 119 }
+135
packages/openapi-python/src/generate.ts
··· 1 + import { Logger } from '@hey-api/codegen-core'; 2 + import type { LazyOrAsync, MaybeArray } from '@hey-api/types'; 3 + 4 + // import { checkNodeVersion } from '~/config/engine'; 5 + // import type { Configs } from '~/config/init'; 6 + // import { initConfigs } from '~/config/init'; 7 + // import { getLogs } from '~/config/logs'; 8 + import type { UserConfig } from '~/config/types'; 9 + // import { createClient as pCreateClient } from '~/createClient'; 10 + // import { 11 + // ConfigValidationError, 12 + // JobError, 13 + // logCrashReport, 14 + // openGitHubIssueWithCrashReport, 15 + // printCrashReport, 16 + // shouldReportCrash, 17 + // } from '~/error'; 18 + // import type { Context } from '~/ir/context'; 19 + // import { printCliIntro } from '~/utils/cli'; 20 + 21 + type Context = { 22 + config: { 23 + input: any[]; 24 + }; 25 + }; 26 + 27 + /** 28 + * Generate a client from the provided configuration. 29 + * 30 + * @param userConfig User provided {@link UserConfig} configuration(s). 31 + */ 32 + export const createClient = async ( 33 + userConfig?: LazyOrAsync<MaybeArray<UserConfig>>, 34 + logger = new Logger(), 35 + ): Promise<ReadonlyArray<Context>> => { 36 + const resolvedConfig = 37 + typeof userConfig === 'function' ? await userConfig() : userConfig; 38 + const userConfigs = resolvedConfig 39 + ? resolvedConfig instanceof Array 40 + ? resolvedConfig 41 + : [resolvedConfig] 42 + : []; 43 + 44 + console.log(userConfigs, logger); 45 + return []; 46 + // let rawLogs = userConfigs.find( 47 + // (config) => getLogs(config).level !== 'silent', 48 + // )?.logs; 49 + // if (typeof rawLogs === 'string') { 50 + // rawLogs = getLogs({ logs: rawLogs }); 51 + // } 52 + 53 + // let configs: Configs | undefined; 54 + 55 + // try { 56 + // checkNodeVersion(); 57 + 58 + // const eventCreateClient = logger.timeEvent('createClient'); 59 + 60 + // const eventConfig = logger.timeEvent('config'); 61 + // configs = await initConfigs({ logger, userConfigs }); 62 + // const printIntro = configs.results.some( 63 + // (result) => result.config.logs.level !== 'silent', 64 + // ); 65 + // if (printIntro) { 66 + // printCliIntro(); 67 + // } 68 + // eventConfig.timeEnd(); 69 + 70 + // const allConfigErrors = configs.results.flatMap((result) => 71 + // result.errors.map((error) => ({ error, jobIndex: result.jobIndex })), 72 + // ); 73 + // if (allConfigErrors.length) { 74 + // throw new ConfigValidationError(allConfigErrors); 75 + // } 76 + 77 + // const clients = await Promise.all( 78 + // configs.results.map(async (result) => { 79 + // try { 80 + // return await pCreateClient({ 81 + // config: result.config, 82 + // dependencies: configs!.dependencies, 83 + // jobIndex: result.jobIndex, 84 + // logger, 85 + // }); 86 + // } catch (error) { 87 + // throw new JobError('', { 88 + // error, 89 + // jobIndex: result.jobIndex, 90 + // }); 91 + // } 92 + // }), 93 + // ); 94 + // const result = clients.filter((client) => 95 + // Boolean(client), 96 + // ) as ReadonlyArray<Context>; 97 + 98 + // eventCreateClient.timeEnd(); 99 + 100 + // const printLogs = configs.results.some( 101 + // (result) => result.config.logs.level === 'debug', 102 + // ); 103 + // logger.report(printLogs); 104 + 105 + // return result; 106 + // } catch (error) { 107 + // const results = configs?.results ?? []; 108 + 109 + // const logs = 110 + // results.find((result) => result.config.logs.level !== 'silent')?.config 111 + // .logs ?? 112 + // results[0]?.config.logs ?? 113 + // rawLogs; 114 + // const dryRun = 115 + // results.some((result) => result.config.dryRun) ?? 116 + // userConfigs.some((config) => config.dryRun) ?? 117 + // false; 118 + // const logPath = 119 + // logs?.file && !dryRun 120 + // ? logCrashReport(error, logs.path ?? '') 121 + // : undefined; 122 + // if (!logs || logs.level !== 'silent') { 123 + // printCrashReport({ error, logPath }); 124 + // const isInteractive = 125 + // results.some((result) => result.config.interactive) ?? 126 + // userConfigs.some((config) => config.interactive) ?? 127 + // false; 128 + // if (await shouldReportCrash({ error, isInteractive })) { 129 + // await openGitHubIssueWithCrashReport(error); 130 + // } 131 + // } 132 + 133 + // throw error; 134 + // } 135 + };
+3 -10
packages/openapi-python/src/index.ts
··· 76 76 77 77 colors.enabled = colorSupport().hasBasic; 78 78 79 - // export { createClient } from '~/generate'; 79 + export { createClient } from '~/generate'; 80 80 81 81 /** 82 82 * Type helper for openapi-ts.config.ts, returns {@link MaybeArray<UserConfig>} object(s) ··· 85 85 config: LazyOrAsync<T>, 86 86 ): Promise<T> => (typeof config === 'function' ? await config() : config); 87 87 88 + export { Logger } from '@hey-api/codegen-core'; 88 89 // export { defaultPaginationKeywords } from '~/config/parser'; 89 90 // export { defaultPlugins } from '~/config/plugins'; 91 + export type { UserConfig } from '~/config/types'; 90 92 // export type { IR } from '~/ir/types'; 91 93 // export { OperationPath, OperationStrategy } from '~/openApi/shared/locations'; 92 94 // export type { ··· 99 101 // OpenApiSchemaObject, 100 102 // } from '~/openApi/types'; 101 103 // export type { DefinePlugin, Plugin } from '~/plugins'; 102 - // export type { AngularClient } from '~/plugins/@hey-api/client-angular'; 103 - // export type { AxiosClient } from '~/plugins/@hey-api/client-axios'; 104 104 // export { 105 105 // clientDefaultConfig, 106 106 // clientDefaultMeta, ··· 108 108 // export { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin'; 109 109 // export type { Client } from '~/plugins/@hey-api/client-core/types'; 110 110 // export type { FetchClient } from '~/plugins/@hey-api/client-fetch'; 111 - // export type { NextClient } from '~/plugins/@hey-api/client-next'; 112 - // export type { NuxtClient } from '~/plugins/@hey-api/client-nuxt'; 113 - // export type { OfetchClient } from '~/plugins/@hey-api/client-ofetch'; 114 - // export type { ExpressionTransformer } from '~/plugins/@hey-api/transformers/expressions'; 115 - // export type { TypeTransformer } from '~/plugins/@hey-api/transformers/types'; 116 111 // export { definePluginConfig } from '~/plugins/shared/utils/config'; 117 112 // export * from '~/ts-dsl'; 118 - // export type { UserConfig } from '~/types/config'; 119 113 // export { utils } from '~/utils/exports'; 120 - // export { Logger } from '~/utils/logger';
+1 -1
packages/openapi-ts/src/__tests__/interactive.test.ts
··· 1 + import { Logger } from '@hey-api/codegen-core'; 1 2 import { afterEach, describe, expect, it } from 'vitest'; 2 3 3 4 import { detectInteractiveSession, initConfigs } from '~/config/init'; 4 5 import { mergeConfigs } from '~/config/merge'; 5 - import { Logger } from '~/utils/logger'; 6 6 7 7 describe('interactive config', () => { 8 8 it('should use detectInteractiveSession when not provided', async () => {
+1 -2
packages/openapi-ts/src/config/__tests__/input.test.ts
··· 1 1 import { describe, expect, it } from 'vitest'; 2 2 3 - import type { UserConfig } from '~/types/config'; 4 - 5 3 import { getInput } from '../input'; 4 + import type { UserConfig } from '../types'; 6 5 7 6 describe('input config', () => { 8 7 describe('getInput', () => {
+2 -2
packages/openapi-ts/src/config/init.ts
··· 1 1 import path from 'node:path'; 2 2 3 + import type { Logger } from '@hey-api/codegen-core'; 3 4 import type { ArrayOnly } from '@hey-api/types'; 4 5 import colors from 'ansi-colors'; 5 6 6 7 import { ConfigError } from '~/error'; 7 - import type { Config, UserConfig } from '~/types/config'; 8 - import type { Logger } from '~/utils/logger'; 9 8 10 9 import { getInput } from './input'; 11 10 import { getLogs } from './logs'; ··· 14 13 import { getProjectDependencies } from './packages'; 15 14 import { getParser } from './parser'; 16 15 import { getPlugins } from './plugins'; 16 + import type { Config, UserConfig } from './types'; 17 17 18 18 type ConfigResult = { 19 19 config: Config;
+2 -1
packages/openapi-ts/src/config/input.ts
··· 1 - import type { Config, UserConfig } from '~/types/config'; 2 1 import type { Input, Watch } from '~/types/input'; 3 2 import { inputToApiRegistry } from '~/utils/input'; 4 3 import { heyApiRegistryBaseUrl } from '~/utils/input/heyApi'; 4 + 5 + import type { Config, UserConfig } from './types'; 5 6 6 7 const defaultWatch: Watch = { 7 8 enabled: false,
+1 -1
packages/openapi-ts/src/config/logs.ts
··· 1 - import type { Config, UserConfig } from '~/types/config'; 1 + import type { Config, UserConfig } from './types'; 2 2 3 3 export const getLogs = ( 4 4 userConfig: Pick<UserConfig, 'logs'> | undefined,
+1 -1
packages/openapi-ts/src/config/merge.ts
··· 1 - import type { UserConfig } from '~/types/config'; 1 + import type { UserConfig } from './types'; 2 2 3 3 const mergeObjects = ( 4 4 objA: Record<string, unknown> | undefined,
+1 -1
packages/openapi-ts/src/config/output/config.ts
··· 2 2 import ts from 'typescript'; 3 3 4 4 import { findTsConfigPath, loadTsConfig } from '~/generate/tsConfig'; 5 - import type { Config, UserConfig } from '~/types/config'; 6 5 6 + import type { Config, UserConfig } from '../types'; 7 7 import { valueToObject } from '../utils/config'; 8 8 import type { PostProcessor, UserPostProcessor } from './postprocess'; 9 9 import { postProcessors } from './postprocess';
+1 -2
packages/openapi-ts/src/config/parser.ts
··· 1 - import type { Config, UserConfig } from '~/types/config'; 2 - 1 + import type { Config, UserConfig } from './types'; 3 2 import { valueToObject } from './utils/config'; 4 3 5 4 export const defaultPaginationKeywords = [
+1 -1
packages/openapi-ts/src/config/plugins.ts
··· 4 4 PluginContext, 5 5 PluginNames, 6 6 } from '~/plugins/types'; 7 - import type { Config, UserConfig } from '~/types/config'; 8 7 8 + import type { Config, UserConfig } from './types'; 9 9 import { valueToObject } from './utils/config'; 10 10 import { packageFactory } from './utils/package'; 11 11
+2 -2
packages/openapi-ts/src/createClient.ts
··· 1 1 import path from 'node:path'; 2 2 3 + import type { Logger } from '@hey-api/codegen-core'; 3 4 import { $RefParser } from '@hey-api/json-schema-ref-parser'; 4 5 import colors from 'ansi-colors'; 5 6 6 7 import { postprocessOutput } from '~/config/output'; 8 + import type { Config } from '~/config/types'; 7 9 import { generateOutput } from '~/generate/output'; 8 10 import { getSpec } from '~/getSpec'; 9 11 import type { Context } from '~/ir/context'; 10 12 import { parseOpenApiSpec } from '~/openApi'; 11 13 import { buildGraph } from '~/openApi/shared/utils/graph'; 12 14 import { patchOpenApiSpec } from '~/openApi/shared/utils/patch'; 13 - import type { Config } from '~/types/config'; 14 15 import type { Input } from '~/types/input'; 15 16 import type { WatchValues } from '~/types/types'; 16 - import type { Logger } from '~/utils/logger'; 17 17 18 18 export const compileInputPath = (input: Omit<Input, 'watch'>) => { 19 19 const result: Pick<
+2 -2
packages/openapi-ts/src/generate.ts
··· 1 + import { Logger } from '@hey-api/codegen-core'; 1 2 import type { LazyOrAsync, MaybeArray } from '@hey-api/types'; 2 3 3 4 import { checkNodeVersion } from '~/config/engine'; 4 5 import type { Configs } from '~/config/init'; 5 6 import { initConfigs } from '~/config/init'; 6 7 import { getLogs } from '~/config/logs'; 8 + import type { UserConfig } from '~/config/types'; 7 9 import { createClient as pCreateClient } from '~/createClient'; 8 10 import { 9 11 ConfigValidationError, ··· 14 16 shouldReportCrash, 15 17 } from '~/error'; 16 18 import type { Context } from '~/ir/context'; 17 - import type { UserConfig } from '~/types/config'; 18 19 import { printCliIntro } from '~/utils/cli'; 19 - import { Logger } from '~/utils/logger'; 20 20 21 21 /** 22 22 * Generate a client from the provided configuration.
+1 -1
packages/openapi-ts/src/generate/client.ts
··· 4 4 5 5 import type { IProject, ProjectRenderMeta } from '@hey-api/codegen-core'; 6 6 7 + import type { Config } from '~/config/types'; 7 8 import type { DefinePlugin } from '~/plugins'; 8 9 import type { Client } from '~/plugins/@hey-api/client-core/types'; 9 10 import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; 10 - import type { Config } from '~/types/config'; 11 11 12 12 import { ensureDirSync } from './utils'; 13 13
+3 -3
packages/openapi-ts/src/index.ts
··· 72 72 // @ts-expect-error 73 73 import colorSupport from 'color-support'; 74 74 75 - import type { UserConfig } from '~/types/config'; 75 + import type { UserConfig } from '~/config/types'; 76 76 77 77 colors.enabled = colorSupport().hasBasic; 78 78 ··· 85 85 config: LazyOrAsync<T>, 86 86 ): Promise<T> => (typeof config === 'function' ? await config() : config); 87 87 88 + export { Logger } from '@hey-api/codegen-core'; 88 89 export { defaultPaginationKeywords } from '~/config/parser'; 89 90 export { defaultPlugins } from '~/config/plugins'; 91 + export type { UserConfig } from '~/config/types'; 90 92 export type { IR } from '~/ir/types'; 91 93 export { OperationPath, OperationStrategy } from '~/openApi/shared/locations'; 92 94 export type { ··· 115 117 export type { TypeTransformer } from '~/plugins/@hey-api/transformers/types'; 116 118 export { definePluginConfig } from '~/plugins/shared/utils/config'; 117 119 export * from '~/ts-dsl'; 118 - export type { UserConfig } from '~/types/config'; 119 120 export { utils } from '~/utils/exports'; 120 - export { Logger } from '~/utils/logger';
+1 -1
packages/openapi-ts/src/ir/__tests__/pagination.test.ts
··· 1 1 import { describe, expect, it, vi } from 'vitest'; 2 2 3 3 import { defaultPaginationKeywords } from '~/config/parser'; 4 - import type { Config } from '~/types/config'; 4 + import type { Config } from '~/config/types'; 5 5 6 6 import type { Context } from '../context'; 7 7 import { operationPagination } from '../operation';
+2 -2
packages/openapi-ts/src/ir/context.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 1 2 import { Project } from '@hey-api/codegen-core'; 2 3 4 + import type { Config } from '~/config/types'; 3 5 import type { Package } from '~/config/utils/package'; 4 6 import { packageFactory } from '~/config/utils/package'; 5 7 import type { Graph } from '~/graph'; ··· 7 9 import { PluginInstance } from '~/plugins/shared/utils/instance'; 8 10 import type { PluginNames } from '~/plugins/types'; 9 11 import { TypeScriptRenderer } from '~/ts-dsl'; 10 - import type { Config } from '~/types/config'; 11 - import type { Logger } from '~/utils/logger'; 12 12 import { applyNaming } from '~/utils/naming'; 13 13 import { resolveRef } from '~/utils/ref'; 14 14
+1 -1
packages/openapi-ts/src/ir/pagination.ts
··· 1 - import type { Config } from '~/types/config'; 1 + import type { Config } from '~/config/types'; 2 2 3 3 import type { IR } from './types'; 4 4
+1 -1
packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/validate.test.ts
··· 1 1 import path from 'node:path'; 2 2 3 + import { Logger } from '@hey-api/codegen-core'; 3 4 import { describe, expect, it } from 'vitest'; 4 5 5 6 import { getSpecsPath, specFileToJson } from '~/openApi/__tests__/utils'; 6 7 import type { ValidatorResult } from '~/openApi/shared/utils/validator'; 7 8 8 - import { Logger } from '../../../../utils/logger'; 9 9 import { validateOpenApiSpec } from '../validate'; 10 10 11 11 const specsFolder = path.join(getSpecsPath(), '2.0.x', 'invalid');
+2 -1
packages/openapi-ts/src/openApi/2.0.x/parser/filter.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import { createOperationKey } from '~/ir/operation'; 2 4 import { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter'; 3 5 import { httpMethods } from '~/openApi/shared/utils/operation'; 4 - import type { Logger } from '~/utils/logger'; 5 6 6 7 import type { 7 8 OpenApiV2_0_X,
+2 -1
packages/openapi-ts/src/openApi/2.0.x/parser/validate.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import { createOperationKey } from '~/ir/operation'; 2 4 import { httpMethods } from '~/openApi/shared/utils/operation'; 3 5 import type { 4 6 ValidatorIssue, 5 7 ValidatorResult, 6 8 } from '~/openApi/shared/utils/validator'; 7 - import type { Logger } from '~/utils/logger'; 8 9 9 10 import type { OpenApiV2_0_X, PathItemObject, PathsObject } from '../types/spec'; 10 11
+1 -1
packages/openapi-ts/src/openApi/3.0.x/parser/__tests__/validate.test.ts
··· 1 1 import path from 'node:path'; 2 2 3 + import { Logger } from '@hey-api/codegen-core'; 3 4 import { describe, expect, it } from 'vitest'; 4 5 5 6 import { getSpecsPath, specFileToJson } from '~/openApi/__tests__/utils'; 6 7 import type { ValidatorResult } from '~/openApi/shared/utils/validator'; 7 8 8 - import { Logger } from '../../../../utils/logger'; 9 9 import { validateOpenApiSpec } from '../validate'; 10 10 11 11 const specsFolder = path.join(getSpecsPath(), '3.0.x', 'invalid');
+2 -1
packages/openapi-ts/src/openApi/3.0.x/parser/filter.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import { createOperationKey } from '~/ir/operation'; 2 4 import { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter'; 3 5 import { httpMethods } from '~/openApi/shared/utils/operation'; 4 - import type { Logger } from '~/utils/logger'; 5 6 6 7 import type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec'; 7 8
+2 -1
packages/openapi-ts/src/openApi/3.0.x/parser/validate.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import { createOperationKey } from '~/ir/operation'; 2 4 import { httpMethods } from '~/openApi/shared/utils/operation'; 3 5 import type { 4 6 ValidatorIssue, 5 7 ValidatorResult, 6 8 } from '~/openApi/shared/utils/validator'; 7 - import type { Logger } from '~/utils/logger'; 8 9 9 10 import type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec'; 10 11
+1 -1
packages/openapi-ts/src/openApi/3.1.x/parser/__tests__/validate.test.ts
··· 1 1 import path from 'node:path'; 2 2 3 + import { Logger } from '@hey-api/codegen-core'; 3 4 import { describe, expect, it } from 'vitest'; 4 5 5 6 import { getSpecsPath, specFileToJson } from '~/openApi/__tests__/utils'; 6 7 import type { ValidatorResult } from '~/openApi/shared/utils/validator'; 7 8 8 - import { Logger } from '../../../../utils/logger'; 9 9 import { validateOpenApiSpec } from '../validate'; 10 10 11 11 const specsFolder = path.join(getSpecsPath(), '3.1.x', 'invalid');
+2 -1
packages/openapi-ts/src/openApi/3.1.x/parser/filter.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import { createOperationKey } from '~/ir/operation'; 2 4 import { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter'; 3 5 import { httpMethods } from '~/openApi/shared/utils/operation'; 4 - import type { Logger } from '~/utils/logger'; 5 6 6 7 import type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec'; 7 8
+2 -1
packages/openapi-ts/src/openApi/3.1.x/parser/validate.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import { createOperationKey } from '~/ir/operation'; 2 4 import { httpMethods } from '~/openApi/shared/utils/operation'; 3 5 import type { 4 6 ValidatorIssue, 5 7 ValidatorResult, 6 8 } from '~/openApi/shared/utils/validator'; 7 - import type { Logger } from '~/utils/logger'; 8 9 9 10 import type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec'; 10 11
+1 -1
packages/openapi-ts/src/openApi/__tests__/index.test.ts
··· 1 1 import { afterEach, describe, expect, it, vi } from 'vitest'; 2 2 3 + import type { Config } from '~/config/types'; 3 4 import type { OpenApiV3_0_X } from '~/openApi/3.0.x'; 4 5 import { parseV3_0_X } from '~/openApi/3.0.x'; 5 6 import type { OpenApiV3_1_X } from '~/openApi/3.1.x'; 6 7 import { parseV3_1_X } from '~/openApi/3.1.x'; 7 8 8 - import type { Config } from '../../types/config'; 9 9 import { parseOpenApiSpec } from '..'; 10 10 11 11 vi.mock('../3.0.x', () => ({
+3 -2
packages/openapi-ts/src/openApi/index.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 3 + import type { Config } from '~/config/types'; 1 4 import { satisfies } from '~/config/utils/package'; 2 5 import { Context } from '~/ir/context'; 3 6 import { parseV2_0_X } from '~/openApi/2.0.x'; 4 7 import { parseV3_0_X } from '~/openApi/3.0.x'; 5 8 import { parseV3_1_X } from '~/openApi/3.1.x'; 6 9 import type { OpenApi } from '~/openApi/types'; 7 - import type { Config } from '~/types/config'; 8 - import type { Logger } from '~/utils/logger'; 9 10 10 11 /** 11 12 * @internal
+2 -1
packages/openapi-ts/src/openApi/shared/graph/meta.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import type { Graph } from '~/graph'; 2 4 import { createOperationKey } from '~/ir/operation'; 3 - import type { Logger } from '~/utils/logger'; 4 5 import { jsonPointerToPath } from '~/utils/ref'; 5 6 6 7 import { addNamespace, stringToNamespace } from '../utils/filter';
+1 -1
packages/openapi-ts/src/openApi/shared/transforms/enums.ts
··· 1 + import type { Config } from '~/config/types'; 1 2 import { applyNaming } from '~/utils/naming'; 2 3 import { jsonPointerToPath } from '~/utils/ref'; 3 4 4 - import type { Config } from '../../../types/config'; 5 5 import { deepClone } from '../utils/schema'; 6 6 import { childSchemaRelationships } from '../utils/schemaChildRelationships'; 7 7 import { getSchemasObject } from '../utils/transforms';
+3 -2
packages/openapi-ts/src/openApi/shared/transforms/readWrite.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 3 + import type { Config } from '~/config/types'; 1 4 import type { Graph } from '~/graph'; 2 - import type { Logger } from '~/utils/logger'; 3 5 import { applyNaming } from '~/utils/naming'; 4 6 import { jsonPointerToPath } from '~/utils/ref'; 5 7 6 - import type { Config } from '../../../types/config'; 7 8 import deepEqual from '../utils/deepEqual'; 8 9 import { buildGraph, type Scope } from '../utils/graph'; 9 10 import { deepClone } from '../utils/schema';
+3 -2
packages/openapi-ts/src/openApi/shared/utils/filter.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 3 + import type { Config } from '~/config/types'; 1 4 import { createOperationKey } from '~/ir/operation'; 2 5 import type { PathItemObject, PathsObject } from '~/openApi/3.1.x/types/spec'; 3 6 import type { OpenApi } from '~/openApi/types'; 4 - import type { Logger } from '~/utils/logger'; 5 7 6 - import type { Config } from '../../../types/config'; 7 8 import type { ResourceMetadata } from '../graph/meta'; 8 9 import { httpMethods } from './operation'; 9 10
+2 -1
packages/openapi-ts/src/openApi/shared/utils/graph.ts
··· 1 + import type { Logger } from '@hey-api/codegen-core'; 2 + 1 3 import type { Graph, NodeInfo } from '~/graph'; 2 - import type { Logger } from '~/utils/logger'; 3 4 import { normalizeJsonPointer, pathToJsonPointer } from '~/utils/ref'; 4 5 5 6 import { childSchemaRelationships } from './schemaChildRelationships';
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-core/utils.ts
··· 1 + import type { Config } from '~/config/types'; 1 2 import type { PluginClientNames } from '~/plugins/types'; 2 - import type { Config } from '~/types/config'; 3 3 4 4 export const getClientBaseUrlKey = (config: Config) => { 5 5 const client = getClientPlugin(config);
+4 -4
packages/openapi-ts/src/types/config.d.ts packages/openapi-ts/src/config/types.d.ts
··· 1 1 import type { MaybeArray } from '@hey-api/types'; 2 2 3 - import type { Output, UserOutput } from '~/config/output'; 4 3 import type { Plugin } from '~/plugins'; 5 4 import type { PluginConfigMap } from '~/plugins/config'; 6 5 import type { PluginNames } from '~/plugins/types'; 6 + import type { Input, UserInput, Watch } from '~/types/input'; 7 + import type { Logs } from '~/types/logs'; 8 + import type { Parser, UserParser } from '~/types/parser'; 7 9 8 - import type { Input, UserInput, Watch } from './input'; 9 - import type { Logs } from './logs'; 10 - import type { Parser, UserParser } from './parser'; 10 + import type { Output, UserOutput } from './output'; 11 11 12 12 export interface UserConfig { 13 13 /**
packages/openapi-ts/src/utils/__tests__/logger.test.ts packages/codegen-core/src/__tests__/logger.test.ts
packages/openapi-ts/src/utils/logger.ts packages/codegen-core/src/logger.ts
+10 -7
pnpm-lock.yaml
··· 121 121 '@hey-api/codegen-core': 122 122 specifier: workspace:* 123 123 version: link:../packages/codegen-core 124 + '@hey-api/openapi-python': 125 + specifier: workspace:* 126 + version: link:../packages/openapi-python 124 127 '@hey-api/openapi-ts': 125 128 specifier: workspace:* 126 129 version: link:../packages/openapi-ts ··· 14690 14693 '@vitejs/plugin-basic-ssl': 1.2.0(vite@7.2.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.2)) 14691 14694 ansi-colors: 4.1.3 14692 14695 autoprefixer: 10.4.20(postcss@8.5.2) 14693 - babel-loader: 9.2.1(@babel/core@7.26.9)(webpack@5.98.0) 14696 + babel-loader: 9.2.1(@babel/core@7.26.9)(webpack@5.98.0(esbuild@0.25.0)) 14694 14697 browserslist: 4.25.4 14695 14698 copy-webpack-plugin: 12.0.2(webpack@5.98.0) 14696 14699 css-loader: 7.1.2(webpack@5.98.0) ··· 14710 14713 picomatch: 4.0.2 14711 14714 piscina: 4.8.0 14712 14715 postcss: 8.5.2 14713 - postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0) 14716 + postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0(esbuild@0.25.0)) 14714 14717 resolve-url-loader: 5.0.0 14715 14718 rxjs: 7.8.1 14716 14719 sass: 1.85.0 ··· 14778 14781 '@vitejs/plugin-basic-ssl': 1.2.0(vite@7.2.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.2)) 14779 14782 ansi-colors: 4.1.3 14780 14783 autoprefixer: 10.4.20(postcss@8.5.2) 14781 - babel-loader: 9.2.1(@babel/core@7.26.9)(webpack@5.98.0) 14784 + babel-loader: 9.2.1(@babel/core@7.26.9)(webpack@5.98.0(esbuild@0.25.0)) 14782 14785 browserslist: 4.25.4 14783 14786 copy-webpack-plugin: 12.0.2(webpack@5.98.0) 14784 14787 css-loader: 7.1.2(webpack@5.98.0) ··· 14798 14801 picomatch: 4.0.2 14799 14802 piscina: 4.8.0 14800 14803 postcss: 8.5.2 14801 - postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0) 14804 + postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0(esbuild@0.25.0)) 14802 14805 resolve-url-loader: 5.0.0 14803 14806 rxjs: 7.8.1 14804 14807 sass: 1.85.0 ··· 14886 14889 picomatch: 4.0.2 14887 14890 piscina: 4.8.0 14888 14891 postcss: 8.5.2 14889 - postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0) 14892 + postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0(esbuild@0.25.0)) 14890 14893 resolve-url-loader: 5.0.0 14891 14894 rxjs: 7.8.1 14892 14895 sass: 1.85.0 ··· 22376 22379 schema-utils: 4.3.2 22377 22380 webpack: 5.98.0(esbuild@0.25.0) 22378 22381 22379 - babel-loader@9.2.1(@babel/core@7.26.9)(webpack@5.98.0): 22382 + babel-loader@9.2.1(@babel/core@7.26.9)(webpack@5.98.0(esbuild@0.25.0)): 22380 22383 dependencies: 22381 22384 '@babel/core': 7.26.9 22382 22385 find-cache-dir: 4.0.0 ··· 27866 27869 ts-node: 10.9.2(@types/node@22.10.5)(typescript@5.9.3) 27867 27870 optional: true 27868 27871 27869 - postcss-loader@8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0): 27872 + postcss-loader@8.1.1(postcss@8.5.2)(typescript@5.8.3)(webpack@5.98.0(esbuild@0.25.0)): 27870 27873 dependencies: 27871 27874 cosmiconfig: 9.0.0(typescript@5.8.3) 27872 27875 jiti: 1.21.7