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 #2151 from hey-api/fix/crash-report

fix(typescript): handle nested inline objects with write/read only fields

authored by

Lubos and committed by
GitHub
bfa2c5ba f0294b4d

+445 -180
+5
.changeset/bright-rats-mix.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix: add crash report prompt
+3 -4
.changeset/twenty-numbers-talk.md
··· 1 1 --- 2 - '@hey-api/client-custom': minor 3 2 '@hey-api/client-axios': minor 4 - '@hey-api/client-fetch': minor 5 3 '@hey-api/client-core': minor 4 + '@hey-api/client-custom': minor 5 + '@hey-api/client-fetch': minor 6 6 '@hey-api/client-next': minor 7 - '@hey-api/client-nuxt': minor 8 7 --- 9 8 10 - feat: export buildClientParams function 9 + feat: export `buildClientParams` function
+5
.changeset/warm-lemons-count.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix(typescript): handle nested inline objects with write/read only fields
+11
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/read-write-only-custom-name/types.gen.ts
··· 29 29 baz?: Array<Baz>; 30 30 }; 31 31 32 + export type ReadableCorge = { 33 + foo?: string; 34 + bar?: { 35 + readonly baz?: boolean; 36 + }; 37 + }; 38 + 39 + export type WritableCorge = { 40 + foo?: string; 41 + }; 42 + 32 43 export type PostFooReadData = { 33 44 body: WritableFooRead; 34 45 path?: never;
+7
packages/openapi-ts-tests/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/read-write-only-ignore/types.gen.ts
··· 21 21 qux?: QuxAllRead; 22 22 }; 23 23 24 + export type Corge = { 25 + foo?: string; 26 + bar?: { 27 + readonly baz?: boolean; 28 + }; 29 + }; 30 + 24 31 export type PostFooReadData = { 25 32 body: FooRead; 26 33 path?: never;
+11
packages/openapi-ts-tests/test/__snapshots__/2.0.x/read-write-only/types.gen.ts
··· 29 29 baz?: Array<Baz>; 30 30 }; 31 31 32 + export type CorgeReadable = { 33 + foo?: string; 34 + bar?: { 35 + readonly baz?: boolean; 36 + }; 37 + }; 38 + 39 + export type CorgeWritable = { 40 + foo?: string; 41 + }; 42 + 32 43 export type PostFooReadData = { 33 44 body: FooReadWritable; 34 45 path?: never;
+12
packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/read-write-only-custom-name/types.gen.ts
··· 47 47 baz?: Array<Baz>; 48 48 }; 49 49 50 + export type ReadableCorge = { 51 + bar?: { 52 + readonly baz?: boolean; 53 + }; 54 + }; 55 + 56 + export type WritableCorge = { 57 + foo?: { 58 + baz?: boolean; 59 + }; 60 + }; 61 + 50 62 export type PostFooReadWriteData = { 51 63 body: WritableFooReadWrite; 52 64 path?: never;
+9
packages/openapi-ts-tests/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/read-write-only-ignore/types.gen.ts
··· 33 33 qux?: QuxAllRead; 34 34 }; 35 35 36 + export type Corge = { 37 + foo?: { 38 + baz?: boolean; 39 + }; 40 + bar?: { 41 + readonly baz?: boolean; 42 + }; 43 + }; 44 + 36 45 export type PostFooReadWriteData = { 37 46 body: FooReadWrite; 38 47 path?: never;
+12
packages/openapi-ts-tests/test/__snapshots__/3.0.x/read-write-only/types.gen.ts
··· 47 47 baz?: Array<Baz>; 48 48 }; 49 49 50 + export type CorgeReadable = { 51 + bar?: { 52 + readonly baz?: boolean; 53 + }; 54 + }; 55 + 56 + export type CorgeWritable = { 57 + foo?: { 58 + baz?: boolean; 59 + }; 60 + }; 61 + 50 62 export type PostFooReadWriteData = { 51 63 body: FooReadWriteWritable; 52 64 path?: never;
+12
packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/read-write-only-custom-name/types.gen.ts
··· 51 51 baz?: Array<Baz>; 52 52 }; 53 53 54 + export type ReadableCorge = { 55 + bar?: { 56 + readonly baz?: boolean; 57 + }; 58 + }; 59 + 60 + export type WritableCorge = { 61 + foo?: { 62 + baz?: boolean; 63 + }; 64 + }; 65 + 54 66 export type PostFooReadWriteData = { 55 67 body: WritableFooReadWrite; 56 68 path?: never;
+9
packages/openapi-ts-tests/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/read-write-only-ignore/types.gen.ts
··· 37 37 qux?: QuxAllRead; 38 38 }; 39 39 40 + export type Corge = { 41 + foo?: { 42 + baz?: boolean; 43 + }; 44 + bar?: { 45 + readonly baz?: boolean; 46 + }; 47 + }; 48 + 40 49 export type PostFooReadWriteData = { 41 50 body: FooReadWrite; 42 51 path?: never;
+12
packages/openapi-ts-tests/test/__snapshots__/3.1.x/read-write-only/types.gen.ts
··· 51 51 baz?: Array<Baz>; 52 52 }; 53 53 54 + export type CorgeReadable = { 55 + bar?: { 56 + readonly baz?: boolean; 57 + }; 58 + }; 59 + 60 + export type CorgeWritable = { 61 + foo?: { 62 + baz?: boolean; 63 + }; 64 + }; 65 + 54 66 export type PostFooReadWriteData = { 55 67 body: FooReadWriteWritable; 56 68 path?: never;
+3 -3
packages/openapi-ts-tests/test/bin.test.ts
··· 130 130 'true', 131 131 ]); 132 132 expect(result.stdout.toString()).toBe(''); 133 - expect(result.stderr.toString()).toContain('Unexpected error occurred'); 133 + expect(result.stderr.toString()).toContain('encountered an error'); 134 134 expect(result.stderr.toString()).toContain('missing input'); 135 135 }); 136 136 ··· 143 143 'true', 144 144 ]); 145 145 expect(result.stdout.toString()).toBe(''); 146 - expect(result.stderr.toString()).toContain('Unexpected error occurred'); 146 + expect(result.stderr.toString()).toContain('encountered an error'); 147 147 expect(result.stderr.toString()).toContain('missing output'); 148 148 }); 149 149 ··· 177 177 'true', 178 178 ]); 179 179 expect(result.stdout.toString()).toBe(''); 180 - expect(result.stderr.toString()).toContain('Unexpected error occurred'); 180 + expect(result.stderr.toString()).toContain('encountered an error'); 181 181 expect(result.stderr.toString()).toContain('client needs to be set'); 182 182 }); 183 183
+2 -1
packages/openapi-ts-tests/test/openapi-ts.config.ts
··· 51 51 // 'invalid', 52 52 // 'servers-entry.yaml', 53 53 // ), 54 - path: path.resolve(__dirname, 'spec', '3.1.x', 'sdk-instance.yaml'), 54 + // path: path.resolve(__dirname, 'spec', '3.1.x', 'read-write-only.yaml'), 55 + path: '', 55 56 // path: 'http://localhost:4000/', 56 57 // path: 'https://get.heyapi.dev/', 57 58 // path: 'https://get.heyapi.dev/hey-api/backend?branch=main&version=1.0.0',
+11
packages/openapi-ts-tests/test/spec/2.0.x/read-write-only.yaml
··· 57 57 $ref: '#/definitions/Baz' 58 58 qux: 59 59 $ref: '#/definitions/QuxAllRead' 60 + Corge: 61 + type: object 62 + properties: 63 + foo: 64 + type: string 65 + bar: 66 + type: object 67 + properties: 68 + baz: 69 + type: boolean 70 + readOnly: true
+15
packages/openapi-ts-tests/test/spec/3.0.x/read-write-only.yaml
··· 110 110 $ref: '#/components/schemas/Baz' 111 111 qux: 112 112 $ref: '#/components/schemas/QuxAllRead' 113 + Corge: 114 + type: object 115 + properties: 116 + foo: 117 + type: object 118 + properties: 119 + baz: 120 + type: boolean 121 + writeOnly: true 122 + bar: 123 + type: object 124 + properties: 125 + baz: 126 + type: boolean 127 + readOnly: true
+15
packages/openapi-ts-tests/test/spec/3.1.x/read-write-only.yaml
··· 120 120 $ref: '#/components/schemas/Baz' 121 121 qux: 122 122 $ref: '#/components/schemas/QuxAllRead' 123 + Corge: 124 + type: object 125 + properties: 126 + foo: 127 + type: object 128 + properties: 129 + baz: 130 + type: boolean 131 + writeOnly: true 132 + bar: 133 + type: object 134 + properties: 135 + baz: 136 + type: boolean 137 + readOnly: true
+2 -1
packages/openapi-ts/package.json
··· 93 93 "c12": "2.0.1", 94 94 "color-support": "1.1.3", 95 95 "commander": "13.0.0", 96 - "handlebars": "4.7.8" 96 + "handlebars": "4.7.8", 97 + "open": "10.1.2" 97 98 }, 98 99 "peerDependencies": { 99 100 "typescript": "^5.5.3"
+2 -2
packages/openapi-ts/src/createClient.ts
··· 101 101 102 102 if (!result.organization) { 103 103 throw new Error( 104 - '🚫 missing organization - from which Hey API platform organization do you want to generate your output?', 104 + 'missing organization - from which Hey API platform organization do you want to generate your output?', 105 105 ); 106 106 } 107 107 108 108 if (!result.project) { 109 109 throw new Error( 110 - '🚫 missing project - from which Hey API platform project do you want to generate your output?', 110 + 'missing project - from which Hey API platform project do you want to generate your output?', 111 111 ); 112 112 } 113 113
+159
packages/openapi-ts/src/error.ts
··· 1 + import fs from 'node:fs'; 2 + import path from 'node:path'; 3 + 4 + import colors from 'ansi-colors'; 5 + 6 + import { findPackageJson } from './generate/tsConfig'; 7 + import { ensureDirSync } from './generate/utils'; 8 + 9 + export const isInteractive = process.stdin.isTTY && process.stdout.isTTY; 10 + 11 + export class HeyApiError extends Error { 12 + args: ReadonlyArray<unknown>; 13 + event: string; 14 + pluginName: string; 15 + 16 + constructor({ 17 + args, 18 + error, 19 + event, 20 + name, 21 + pluginName, 22 + }: { 23 + args: unknown[]; 24 + error: Error; 25 + event: string; 26 + name: string; 27 + pluginName: string; 28 + }) { 29 + const message = error instanceof Error ? error.message : 'Unknown error'; 30 + super(message); 31 + 32 + this.args = args; 33 + this.cause = error.cause; 34 + this.event = event; 35 + this.name = name || error.name; 36 + this.pluginName = pluginName; 37 + this.stack = error.stack; 38 + } 39 + } 40 + 41 + export const logCrashReport = (error: unknown, logsDir: string): string => { 42 + const logName = `openapi-ts-error-${Date.now()}.log`; 43 + const fullDir = path.resolve(process.cwd(), logsDir); 44 + ensureDirSync(fullDir); 45 + const logPath = path.resolve(fullDir, logName); 46 + 47 + let logContent = `[${new Date().toISOString()}] `; 48 + 49 + if (error instanceof HeyApiError) { 50 + logContent += `${error.name} during event "${error.event}"\n`; 51 + if (error.pluginName) { 52 + logContent += `Plugin: ${error.pluginName}\n`; 53 + } 54 + logContent += `Arguments: ${JSON.stringify(error.args, null, 2)}\n\n`; 55 + } 56 + 57 + const message = error instanceof Error ? error.message : String(error); 58 + const stack = error instanceof Error ? error.stack : undefined; 59 + 60 + logContent += `Error: ${message}\n`; 61 + if (stack) { 62 + logContent += `Stack:\n${stack}\n`; 63 + } 64 + 65 + fs.writeFileSync(logPath, logContent); 66 + 67 + return logPath; 68 + }; 69 + 70 + export const openGitHubIssueWithCrashReport = async (error: unknown) => { 71 + let body = ''; 72 + 73 + if (error instanceof HeyApiError) { 74 + if (error.pluginName) { 75 + body += `**Plugin**: \`${error.pluginName}\`\n`; 76 + } 77 + body += `**Event**: \`${error.event}\`\n`; 78 + body += `**Arguments**:\n\`\`\`ts\n${JSON.stringify(error.args, null, 2)}\n\`\`\`\n\n`; 79 + } 80 + 81 + const message = error instanceof Error ? error.message : String(error); 82 + const stack = error instanceof Error ? error.stack : undefined; 83 + 84 + body += `**Error**: \`${message}\`\n`; 85 + if (stack) { 86 + body += `\n**Stack Trace**:\n\`\`\`\n${stack}\n\`\`\``; 87 + } 88 + 89 + const search = new URLSearchParams({ 90 + body, 91 + labels: 'bug 🔥', 92 + title: 'Crash Report', 93 + }); 94 + 95 + const packageJson = findPackageJson(); 96 + let bugsUrl: string | undefined; 97 + if ( 98 + packageJson && 99 + typeof packageJson === 'object' && 100 + 'bugs' in packageJson && 101 + packageJson.bugs && 102 + typeof packageJson.bugs === 'object' && 103 + 'url' in packageJson.bugs && 104 + typeof packageJson.bugs.url === 'string' 105 + ) { 106 + bugsUrl = packageJson.bugs.url; 107 + if (bugsUrl && !bugsUrl.endsWith('/')) { 108 + bugsUrl += '/'; 109 + } 110 + } 111 + 112 + if (bugsUrl) { 113 + const url = `${bugsUrl}new?${search.toString()}`; 114 + const open = (await import('open')).default; 115 + await open(url); 116 + } 117 + }; 118 + 119 + export const printCrashReport = ({ 120 + error, 121 + logPath, 122 + }: { 123 + error: unknown; 124 + logPath: string | undefined; 125 + }) => { 126 + const packageJson = findPackageJson(); 127 + let name: string | undefined; 128 + if ( 129 + packageJson && 130 + typeof packageJson === 'object' && 131 + 'name' in packageJson && 132 + typeof packageJson.name === 'string' 133 + ) { 134 + name = packageJson.name; 135 + } 136 + process.stderr.write( 137 + `\n🛑 ${colors.cyan(name || '')} ${colors.red('encountered an error.')}` + 138 + `\n\n${colors.red('❗️ Error:')} ${colors.white(typeof error === 'string' ? error : error instanceof Error ? error.message : 'Unknown error')}` + 139 + (logPath 140 + ? `\n\n${colors.cyan('📄 Crash log saved to:')} ${colors.gray(logPath)}` 141 + : ''), 142 + ); 143 + }; 144 + 145 + export const shouldReportCrash = async (): Promise<boolean> => { 146 + if (!isInteractive) { 147 + return false; 148 + } 149 + 150 + return new Promise((resolve) => { 151 + process.stdout.write( 152 + `${colors.yellow('\n\n📢 Open a GitHub issue with crash details?')} ${colors.yellow('(y/N):')}`, 153 + ); 154 + process.stdin.setEncoding('utf8'); 155 + process.stdin.once('data', (data: string) => { 156 + resolve(data.trim().toLowerCase() === 'y'); 157 + }); 158 + }); 159 + };
+8
packages/openapi-ts/src/generate/output.ts
··· 3 3 import ts from 'typescript'; 4 4 5 5 import { compiler } from '../compiler'; 6 + import type { Events } from '../ir/context'; 6 7 import { parseIR } from '../ir/parser'; 7 8 import type { IR } from '../ir/types'; 8 9 import { getClientPlugin } from '../plugins/@hey-api/client-core/utils'; ··· 27 28 28 29 for (const name of context.config.pluginOrder) { 29 30 const plugin = context.config.plugins[name]!; 31 + const _subscribe = context.subscribe.bind(context); 32 + context.subscribe = <T extends keyof Events>( 33 + event: T, 34 + callbackFn: Events[T], 35 + ): void => { 36 + _subscribe(event, callbackFn, name); 37 + }; 30 38 plugin._handler({ 31 39 context, 32 40 plugin: plugin as never,
+19
packages/openapi-ts/src/generate/tsConfig.ts
··· 7 7 const __filename = fileURLToPath(import.meta.url); 8 8 const __dirname = path.dirname(__filename); 9 9 10 + export const findPackageJson = (): unknown | undefined => { 11 + let dir = __dirname; 12 + while (dir !== path.dirname(dir)) { 13 + const files = fs.readdirSync(dir); 14 + const candidates = files.filter((file) => file === 'package.json'); 15 + 16 + if (candidates[0]) { 17 + const packageJsonPath = path.join(dir, candidates[0]); 18 + return JSON.parse( 19 + fs.readFileSync(packageJsonPath, { 20 + encoding: 'utf8', 21 + }), 22 + ); 23 + } 24 + 25 + dir = path.dirname(dir); 26 + } 27 + }; 28 + 10 29 export const findTsConfigPath = ( 11 30 tsConfigPath?: 'off' | (string & {}), 12 31 ): string | null => {
+18 -15
packages/openapi-ts/src/index.ts
··· 1 - import fs from 'node:fs'; 2 - import path from 'node:path'; 3 - 4 1 import colors from 'ansi-colors'; 5 2 // @ts-expect-error 6 3 import colorSupport from 'color-support'; 7 4 8 5 import { createClient as pCreateClient } from './createClient'; 9 - import { ensureDirSync } from './generate/utils'; 6 + import { 7 + logCrashReport, 8 + openGitHubIssueWithCrashReport, 9 + printCrashReport, 10 + shouldReportCrash, 11 + } from './error'; 10 12 import { getLogs } from './getLogs'; 11 13 import { initConfigs } from './initConfigs'; 12 14 import type { IR } from './ir/types'; ··· 73 75 } catch (error) { 74 76 const config = configs[0] as Config | undefined; 75 77 const dryRun = config ? config.dryRun : resolvedConfig?.dryRun; 78 + const logs = config?.logs ?? getLogs(resolvedConfig); 76 79 77 - // TODO: add setting for log output 78 - if (!dryRun) { 79 - const logs = config?.logs ?? getLogs(resolvedConfig); 80 - if (logs.level !== 'silent' && logs.file) { 81 - const logName = `openapi-ts-error-${Date.now()}.log`; 82 - const logsDir = path.resolve(process.cwd(), logs.path ?? ''); 83 - ensureDirSync(logsDir); 84 - const logPath = path.resolve(logsDir, logName); 85 - fs.writeFileSync(logPath, `${error.message}\n${error.stack}`); 86 - console.error(`🔥 Unexpected error occurred. Log saved to ${logPath}`); 80 + let logPath: string | undefined; 81 + 82 + if (logs.level !== 'silent' && logs.file && !dryRun) { 83 + logPath = logCrashReport(error, logs.path ?? ''); 84 + } 85 + 86 + if (logs.level !== 'silent') { 87 + printCrashReport({ error, logPath }); 88 + if (await shouldReportCrash()) { 89 + await openGitHubIssueWithCrashReport(error); 87 90 } 88 91 } 89 - console.error(`🔥 Unexpected error occurred. ${error.message}`); 92 + 90 93 throw error; 91 94 } 92 95 };
+7 -8
packages/openapi-ts/src/initConfigs.ts
··· 38 38 input.path = userConfig.input; 39 39 } else if ( 40 40 userConfig.input && 41 - (userConfig.input.path || userConfig.input.organization) 41 + (userConfig.input.path !== undefined || 42 + userConfig.input.organization !== undefined) 42 43 ) { 43 44 // @ts-expect-error 44 45 input = { ··· 102 103 const pluginConfig = pluginConfigs[name as PluginNames]; 103 104 if (!pluginConfig) { 104 105 throw new Error( 105 - `🚫 unknown plugin dependency "${name}" - do you need to register a custom plugin with this name?`, 106 + `unknown plugin dependency "${name}" - do you need to register a custom plugin with this name?`, 106 107 ); 107 108 } 108 109 ··· 114 115 ); 115 116 if (nativePluginOption) { 116 117 throw new Error( 117 - `🚫 cannot register plugin "${name}" - attempting to override a native plugin option "${nativePluginOption}"`, 118 + `cannot register plugin "${name}" - attempting to override a native plugin option "${nativePluginOption}"`, 118 119 ); 119 120 } 120 121 } ··· 151 152 152 153 throw new Error( 153 154 errorMessage || 154 - `🚫 missing plugin - no plugin with tag "${tag}" found`, 155 + `missing plugin - no plugin with tag "${tag}" found`, 155 156 ); 156 157 }, 157 158 }; ··· 359 360 360 361 if (!input.path) { 361 362 throw new Error( 362 - '🚫 missing input - which OpenAPI specification should we use to generate your output?', 363 + 'missing input - which OpenAPI specification should we use to generate your output?', 363 364 ); 364 365 } 365 366 366 367 if (!output.path) { 367 - throw new Error( 368 - '🚫 missing output - where should we generate your output?', 369 - ); 368 + throw new Error('missing output - where should we generate your output?'); 370 369 } 371 370 372 371 if (!useOptions) {
+31 -17
packages/openapi-ts/src/ir/context.ts
··· 1 1 import path from 'node:path'; 2 2 3 + import { HeyApiError } from '../error'; 3 4 import { TypeScriptFile } from '../generate/files'; 4 5 import type { Config, StringCase } from '../types/config'; 5 6 import type { Files } from '../types/utils'; ··· 27 28 path: string; 28 29 } 29 30 30 - interface Events { 31 + export interface Events { 31 32 /** 32 33 * Called after parsing. 33 34 */ ··· 59 60 server: (args: { server: IR.ServerObject }) => void; 60 61 } 61 62 63 + type ListenerWithMeta<T extends keyof Events> = { 64 + callbackFn: Events[T]; 65 + pluginName: string; 66 + }; 67 + 62 68 type Listeners = { 63 - [T in keyof Events]?: Array<Events[T]>; 69 + [T in keyof Events]?: Array<ListenerWithMeta<T>>; 64 70 }; 65 71 66 72 export class IRContext<Spec extends Record<string, any> = any> { ··· 102 108 event: T, 103 109 ...args: Parameters<Events[T]> 104 110 ): Promise<void> { 105 - if (!this.listeners[event]) { 106 - return; 107 - } 111 + const eventListeners = this.listeners[event]; 108 112 109 - await Promise.all( 110 - this.listeners[event].map((callbackFn, index) => { 113 + if (eventListeners) { 114 + for (const listener of eventListeners) { 111 115 try { 112 - // @ts-expect-error 113 - const response = callbackFn(...args); 114 - return Promise.resolve(response); 115 - } catch (error) { 116 - console.error( 117 - `🔥 Event broadcast: "${event}"\nindex: ${index}\narguments: ${JSON.stringify(args, null, 2)}`, 116 + await listener.callbackFn( 117 + // @ts-expect-error 118 + ...args, 118 119 ); 119 - throw error; 120 + } catch (error) { 121 + const originalError = 122 + error instanceof Error ? error : new Error(String(error)); 123 + throw new HeyApiError({ 124 + args, 125 + error: originalError, 126 + event, 127 + name: 'BroadcastError', 128 + pluginName: listener.pluginName, 129 + }); 120 130 } 121 - }), 122 - ); 131 + } 132 + } 123 133 } 124 134 125 135 /** ··· 192 202 public subscribe<T extends keyof Events>( 193 203 event: T, 194 204 callbackFn: Events[T], 205 + pluginName?: string, 195 206 ): void { 196 207 if (!this.listeners[event]) { 197 208 this.listeners[event] = []; 198 209 } 199 - this.listeners[event].push(callbackFn); 210 + this.listeners[event].push({ 211 + callbackFn, 212 + pluginName: pluginName ?? '', 213 + }); 200 214 } 201 215 }
+14 -8
packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts
··· 582 582 continue; 583 583 } 584 584 585 + const propertyType = schemaToType({ 586 + $ref: state ? [...state.path, name].join('/') : `${irRef}${name}`, 587 + context, 588 + namespace, 589 + plugin, 590 + schema: property, 591 + state, 592 + }); 593 + 594 + if (!propertyType) { 595 + continue; 596 + } 597 + 585 598 const isRequired = required.includes(name); 586 599 schemaProperties.push({ 587 600 comment: createSchemaComment({ schema: property }), 588 601 isReadOnly: property.accessScope === 'read', 589 602 isRequired, 590 603 name: fieldName({ context, name }), 591 - type: schemaToType({ 592 - $ref: state ? [...state.path, name].join('/') : `${irRef}${name}`, 593 - context, 594 - namespace, 595 - plugin, 596 - schema: property, 597 - state, 598 - }), 604 + type: propertyType, 599 605 }); 600 606 indexPropertyItems.push(property); 601 607
+1 -1
packages/openapi-ts/src/plugins/@tanstack/query-core/plugin-legacy.ts
··· 678 678 const config = getConfig(); 679 679 680 680 if (isLegacyClient(config)) { 681 - throw new Error('🚫 TanStack Query plugin does not support legacy clients'); 681 + throw new Error('TanStack Query plugin does not support legacy clients'); 682 682 } 683 683 684 684 const file = files[plugin.name]!;
+30 -120
pnpm-lock.yaml
··· 913 913 handlebars: 914 914 specifier: 4.7.8 915 915 version: 4.7.8 916 + open: 917 + specifier: 10.1.2 918 + version: 10.1.2 916 919 devDependencies: 917 920 '@config/vite-base': 918 921 specifier: workspace:* ··· 1051 1054 version: 9.17.0(jiti@2.4.2) 1052 1055 express: 1053 1056 specifier: 4.21.0 1054 - version: 4.21.0(supports-color@10.0.0) 1057 + version: 4.21.0 1055 1058 fastify: 1056 1059 specifier: 5.2.0 1057 1060 version: 5.2.0 ··· 9285 9288 resolution: {integrity: sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==} 9286 9289 engines: {node: '>=18'} 9287 9290 9291 + open@10.1.2: 9292 + resolution: {integrity: sha512-cxN6aIDPz6rm8hbebcP7vrQNhvRcveZoJU72Y7vskh4oIm+BZwBECnx5nTmrlres1Qapvx27Qo1Auukpf8PKXw==} 9293 + engines: {node: '>=18'} 9294 + 9288 9295 open@8.4.2: 9289 9296 resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==} 9290 9297 engines: {node: '>=12'} ··· 14089 14096 '@eslint/config-array@0.19.2': 14090 14097 dependencies: 14091 14098 '@eslint/object-schema': 2.1.6 14092 - debug: 4.4.0 14099 + debug: 4.4.0(supports-color@9.4.0) 14093 14100 minimatch: 3.1.2 14094 14101 transitivePeerDependencies: 14095 14102 - supports-color ··· 14105 14112 '@eslint/eslintrc@3.3.0': 14106 14113 dependencies: 14107 14114 ajv: 6.12.6 14108 - debug: 4.4.0 14115 + debug: 4.4.0(supports-color@9.4.0) 14109 14116 espree: 10.3.0 14110 14117 globals: 14.0.0 14111 14118 ignore: 5.3.2 ··· 17667 17674 17668 17675 axios@1.8.2: 17669 17676 dependencies: 17670 - follow-redirects: 1.15.9 17677 + follow-redirects: 1.15.9(debug@4.4.0) 17671 17678 form-data: 4.0.2 17672 17679 proxy-from-env: 1.1.0 17673 17680 transitivePeerDependencies: ··· 17801 17808 transitivePeerDependencies: 17802 17809 - supports-color 17803 17810 17804 - body-parser@1.20.3(supports-color@10.0.0): 17805 - dependencies: 17806 - bytes: 3.1.2 17807 - content-type: 1.0.5 17808 - debug: 2.6.9(supports-color@10.0.0) 17809 - depd: 2.0.0 17810 - destroy: 1.2.0 17811 - http-errors: 2.0.0 17812 - iconv-lite: 0.4.24 17813 - on-finished: 2.4.1 17814 - qs: 6.13.0 17815 - raw-body: 2.5.2 17816 - type-is: 1.6.18 17817 - unpipe: 1.0.0 17818 - transitivePeerDependencies: 17819 - - supports-color 17820 - 17821 17811 bonjour-service@1.3.0: 17822 17812 dependencies: 17823 17813 fast-deep-equal: 3.1.3 ··· 18159 18149 dependencies: 18160 18150 bytes: 3.1.2 18161 18151 compressible: 2.0.18 18162 - debug: 2.6.9(supports-color@10.0.0) 18152 + debug: 2.6.9 18163 18153 negotiator: 0.6.4 18164 18154 on-headers: 1.0.2 18165 18155 safe-buffer: 5.2.1 ··· 18182 18172 18183 18173 connect@3.7.0: 18184 18174 dependencies: 18185 - debug: 2.6.9(supports-color@10.0.0) 18175 + debug: 2.6.9 18186 18176 finalhandler: 1.1.2 18187 18177 parseurl: 1.3.3 18188 18178 utils-merge: 1.0.1 ··· 18426 18416 dependencies: 18427 18417 ms: 2.0.0 18428 18418 18429 - debug@2.6.9(supports-color@10.0.0): 18430 - dependencies: 18431 - ms: 2.0.0 18432 - optionalDependencies: 18433 - supports-color: 10.0.0 18434 - 18435 18419 debug@3.2.7: 18436 18420 dependencies: 18437 18421 ms: 2.1.3 ··· 18441 18425 ms: 2.1.2 18442 18426 18443 18427 debug@4.3.7: 18444 - dependencies: 18445 - ms: 2.1.3 18446 - 18447 - debug@4.4.0: 18448 18428 dependencies: 18449 18429 ms: 2.1.3 18450 18430 ··· 19221 19201 ajv: 6.12.6 19222 19202 chalk: 4.1.2 19223 19203 cross-spawn: 7.0.6 19224 - debug: 4.4.0 19204 + debug: 4.4.0(supports-color@9.4.0) 19225 19205 escape-string-regexp: 4.0.0 19226 19206 eslint-scope: 8.3.0 19227 19207 eslint-visitor-keys: 4.2.0 ··· 19380 19360 transitivePeerDependencies: 19381 19361 - supports-color 19382 19362 19383 - express@4.21.0(supports-color@10.0.0): 19384 - dependencies: 19385 - accepts: 1.3.8 19386 - array-flatten: 1.1.1 19387 - body-parser: 1.20.3(supports-color@10.0.0) 19388 - content-disposition: 0.5.4 19389 - content-type: 1.0.5 19390 - cookie: 0.6.0 19391 - cookie-signature: 1.0.6 19392 - debug: 2.6.9(supports-color@10.0.0) 19393 - depd: 2.0.0 19394 - encodeurl: 2.0.0 19395 - escape-html: 1.0.3 19396 - etag: 1.8.1 19397 - finalhandler: 1.3.1(supports-color@10.0.0) 19398 - fresh: 0.5.2 19399 - http-errors: 2.0.0 19400 - merge-descriptors: 1.0.3 19401 - methods: 1.1.2 19402 - on-finished: 2.4.1 19403 - parseurl: 1.3.3 19404 - path-to-regexp: 0.1.10 19405 - proxy-addr: 2.0.7 19406 - qs: 6.13.0 19407 - range-parser: 1.2.1 19408 - safe-buffer: 5.2.1 19409 - send: 0.19.0(supports-color@10.0.0) 19410 - serve-static: 1.16.2(supports-color@10.0.0) 19411 - setprototypeof: 1.2.0 19412 - statuses: 2.0.1 19413 - type-is: 1.6.18 19414 - utils-merge: 1.0.1 19415 - vary: 1.1.2 19416 - transitivePeerDependencies: 19417 - - supports-color 19418 - 19419 19363 express@4.21.2: 19420 19364 dependencies: 19421 19365 accepts: 1.3.8 19422 19366 array-flatten: 1.1.1 19423 - body-parser: 1.20.3(supports-color@10.0.0) 19367 + body-parser: 1.20.3 19424 19368 content-disposition: 0.5.4 19425 19369 content-type: 1.0.5 19426 19370 cookie: 0.7.1 19427 19371 cookie-signature: 1.0.6 19428 - debug: 2.6.9(supports-color@10.0.0) 19372 + debug: 2.6.9 19429 19373 depd: 2.0.0 19430 19374 encodeurl: 2.0.0 19431 19375 escape-html: 1.0.3 19432 19376 etag: 1.8.1 19433 - finalhandler: 1.3.1(supports-color@10.0.0) 19377 + finalhandler: 1.3.1 19434 19378 fresh: 0.5.2 19435 19379 http-errors: 2.0.0 19436 19380 merge-descriptors: 1.0.3 ··· 19442 19386 qs: 6.13.0 19443 19387 range-parser: 1.2.1 19444 19388 safe-buffer: 5.2.1 19445 - send: 0.19.0(supports-color@10.0.0) 19446 - serve-static: 1.16.2(supports-color@10.0.0) 19389 + send: 0.19.0 19390 + serve-static: 1.16.2 19447 19391 setprototypeof: 1.2.0 19448 19392 statuses: 2.0.1 19449 19393 type-is: 1.6.18 ··· 19596 19540 19597 19541 finalhandler@1.1.2: 19598 19542 dependencies: 19599 - debug: 2.6.9(supports-color@10.0.0) 19543 + debug: 2.6.9 19600 19544 encodeurl: 1.0.2 19601 19545 escape-html: 1.0.3 19602 19546 on-finished: 2.3.0 ··· 19609 19553 finalhandler@1.3.1: 19610 19554 dependencies: 19611 19555 debug: 2.6.9 19612 - encodeurl: 2.0.0 19613 - escape-html: 1.0.3 19614 - on-finished: 2.4.1 19615 - parseurl: 1.3.3 19616 - statuses: 2.0.1 19617 - unpipe: 1.0.0 19618 - transitivePeerDependencies: 19619 - - supports-color 19620 - 19621 - finalhandler@1.3.1(supports-color@10.0.0): 19622 - dependencies: 19623 - debug: 2.6.9(supports-color@10.0.0) 19624 19556 encodeurl: 2.0.0 19625 19557 escape-html: 1.0.3 19626 19558 on-finished: 2.4.1 ··· 19668 19600 focus-trap@7.6.4: 19669 19601 dependencies: 19670 19602 tabbable: 6.2.0 19671 - 19672 - follow-redirects@1.15.9: {} 19673 19603 19674 19604 follow-redirects@1.15.9(debug@4.4.0): 19675 19605 optionalDependencies: ··· 20654 20584 karma@6.4.4: 20655 20585 dependencies: 20656 20586 '@colors/colors': 1.5.0 20657 - body-parser: 1.20.3(supports-color@10.0.0) 20587 + body-parser: 1.20.3 20658 20588 braces: 3.0.3 20659 20589 chokidar: 3.6.0 20660 20590 connect: 3.7.0 ··· 21338 21268 scule: 1.3.0 21339 21269 semver: 7.7.1 21340 21270 serve-placeholder: 2.0.2 21341 - serve-static: 1.16.2(supports-color@10.0.0) 21271 + serve-static: 1.16.2 21342 21272 source-map: 0.7.4 21343 21273 std-env: 3.8.1 21344 21274 ufo: 1.5.4 ··· 21888 21818 regex-recursion: 5.1.1 21889 21819 21890 21820 open@10.1.0: 21821 + dependencies: 21822 + default-browser: 5.2.1 21823 + define-lazy-prop: 3.0.0 21824 + is-inside-container: 1.0.0 21825 + is-wsl: 3.1.0 21826 + 21827 + open@10.1.2: 21891 21828 dependencies: 21892 21829 default-browser: 5.2.1 21893 21830 define-lazy-prop: 3.0.0 ··· 23112 23049 transitivePeerDependencies: 23113 23050 - supports-color 23114 23051 23115 - send@0.19.0(supports-color@10.0.0): 23116 - dependencies: 23117 - debug: 2.6.9(supports-color@10.0.0) 23118 - depd: 2.0.0 23119 - destroy: 1.2.0 23120 - encodeurl: 1.0.2 23121 - escape-html: 1.0.3 23122 - etag: 1.8.1 23123 - fresh: 0.5.2 23124 - http-errors: 2.0.0 23125 - mime: 1.6.0 23126 - ms: 2.1.3 23127 - on-finished: 2.4.1 23128 - range-parser: 1.2.1 23129 - statuses: 2.0.1 23130 - transitivePeerDependencies: 23131 - - supports-color 23132 - 23133 23052 serialize-javascript@6.0.2: 23134 23053 dependencies: 23135 23054 randombytes: 2.1.0 ··· 23144 23063 dependencies: 23145 23064 accepts: 1.3.8 23146 23065 batch: 0.6.1 23147 - debug: 2.6.9(supports-color@10.0.0) 23066 + debug: 2.6.9 23148 23067 escape-html: 1.0.3 23149 23068 http-errors: 1.6.3 23150 23069 mime-types: 2.1.35 ··· 23162 23081 escape-html: 1.0.3 23163 23082 parseurl: 1.3.3 23164 23083 send: 0.19.0 23165 - transitivePeerDependencies: 23166 - - supports-color 23167 - 23168 - serve-static@1.16.2(supports-color@10.0.0): 23169 - dependencies: 23170 - encodeurl: 2.0.0 23171 - escape-html: 1.0.3 23172 - parseurl: 1.3.3 23173 - send: 0.19.0(supports-color@10.0.0) 23174 23084 transitivePeerDependencies: 23175 23085 - supports-color 23176 23086