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

chore: generate typed baseUrl option

Lubos 766ad64f ccc7ae40

+3062 -424
+1
packages/openapi-ts/src/compiler/index.ts
··· 58 58 safeAccessExpression: transform.createSafeAccessExpression, 59 59 stringLiteral: types.createStringLiteral, 60 60 stringToTsNodes: utils.stringToTsNodes, 61 + templateLiteralType: types.createTemplateLiteralType, 61 62 transformArrayMap: transform.createArrayMapTransform, 62 63 transformArrayMutation: transform.createArrayTransformMutation, 63 64 transformDateMutation: transform.createDateTransformMutation,
+28
packages/openapi-ts/src/compiler/types.ts
··· 1012 1012 expression: ts.Expression; 1013 1013 type: ts.TypeNode; 1014 1014 }) => ts.factory.createAsExpression(expression, type); 1015 + 1016 + export const createTemplateLiteralType = ({ 1017 + value, 1018 + }: { 1019 + value: ReadonlyArray<string | ts.TypeNode>; 1020 + }) => { 1021 + const spans: Array<ts.TemplateLiteralTypeSpan> = []; 1022 + let spanText = ''; 1023 + 1024 + for (const item of value.slice(0).reverse()) { 1025 + if (typeof item === 'string') { 1026 + spanText = `${item}${spanText}`; 1027 + } else { 1028 + const literal = spans.length 1029 + ? ts.factory.createTemplateMiddle(spanText) 1030 + : ts.factory.createTemplateTail(spanText); 1031 + const span = ts.factory.createTemplateLiteralTypeSpan(item, literal); 1032 + spans.push(span); 1033 + spanText = ''; 1034 + } 1035 + } 1036 + 1037 + const templateLiteralType = ts.factory.createTemplateLiteralType( 1038 + ts.factory.createTemplateHead(spanText), 1039 + spans.reverse(), 1040 + ); 1041 + return templateLiteralType; 1042 + };
+1
packages/openapi-ts/src/ir/context.ts
··· 56 56 name: string; 57 57 schema: IR.SchemaObject; 58 58 }) => void; 59 + server: (args: { server: IR.ServerObject }) => void; 59 60 } 60 61 61 62 type Listeners = {
+4
packages/openapi-ts/src/ir/parser.ts
··· 7 7 export const parseIR = async ({ context }: { context: IR.Context }) => { 8 8 await context.broadcast('before'); 9 9 10 + for (const server of context.ir.servers ?? []) { 11 + await context.broadcast('server', { server }); 12 + } 13 + 10 14 if (context.ir.components) { 11 15 for (const name in context.ir.components.schemas) { 12 16 const schema = context.ir.components.schemas[name]!;
+119
packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/server.test.ts
··· 1 + import { describe, expect, it } from 'vitest'; 2 + 3 + import type { IR } from '../../../../ir/types'; 4 + import type { OpenApi } from '../../../types'; 5 + import { parseServers } from '../server'; 6 + 7 + describe('parseServers', () => { 8 + it('host + basePath + schemes', () => { 9 + const context: Partial<IR.Context<Partial<OpenApi.V2_0_X>>> = { 10 + // @ts-expect-error 11 + config: { 12 + input: { 13 + path: '', 14 + }, 15 + }, 16 + ir: {}, 17 + spec: { 18 + basePath: '/v1', 19 + host: 'foo.com', 20 + schemes: ['http', 'https'], 21 + }, 22 + }; 23 + parseServers({ context: context as IR.Context }); 24 + expect(context.ir!.servers).toEqual([ 25 + { 26 + url: 'http://foo.com/v1', 27 + }, 28 + { 29 + url: 'https://foo.com/v1', 30 + }, 31 + ]); 32 + }); 33 + 34 + it('schemes + host', () => { 35 + const context: Partial<IR.Context<Partial<OpenApi.V2_0_X>>> = { 36 + // @ts-expect-error 37 + config: { 38 + input: { 39 + path: '', 40 + }, 41 + }, 42 + ir: {}, 43 + spec: { 44 + host: 'foo.com', 45 + schemes: ['ws'], 46 + }, 47 + }; 48 + parseServers({ context: context as IR.Context }); 49 + expect(context.ir!.servers).toEqual([ 50 + { 51 + url: 'ws://foo.com', 52 + }, 53 + ]); 54 + }); 55 + 56 + it('host + basePath', () => { 57 + const context: Partial<IR.Context<Partial<OpenApi.V2_0_X>>> = { 58 + // @ts-expect-error 59 + config: { 60 + input: { 61 + path: '', 62 + }, 63 + }, 64 + ir: {}, 65 + spec: { 66 + basePath: '/v1', 67 + host: 'foo.com', 68 + }, 69 + }; 70 + parseServers({ context: context as IR.Context }); 71 + expect(context.ir!.servers).toEqual([ 72 + { 73 + url: 'foo.com/v1', 74 + }, 75 + ]); 76 + }); 77 + 78 + it('host', () => { 79 + const context: Partial<IR.Context<Partial<OpenApi.V2_0_X>>> = { 80 + // @ts-expect-error 81 + config: { 82 + input: { 83 + path: '', 84 + }, 85 + }, 86 + ir: {}, 87 + spec: { 88 + host: 'foo.com', 89 + }, 90 + }; 91 + parseServers({ context: context as IR.Context }); 92 + expect(context.ir!.servers).toEqual([ 93 + { 94 + url: 'foo.com', 95 + }, 96 + ]); 97 + }); 98 + 99 + it('basePath', () => { 100 + const context: Partial<IR.Context<Partial<OpenApi.V2_0_X>>> = { 101 + // @ts-expect-error 102 + config: { 103 + input: { 104 + path: '', 105 + }, 106 + }, 107 + ir: {}, 108 + spec: { 109 + basePath: '/v1', 110 + }, 111 + }; 112 + parseServers({ context: context as IR.Context }); 113 + expect(context.ir!.servers).toEqual([ 114 + { 115 + url: '/v1', 116 + }, 117 + ]); 118 + }); 119 + });
+3
packages/openapi-ts/src/openApi/2.0.x/parser/index.ts
··· 11 11 import { parseOperation } from './operation'; 12 12 import { parametersArrayToObject } from './parameter'; 13 13 import { parseSchema } from './schema'; 14 + import { parseServers } from './server'; 14 15 15 16 type PathKeys<T extends keyof PathsObject = keyof PathsObject> = 16 17 keyof T extends infer K ? (K extends `/${string}` ? K : never) : never; ··· 54 55 }); 55 56 } 56 57 } 58 + 59 + parseServers({ context }); 57 60 58 61 for (const path in context.spec.paths) { 59 62 if (path.startsWith('x-')) {
+36
packages/openapi-ts/src/openApi/2.0.x/parser/server.ts
··· 1 + import type { IR } from '../../../ir/types'; 2 + import { parseUrl } from '../../../utils/url'; 3 + 4 + export const parseServers = ({ context }: { context: IR.Context }) => { 5 + let schemes: ReadonlyArray<string> = context.spec.schemes ?? []; 6 + let host = context.spec.host ?? ''; 7 + const path = context.spec.basePath ?? ''; 8 + 9 + if (typeof context.config.input.path === 'string') { 10 + const url = parseUrl(context.config.input.path); 11 + 12 + if (!schemes.length) { 13 + if (url.protocol) { 14 + schemes = [url.protocol] as typeof schemes; 15 + } 16 + } 17 + 18 + if (!host) { 19 + host = `${url.host}${url.port ? `:${url.port}` : ''}`; 20 + } 21 + } 22 + 23 + if (!schemes.length) { 24 + schemes = ['']; 25 + } 26 + 27 + const servers = schemes 28 + .map((scheme) => `${scheme ? `${scheme}://` : ''}${host}${path}`) 29 + .filter(Boolean); 30 + 31 + if (servers.length) { 32 + context.ir.servers = servers.map((url) => ({ 33 + url, 34 + })); 35 + } 36 + };
+4
packages/openapi-ts/src/openApi/3.0.x/parser/index.ts
··· 99 99 } 100 100 } 101 101 102 + if (context.spec.servers) { 103 + context.ir.servers = context.spec.servers; 104 + } 105 + 102 106 for (const path in context.spec.paths) { 103 107 const pathItem = context.spec.paths[path as keyof PathsObject]!; 104 108
+4
packages/openapi-ts/src/openApi/3.0.x/parser/operation.ts
··· 236 236 context.ir.paths[path] = {}; 237 237 } 238 238 239 + if (operation.servers) { 240 + context.ir.servers = [...(context.ir.servers ?? []), ...operation.servers]; 241 + } 242 + 239 243 operation.id = operationToId({ 240 244 context, 241 245 id: operation.operationId,
+4
packages/openapi-ts/src/openApi/3.1.x/parser/index.ts
··· 99 99 } 100 100 } 101 101 102 + if (context.spec.servers) { 103 + context.ir.servers = context.spec.servers; 104 + } 105 + 102 106 for (const path in context.spec.paths) { 103 107 const pathItem = context.spec.paths[path as keyof PathsObject]!; 104 108
+4
packages/openapi-ts/src/openApi/3.1.x/parser/operation.ts
··· 221 221 context.ir.paths[path] = {}; 222 222 } 223 223 224 + if (operation.servers) { 225 + context.ir.servers = [...(context.ir.servers ?? []), ...operation.servers]; 226 + } 227 + 224 228 operation.id = operationToId({ 225 229 context, 226 230 id: operation.operationId,
+78
packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import { compiler } from '../../../compiler'; 4 + import type { Identifier } from '../../../generate/files'; 5 + import type { IR } from '../../../ir/types'; 6 + import { parseUrl } from '../../../utils/url'; 7 + import type { Plugin } from '../../types'; 8 + import { getClientBaseUrlKey } from '../client-core/utils'; 9 + import { typesId } from './ref'; 10 + import type { Config } from './types'; 11 + 12 + const stringType = compiler.keywordTypeNode({ keyword: 'string' }); 13 + 14 + const serverToBaseUrlType = ({ server }: { server: IR.ServerObject }) => { 15 + const url = parseUrl(server.url); 16 + 17 + if (url.protocol && url.host) { 18 + return compiler.literalTypeNode({ 19 + literal: compiler.stringLiteral({ text: server.url }), 20 + }); 21 + } 22 + 23 + return compiler.templateLiteralType({ 24 + value: [ 25 + url.protocol || stringType, 26 + '://', 27 + url.host || stringType, 28 + url.port ? `:${url.port}` : '', 29 + url.path || '', 30 + ], 31 + }); 32 + }; 33 + 34 + export const createClientOptions = ({ 35 + context, 36 + identifier, 37 + servers, 38 + }: { 39 + context: IR.Context; 40 + identifier: Identifier; 41 + plugin: Plugin.Instance<Config>; 42 + servers: ReadonlyArray<IR.ServerObject>; 43 + }) => { 44 + const file = context.file({ id: typesId })!; 45 + 46 + if (!identifier.name) { 47 + return; 48 + } 49 + 50 + const typeClientOptions = compiler.typeAliasDeclaration({ 51 + exportType: true, 52 + name: identifier.name, 53 + type: compiler.typeInterfaceNode({ 54 + properties: [ 55 + { 56 + name: getClientBaseUrlKey(context.config), 57 + type: compiler.typeUnionNode({ 58 + types: [ 59 + ...servers.map((server) => 60 + serverToBaseUrlType({ 61 + server, 62 + }), 63 + ), 64 + servers.length 65 + ? compiler.typeIntersectionNode({ 66 + types: [stringType, ts.factory.createTypeLiteralNode([])], 67 + }) 68 + : stringType, 69 + ], 70 + }), 71 + }, 72 + ], 73 + useLegacyResolution: false, 74 + }), 75 + }); 76 + 77 + file.add(typeClientOptions); 78 + };
+22 -54
packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts
··· 12 12 import { fieldName } from '../../shared/utils/case'; 13 13 import { operationIrRef } from '../../shared/utils/ref'; 14 14 import type { Plugin } from '../../types'; 15 - import { getClientBaseUrlKey } from '../client-core/utils'; 15 + import { createClientOptions } from './clientOptions'; 16 16 import { typesId } from './ref'; 17 17 import type { Config } from './types'; 18 18 ··· 1020 1020 return type; 1021 1021 }; 1022 1022 1023 - const createClientOptions = ({ 1024 - context, 1025 - }: { 1026 - context: IR.Context; 1027 - plugin: Plugin.Instance<Config>; 1028 - }) => { 1029 - const file = context.file({ id: typesId })!; 1030 - 1031 - const clientOptions = file.identifier({ 1032 - $ref: 'ClientOptions', 1033 - create: true, 1034 - namespace: 'type', 1035 - }); 1036 - 1037 - if (!clientOptions.name) { 1038 - return; 1039 - } 1040 - 1041 - const typeClientOptions = compiler.typeAliasDeclaration({ 1042 - exportType: true, 1043 - name: clientOptions.name, 1044 - type: compiler.typeInterfaceNode({ 1045 - properties: [ 1046 - { 1047 - name: getClientBaseUrlKey(context.config), 1048 - type: compiler.typeUnionNode({ 1049 - types: [ 1050 - compiler.literalTypeNode({ 1051 - literal: compiler.stringLiteral({ text: '/' }), 1052 - }), 1053 - compiler.typeIntersectionNode({ 1054 - types: [ 1055 - compiler.keywordTypeNode({ keyword: 'string' }), 1056 - ts.factory.createTypeLiteralNode([]), 1057 - ], 1058 - }), 1059 - ], 1060 - }), 1061 - }, 1062 - ], 1063 - useLegacyResolution: false, 1064 - }), 1065 - }); 1066 - 1067 - file.add(typeClientOptions); 1068 - }; 1069 - 1070 1023 export const handler: Plugin.Handler<Config> = ({ context, plugin }) => { 1071 - context.createFile({ 1024 + const file = context.createFile({ 1072 1025 exportFromIndex: plugin.exportFromIndex, 1073 1026 id: typesId, 1074 1027 identifierCase: plugin.identifierCase, 1075 1028 path: plugin.output, 1076 1029 }); 1077 1030 1078 - context.subscribe('before', () => { 1079 - createClientOptions({ 1080 - context, 1081 - plugin, 1082 - }); 1031 + // reserve identifier for ClientOptions 1032 + const clientOptions = file.identifier({ 1033 + $ref: 'ClientOptions', 1034 + create: true, 1035 + namespace: 'type', 1083 1036 }); 1084 1037 1085 1038 context.subscribe('schema', ({ $ref, schema }) => { ··· 1114 1067 context, 1115 1068 operation, 1116 1069 plugin, 1070 + }); 1071 + }); 1072 + 1073 + const servers: Array<IR.ServerObject> = []; 1074 + 1075 + context.subscribe('server', ({ server }) => { 1076 + servers.push(server); 1077 + }); 1078 + 1079 + context.subscribe('after', () => { 1080 + createClientOptions({ 1081 + context, 1082 + identifier: clientOptions, 1083 + plugin, 1084 + servers, 1117 1085 }); 1118 1086 }); 1119 1087 };
+96
packages/openapi-ts/src/utils/__tests__/url.test.ts
··· 1 + import { describe, expect, it } from 'vitest'; 2 + 3 + import { parseUrl } from '../url'; 4 + 5 + describe('parseUrl', () => { 6 + it.each([ 7 + { host: '', path: '', port: '', protocol: '', value: '' }, 8 + { host: '', path: '', port: '', protocol: '', value: '/' }, 9 + { host: 'foo.com', path: '', port: '', protocol: '', value: 'foo.com' }, 10 + { host: 'foo.com', path: '', port: '', protocol: '', value: 'foo.com/' }, 11 + { 12 + host: 'foo.com', 13 + path: '/bar', 14 + port: '', 15 + protocol: '', 16 + value: 'foo.com/bar', 17 + }, 18 + { 19 + host: 'www.foo.com', 20 + path: '/bar', 21 + port: '', 22 + protocol: '', 23 + value: 'www.foo.com/bar', 24 + }, 25 + { 26 + host: 'www.foo.com', 27 + path: '/bar', 28 + port: '', 29 + protocol: 'https', 30 + value: 'https://www.foo.com/bar', 31 + }, 32 + { 33 + host: 'www.foo.com', 34 + path: '/bar', 35 + port: '', 36 + protocol: 'custom', 37 + value: 'custom://www.foo.com/bar', 38 + }, 39 + { 40 + host: 'foo.com', 41 + path: '/bar', 42 + port: '', 43 + protocol: 'ws', 44 + value: 'ws://foo.com/bar', 45 + }, 46 + { 47 + host: 'foo.com', 48 + path: '/bar', 49 + port: '', 50 + protocol: '', 51 + value: '//foo.com/bar?ignore', 52 + }, 53 + { host: 'foo.com', path: '', port: '', protocol: '', value: '//foo.com' }, 54 + { host: '', path: '', port: '', protocol: 'https', value: 'https://' }, 55 + { host: '', path: '/bar', port: '', protocol: '', value: '/bar' }, 56 + { 57 + host: 'localhost', 58 + path: '', 59 + port: '3025', 60 + protocol: 'http', 61 + value: 'http://localhost:3025', 62 + }, 63 + { 64 + host: 'localhost', 65 + path: '', 66 + port: '', 67 + protocol: 'https', 68 + value: 'https://localhost', 69 + }, 70 + { host: '', path: '/v1/foo', port: '', protocol: '', value: '/v1/foo' }, 71 + { 72 + host: '10.0.81.36', 73 + path: '/v1', 74 + port: '', 75 + protocol: 'http', 76 + value: 'http://10.0.81.36/v1', 77 + }, 78 + { 79 + host: '{id}.foo.com', 80 + path: '/v1', 81 + port: '{port}', 82 + protocol: 'https', 83 + value: 'https://{id}.foo.com:{port}/v1', 84 + }, 85 + { host: '', path: '', port: '', protocol: '', value: './foo.json' }, 86 + { host: '', path: '', port: '', protocol: '', value: '../../foo.json' }, 87 + { host: '', path: '', port: '', protocol: '', value: 'D://\\foo.json' }, 88 + ])('$value', ({ host, path, port, protocol, value }) => { 89 + expect(parseUrl(value)).toEqual({ 90 + host, 91 + path, 92 + port, 93 + protocol, 94 + }); 95 + }); 96 + });
+47
packages/openapi-ts/src/utils/url.ts
··· 1 + const parseUrlRegExp = 2 + /^(([^:/?#]+):)?((\/\/)?([^:/?#]*)(:?([^/?#]*)))?([^?#]*)(\?([^#]*))?(#(.*))?/; 3 + 4 + interface Url { 5 + host: string; 6 + path: string; 7 + port: string; 8 + protocol: string; 9 + } 10 + 11 + export const parseUrl = (value: string): Url => { 12 + const errorResponse: Url = { 13 + host: '', 14 + path: '', 15 + port: '', 16 + protocol: '', 17 + }; 18 + 19 + parseUrlRegExp.lastIndex = 0; 20 + const match = value.match(parseUrlRegExp); 21 + 22 + if (!match) { 23 + return errorResponse; 24 + } 25 + 26 + const host = match[5] || ''; 27 + 28 + // value is a relative file system path 29 + if (host === '.' || host === '..') { 30 + return errorResponse; 31 + } 32 + 33 + const path = match[8] || ''; 34 + const protocol = match[2] || ''; 35 + 36 + // value is probably a Windows file system path 37 + if (protocol.length === 1) { 38 + return errorResponse; 39 + } 40 + 41 + return { 42 + host, 43 + path: path === '/' ? '' : path, 44 + port: match[7] || '', 45 + protocol, 46 + }; 47 + };
+24
packages/openapi-ts/test/2.0.x.test.ts
··· 273 273 }), 274 274 description: 'generates SDK functions without auth', 275 275 }, 276 + { 277 + config: createConfig({ 278 + input: 'servers.yaml', 279 + output: 'servers', 280 + plugins: ['@hey-api/client-fetch', '@hey-api/typescript'], 281 + }), 282 + description: 'generates baseUrl', 283 + }, 284 + { 285 + config: createConfig({ 286 + input: 'servers-base-path.yaml', 287 + output: 'servers-base-path', 288 + plugins: ['@hey-api/client-fetch', '@hey-api/typescript'], 289 + }), 290 + description: 'generates baseUrl from basePath', 291 + }, 292 + { 293 + config: createConfig({ 294 + input: 'servers-host.yaml', 295 + output: 'servers-host', 296 + plugins: ['@hey-api/client-fetch', '@hey-api/typescript'], 297 + }), 298 + description: 'generates baseUrl from host', 299 + }, 276 300 ]; 277 301 278 302 it.each(scenarios)('$description', async ({ config }) => {
+8
packages/openapi-ts/test/3.0.x.test.ts
··· 490 490 }, 491 491 { 492 492 config: createConfig({ 493 + input: 'servers.yaml', 494 + output: 'servers', 495 + plugins: ['@hey-api/client-fetch', '@hey-api/typescript'], 496 + }), 497 + description: 'generates baseUrl', 498 + }, 499 + { 500 + config: createConfig({ 493 501 input: 'transformers-all-of.yaml', 494 502 output: 'transformers-all-of', 495 503 plugins: ['@hey-api/client-fetch', '@hey-api/transformers'],
+8
packages/openapi-ts/test/3.1.x.test.ts
··· 567 567 }, 568 568 { 569 569 config: createConfig({ 570 + input: 'servers.yaml', 571 + output: 'servers', 572 + plugins: ['@hey-api/client-fetch', '@hey-api/typescript'], 573 + }), 574 + description: 'generates baseUrl', 575 + }, 576 + { 577 + config: createConfig({ 570 578 input: 'transformers-all-of.yaml', 571 579 output: 'transformers-all-of', 572 580 plugins: ['@hey-api/client-fetch', '@hey-api/transformers'],
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/body-response-text-plain/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/body-response-text-plain/types.gen.ts
··· 14 14 200: string; 15 15 }; 16 16 17 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 17 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: string; 21 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-javascript-PascalCase/types.gen.ts
··· 40 40 '-100': -100, 41 41 '-200': -200, 42 42 '-300': -300 43 - } as const; 43 + } as const; 44 + 45 + export type ClientOptions = { 46 + baseUrl: string; 47 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 40 40 '-100': -100, 41 41 '-200': -200, 42 42 '-300': -300 43 - } as const; 43 + } as const; 44 + 45 + export type ClientOptions = { 46 + baseUrl: string; 47 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-javascript-camelCase/types.gen.ts
··· 40 40 '-100': -100, 41 41 '-200': -200, 42 42 '-300': -300 43 - } as const; 43 + } as const; 44 + 45 + export type ClientOptions = { 46 + baseUrl: string; 47 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-javascript-preserve/types.gen.ts
··· 40 40 '-100': -100, 41 41 '-200': -200, 42 42 '-300': -300 43 - } as const; 43 + } as const; 44 + 45 + export type ClientOptions = { 46 + baseUrl: string; 47 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-javascript-snake_case/types.gen.ts
··· 40 40 '-100': -100, 41 41 '-200': -200, 42 42 '-300': -300 43 - } as const; 43 + } as const; 44 + 45 + export type ClientOptions = { 46 + baseUrl: string; 47 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-typescript-PascalCase/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-typescript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-typescript-camelCase/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-typescript-preserve/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values-typescript-snake_case/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/enum-names-values/types.gen.ts
··· 8 8 9 9 export type Foo = 'foo' | 'bar' | '' | true | false; 10 10 11 - export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 11 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 15 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/form-data/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/form-data/types.gen.ts
··· 21 21 200: Foo; 22 22 }; 23 23 24 - export type PostV1FooResponse = PostV1FooResponses[keyof PostV1FooResponses]; 24 + export type PostV1FooResponse = PostV1FooResponses[keyof PostV1FooResponses]; 25 + 26 + export type ClientOptions = { 27 + baseUrl: string; 28 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig({ 16 + export const client = createClient(createConfig<ClientOptions>({ 6 17 throwOnError: true 7 18 }));
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format/types.gen.ts
··· 25 25 200: Foo; 26 26 }; 27 27 28 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 28 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 29 + 30 + export type ClientOptions = { 31 + baseUrl: string; 32 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseURL: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseURL: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseURL: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseURL: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseURL: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/plugins/fastify/default/types.gen.ts
··· 1095 1095 200: ResponsePostActivityResponse; 1096 1096 }; 1097 1097 1098 - export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1098 + export type PostApiVbyApiVersionBodyResponse = PostApiVbyApiVersionBodyResponses[keyof PostApiVbyApiVersionBodyResponses]; 1099 + 1100 + export type ClientOptions = { 1101 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1102 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/schema-unknown/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/2.0.x/schema-unknown/types.gen.ts
··· 129 129 200: SendEmailResponse; 130 130 }; 131 131 132 - export type SendEmailResponse2 = SendEmailResponses[keyof SendEmailResponses]; 132 + export type SendEmailResponse2 = SendEmailResponses[keyof SendEmailResponses]; 133 + 134 + export type ClientOptions = { 135 + baseUrl: `${string}://api.postmarkapp.com` | (string & {}); 136 + };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/security-api-key/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/2.0.x/security-api-key/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/security-basic/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/2.0.x/security-basic/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/security-false/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/2.0.x/security-false/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/2.0.x/security-oauth2/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/2.0.x/security-oauth2/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+16
packages/openapi-ts/test/__snapshots__/2.0.x/servers-base-path/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions>());
+2
packages/openapi-ts/test/__snapshots__/2.0.x/servers-base-path/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+21
packages/openapi-ts/test/__snapshots__/2.0.x/servers-base-path/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type GetFooData = { 4 + body?: never; 5 + path?: never; 6 + query?: never; 7 + url: '/foo'; 8 + }; 9 + 10 + export type GetFooResponses = { 11 + /** 12 + * OK 13 + */ 14 + 200: string; 15 + }; 16 + 17 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: `${string}://${string}/v1` | (string & {}); 21 + };
+16
packages/openapi-ts/test/__snapshots__/2.0.x/servers-host/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions>());
+2
packages/openapi-ts/test/__snapshots__/2.0.x/servers-host/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+21
packages/openapi-ts/test/__snapshots__/2.0.x/servers-host/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type GetFooData = { 4 + body?: never; 5 + path?: never; 6 + query?: never; 7 + url: '/foo'; 8 + }; 9 + 10 + export type GetFooResponses = { 11 + /** 12 + * OK 13 + */ 14 + 200: string; 15 + }; 16 + 17 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: `${string}://foo.com` | (string & {}); 21 + };
+16
packages/openapi-ts/test/__snapshots__/2.0.x/servers/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions>());
+2
packages/openapi-ts/test/__snapshots__/2.0.x/servers/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+21
packages/openapi-ts/test/__snapshots__/2.0.x/servers/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type GetFooData = { 4 + body?: never; 5 + path?: never; 6 + query?: never; 7 + url: '/foo'; 8 + }; 9 + 10 + export type GetFooResponses = { 11 + /** 12 + * OK 13 + */ 14 + 200: string; 15 + }; 16 + 17 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: 'https://foo.com/v1' | (string & {}); 21 + };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/additional-properties-false/types.gen.ts
··· 10 10 11 11 export type Baz = Foo & { 12 12 bar: string; 13 + }; 14 + 15 + export type ClientOptions = { 16 + baseUrl: string; 13 17 };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/additional-properties-true/types.gen.ts
··· 12 12 export type Baz = Foo & { 13 13 bar: string; 14 14 [key: string]: unknown | string; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/additional-properties-undefined/types.gen.ts
··· 4 4 foo: { 5 5 [key: string]: unknown; 6 6 }; 7 + }; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 7 11 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/array-items-one-of-length-1/types.gen.ts
··· 4 4 foo?: Array<Bar>; 5 5 }; 6 6 7 - export type Bar = string; 7 + export type Bar = string; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 11 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/body-response-text-plain/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/body-response-text-plain/types.gen.ts
··· 14 14 200: string; 15 15 }; 16 16 17 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 17 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: string; 21 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/case-PascalCase/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 85 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 86 + 87 + export type ClientOptions = { 88 + baseUrl: string; 89 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/case-camelCase/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type getFooResponse = getFooResponses[keyof getFooResponses]; 85 + export type getFooResponse = getFooResponses[keyof getFooResponses]; 86 + 87 + export type clientOptions = { 88 + baseUrl: string; 89 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/case-snake_case/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type get_foo_response = get_foo_responses[keyof get_foo_responses]; 85 + export type get_foo_response = get_foo_responses[keyof get_foo_responses]; 86 + 87 + export type client_options = { 88 + baseUrl: string; 89 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/case/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type GetFoo_Response = GetFoo_Responses[keyof GetFoo_Responses]; 85 + export type GetFoo_Response = GetFoo_Responses[keyof GetFoo_Responses]; 86 + 87 + export type ClientOptions = { 88 + baseUrl: string; 89 + };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/components-request-bodies/types.gen.ts
··· 22 22 * OK 23 23 */ 24 24 200: unknown; 25 + }; 26 + 27 + export type ClientOptions = { 28 + baseUrl: string; 25 29 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/content-binary/types.gen.ts
··· 24 24 200: Blob | File; 25 25 }; 26 26 27 - export type GetBarResponse = GetBarResponses[keyof GetBarResponses]; 27 + export type GetBarResponse = GetBarResponses[keyof GetBarResponses]; 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-all-of/types.gen.ts
··· 42 42 id: 'QuxMapped'; 43 43 } & { 44 44 qux?: boolean; 45 + }; 46 + 47 + export type ClientOptions = { 48 + baseUrl: string; 45 49 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-any-of/types.gen.ts
··· 21 21 type?: 'bar'; 22 22 } & Bar) | ({ 23 23 type?: 'baz'; 24 - } & Baz); 24 + } & Baz); 25 + 26 + export type ClientOptions = { 27 + baseUrl: string; 28 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/discriminator-one-of/types.gen.ts
··· 21 21 type?: 'bar'; 22 22 } & Bar) | ({ 23 23 type?: 'baz'; 24 - } & Baz); 24 + } & Baz); 25 + 26 + export type ClientOptions = { 27 + baseUrl: string; 28 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-escape/types.gen.ts
··· 4 4 foo?: "foo'bar" | 'foo"bar'; 5 5 }; 6 6 7 - export type Bar = "foo'bar" | 'foo"bar'; 7 + export type Bar = "foo'bar" | 'foo"bar'; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 11 + };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/enum-inline-javascript/types.gen.ts
··· 9 9 10 10 export type Foo = { 11 11 type?: 'foo' | 'bar'; 12 + }; 13 + 14 + export type ClientOptions = { 15 + baseUrl: string; 12 16 };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/enum-inline-typescript-namespace/types.gen.ts
··· 9 9 10 10 export type Foo = { 11 11 type?: 'foo' | 'bar'; 12 + }; 13 + 14 + export type ClientOptions = { 15 + baseUrl: string; 12 16 };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/enum-inline-typescript/types.gen.ts
··· 7 7 8 8 export type Foo = { 9 9 type?: 'foo' | 'bar'; 10 + }; 11 + 12 + export type ClientOptions = { 13 + baseUrl: string; 10 14 };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/enum-inline/types.gen.ts
··· 4 4 5 5 export type Foo = { 6 6 type?: 'foo' | 'bar'; 7 + }; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 7 11 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-javascript-PascalCase/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-javascript-camelCase/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-javascript-preserve/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-javascript-snake_case/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-typescript-PascalCase/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-typescript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-typescript-camelCase/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-typescript-preserve/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values-typescript-snake_case/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-names-values/types.gen.ts
··· 8 8 9 9 export type Foo = 'foo' | 'bar' | null | '' | true | false; 10 10 11 - export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 11 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 15 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/enum-null/types.gen.ts
··· 4 4 5 5 export type Bar = 'foo' | 'bar'; 6 6 7 - export type Baz = 'foo' | 'bar'; 7 + export type Baz = 'foo' | 'bar'; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 11 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/internal-name-conflict/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/internal-name-conflict/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/operation-204/types.gen.ts
··· 18 18 204: void; 19 19 }; 20 20 21 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 21 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 22 + 23 + export type ClientOptions = { 24 + baseUrl: string; 25 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/parameter-explode-false-axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/parameter-explode-false-axios/types.gen.ts
··· 14 14 * OK 15 15 */ 16 16 default: unknown; 17 + }; 18 + 19 + export type ClientOptions = { 20 + baseURL: string; 17 21 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/parameter-explode-false/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/parameter-explode-false/types.gen.ts
··· 14 14 * OK 15 15 */ 16 16 default: unknown; 17 + }; 18 + 19 + export type ClientOptions = { 20 + baseUrl: string; 17 21 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig({ 16 + export const client = createClient(createConfig<ClientOptions>({ 6 17 throwOnError: true 7 18 }));
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format/types.gen.ts
··· 25 25 200: Foo; 26 26 }; 27 27 28 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 28 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 29 + 30 + export type ClientOptions = { 31 + baseUrl: string; 32 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseURL: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseURL: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseURL: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseURL: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseURL: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+4
packages/openapi-ts/test/__snapshots__/3.0.x/plugins/fastify/default/types.gen.ts
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/security-api-key/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/security-api-key/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/security-false/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/security-false/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/security-http-bearer/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/security-http-bearer/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/security-oauth2/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/security-oauth2/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/security-open-id-connect/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.0.x/security-open-id-connect/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+16
packages/openapi-ts/test/__snapshots__/3.0.x/servers/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions>());
+2
packages/openapi-ts/test/__snapshots__/3.0.x/servers/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+21
packages/openapi-ts/test/__snapshots__/3.0.x/servers/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type GetFooData = { 4 + body?: never; 5 + path?: never; 6 + query?: never; 7 + url: '/foo'; 8 + }; 9 + 10 + export type GetFooResponses = { 11 + /** 12 + * OK 13 + */ 14 + 200: string; 15 + }; 16 + 17 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: 'https://foo.com/v1' | `${string}://${string}/v1` | (string & {}); 21 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/transformers-all-of/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/transformers-all-of/types.gen.ts
··· 39 39 200: Foo; 40 40 }; 41 41 42 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 42 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 43 + 44 + export type ClientOptions = { 45 + baseUrl: string; 46 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/transformers-any-of-null/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/transformers-any-of-null/types.gen.ts
··· 19 19 200: Array<Foo>; 20 20 }; 21 21 22 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 22 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 23 + 24 + export type ClientOptions = { 25 + baseUrl: string; 26 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.0.x/transformers-array/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/transformers-array/types.gen.ts
··· 18 18 }; 19 19 }; 20 20 21 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 21 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 22 + 23 + export type ClientOptions = { 24 + baseUrl: string; 25 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.0.x/type-invalid/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - export type Foo = unknown; 3 + export type Foo = unknown; 4 + 5 + export type ClientOptions = { 6 + baseUrl: string; 7 + };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/additional-properties-false/types.gen.ts
··· 10 10 11 11 export type Baz = Foo & { 12 12 bar: string; 13 + }; 14 + 15 + export type ClientOptions = { 16 + baseUrl: string; 13 17 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/additional-properties-true/types.gen.ts
··· 12 12 export type Baz = Foo & { 13 13 bar: string; 14 14 [key: string]: unknown | string; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/additional-properties-undefined/types.gen.ts
··· 4 4 foo: { 5 5 [key: string]: unknown; 6 6 }; 7 + }; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 7 11 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/array-items-one-of-length-1/types.gen.ts
··· 4 4 foo?: Array<Bar>; 5 5 }; 6 6 7 - export type Bar = string; 7 + export type Bar = string; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 11 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/body-response-text-plain/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/body-response-text-plain/types.gen.ts
··· 14 14 200: string; 15 15 }; 16 16 17 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 17 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: string; 21 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/case-PascalCase/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 85 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 86 + 87 + export type ClientOptions = { 88 + baseUrl: string; 89 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/case-camelCase/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type getFooResponse = getFooResponses[keyof getFooResponses]; 85 + export type getFooResponse = getFooResponses[keyof getFooResponses]; 86 + 87 + export type clientOptions = { 88 + baseUrl: string; 89 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/case-snake_case/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type get_foo_response = get_foo_responses[keyof get_foo_responses]; 85 + export type get_foo_response = get_foo_responses[keyof get_foo_responses]; 86 + 87 + export type client_options = { 88 + baseUrl: string; 89 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/case/types.gen.ts
··· 82 82 201: _201; 83 83 }; 84 84 85 - export type GetFoo_Response = GetFoo_Responses[keyof GetFoo_Responses]; 85 + export type GetFoo_Response = GetFoo_Responses[keyof GetFoo_Responses]; 86 + 87 + export type ClientOptions = { 88 + baseUrl: string; 89 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/bundle/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from './client'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from './client'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+1 -1
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/bundle/client/index.cjs
··· 1 - 'use strict';var B=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var B__default=/*#__PURE__*/_interopDefault(B);var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},z=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},w=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},j={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>z(r,e,a)):z(r,e,i));}),r}},q={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},P={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>w(r,e,a)):w(r,e,i));}),r}},v=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},$=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},k=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},h=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(!r){let n=(t?a:a.map(o=>encodeURIComponent(o))).join($(i));switch(i){case "label":return `.${n}`;case "matrix":return `;${e}=${n}`;case "simple":return n;default:return `${e}=${n}`}}let s=v(i),l=a.map(n=>i==="label"||i==="simple"?t?n:encodeURIComponent(n):f({allowReserved:t,name:e,value:n})).join(s);return i==="label"||i==="matrix"?s+l:l},f=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},g=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(a instanceof Date)return `${e}=${a.toISOString()}`;if(i!=="deepObject"&&!r){let n=[];Object.entries(a).forEach(([u,d])=>{n=[...n,u,t?d:encodeURIComponent(d)];});let o=n.join(",");switch(i){case "form":return `${e}=${o}`;case "label":return `.${o}`;case "matrix":return `;${e}=${o}`;default:return o}}let s=k(i),l=Object.entries(a).map(([n,o])=>f({allowReserved:t,name:i==="deepObject"?`${e}[${n}]`:n,value:o})).join(s);return i==="label"||i==="matrix"?s+l:l};var E=/\{[^{}]+\}/g,T=({path:t,url:r})=>{let e=r,i=r.match(E);if(i)for(let a of i){let s=false,l=a.substring(1,a.length-1),n="simple";l.endsWith("*")&&(s=true,l=l.substring(0,l.length-1)),l.startsWith(".")?(l=l.substring(1),n="label"):l.startsWith(";")&&(l=l.substring(1),n="matrix");let o=t[l];if(o==null)continue;if(Array.isArray(o)){e=e.replace(a,h({explode:s,name:l,style:n,value:o}));continue}if(typeof o=="object"){e=e.replace(a,g({explode:s,name:l,style:n,value:o}));continue}if(n==="matrix"){e=e.replace(a,`;${f({name:l,value:o})}`);continue}let u=encodeURIComponent(n==="label"?`.${o}`:o);e=e.replace(a,u);}return e},U=({allowReserved:t,array:r,object:e}={})=>a=>{let s=[];if(a&&typeof a=="object")for(let l in a){let n=a[l];if(n!=null){if(Array.isArray(n)){s=[...s,h({allowReserved:t,explode:true,name:l,style:"form",value:n,...r})];continue}if(typeof n=="object"){s=[...s,g({allowReserved:t,explode:true,name:l,style:"deepObject",value:n,...e})];continue}s=[...s,f({allowReserved:t,name:l,value:n})];}}return s.join("&")},R=async({security:t,...r})=>{for(let e of t){let i=await A(e,r.auth);if(!i)continue;let a=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[a]=i;break;case "header":default:r.headers[a]=i;break}return}},b=t=>D({path:t.path,query:t.paramsSerializer?undefined:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:U(t.querySerializer),url:t.url}),D=({path:t,query:r,querySerializer:e,url:i})=>{let s=i.startsWith("/")?i:`/${i}`;t&&(s=T({path:t,url:s}));let l=r?e(r):"";return l.startsWith("?")&&(l=l.substring(1)),l&&(s+=`?${l}`),s},S=(t,r)=>{let e={...t,...r};return e.headers=y(t.headers,r.headers),e},H=["common","delete","get","head","patch","post","put"],y=(...t)=>{let r={};for(let e of t){if(!e||typeof e!="object")continue;let i=Object.entries(e);for(let[a,s]of i)if(H.includes(a)&&typeof s=="object")r[a]={...r[a],...s};else if(s===null)delete r[a];else if(Array.isArray(s))for(let l of s)r[a]=[...r[a]??[],l];else s!==undefined&&(r[a]=typeof s=="object"?JSON.stringify(s):s);}return r},x=(t={})=>({baseURL:"",...t});var I=(t={})=>{let r=S(x(),t),{auth:e,...i}=r,a=B__default.default.create(i),s=()=>({...r}),l=o=>(r=S(r,o),a.defaults={...a.defaults,...r,headers:y(a.defaults.headers,r.headers)},s()),n=async o=>{let u={...r,...o,axios:o.axios??r.axios??a,headers:y(r.headers,o.headers)};u.security&&await R({...u,security:u.security}),u.body&&u.bodySerializer&&(u.body=u.bodySerializer(u.body));let d=b(u);try{let m=u.axios,{auth:c,...O}=u,C=await m({...O,data:u.body,headers:u.headers,params:u.paramsSerializer?u.query:void 0,url:d}),{data:p}=C;return u.responseType==="json"&&(u.responseValidator&&await u.responseValidator(p),u.responseTransformer&&(p=await u.responseTransformer(p))),{...C,data:p??{}}}catch(m){let c=m;if(u.throwOnError)throw c;return c.error=c.response?.data??{},c}};return {buildUrl:b,delete:o=>n({...o,method:"DELETE"}),get:o=>n({...o,method:"GET"}),getConfig:s,head:o=>n({...o,method:"HEAD"}),instance:a,options:o=>n({...o,method:"OPTIONS"}),patch:o=>n({...o,method:"PATCH"}),post:o=>n({...o,method:"POST"}),put:o=>n({...o,method:"PUT"}),request:n,setConfig:l}};exports.createClient=I;exports.createConfig=x;exports.formDataBodySerializer=j;exports.jsonBodySerializer=q;exports.urlSearchParamsBodySerializer=P;//# sourceMappingURL=index.cjs.map 1 + 'use strict';var B=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var B__default=/*#__PURE__*/_interopDefault(B);var w=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},z=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},O=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},j={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>z(r,e,a)):z(r,e,i));}),r}},q={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},P={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>O(r,e,a)):O(r,e,i));}),r}},v=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},$=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},k=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},h=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(!r){let n=(t?a:a.map(o=>encodeURIComponent(o))).join($(i));switch(i){case "label":return `.${n}`;case "matrix":return `;${e}=${n}`;case "simple":return n;default:return `${e}=${n}`}}let s=v(i),l=a.map(n=>i==="label"||i==="simple"?t?n:encodeURIComponent(n):f({allowReserved:t,name:e,value:n})).join(s);return i==="label"||i==="matrix"?s+l:l},f=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},g=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(a instanceof Date)return `${e}=${a.toISOString()}`;if(i!=="deepObject"&&!r){let n=[];Object.entries(a).forEach(([u,d])=>{n=[...n,u,t?d:encodeURIComponent(d)];});let o=n.join(",");switch(i){case "form":return `${e}=${o}`;case "label":return `.${o}`;case "matrix":return `;${e}=${o}`;default:return o}}let s=k(i),l=Object.entries(a).map(([n,o])=>f({allowReserved:t,name:i==="deepObject"?`${e}[${n}]`:n,value:o})).join(s);return i==="label"||i==="matrix"?s+l:l};var T=/\{[^{}]+\}/g,E=({path:t,url:r})=>{let e=r,i=r.match(T);if(i)for(let a of i){let s=false,l=a.substring(1,a.length-1),n="simple";l.endsWith("*")&&(s=true,l=l.substring(0,l.length-1)),l.startsWith(".")?(l=l.substring(1),n="label"):l.startsWith(";")&&(l=l.substring(1),n="matrix");let o=t[l];if(o==null)continue;if(Array.isArray(o)){e=e.replace(a,h({explode:s,name:l,style:n,value:o}));continue}if(typeof o=="object"){e=e.replace(a,g({explode:s,name:l,style:n,value:o}));continue}if(n==="matrix"){e=e.replace(a,`;${f({name:l,value:o})}`);continue}let u=encodeURIComponent(n==="label"?`.${o}`:o);e=e.replace(a,u);}return e},U=({allowReserved:t,array:r,object:e}={})=>a=>{let s=[];if(a&&typeof a=="object")for(let l in a){let n=a[l];if(n!=null){if(Array.isArray(n)){s=[...s,h({allowReserved:t,explode:true,name:l,style:"form",value:n,...r})];continue}if(typeof n=="object"){s=[...s,g({allowReserved:t,explode:true,name:l,style:"deepObject",value:n,...e})];continue}s=[...s,f({allowReserved:t,name:l,value:n})];}}return s.join("&")},A=async({security:t,...r})=>{for(let e of t){let i=await w(e,r.auth);if(!i)continue;let a=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[a]=i;break;case "header":default:r.headers[a]=i;break}return}},b=t=>D({path:t.path,query:t.paramsSerializer?undefined:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:U(t.querySerializer),url:t.url}),D=({path:t,query:r,querySerializer:e,url:i})=>{let s=i.startsWith("/")?i:`/${i}`;t&&(s=E({path:t,url:s}));let l=r?e(r):"";return l.startsWith("?")&&(l=l.substring(1)),l&&(s+=`?${l}`),s},S=(t,r)=>{let e={...t,...r};return e.headers=y(t.headers,r.headers),e},H=["common","delete","get","head","patch","post","put"],y=(...t)=>{let r={};for(let e of t){if(!e||typeof e!="object")continue;let i=Object.entries(e);for(let[a,s]of i)if(H.includes(a)&&typeof s=="object")r[a]={...r[a],...s};else if(s===null)delete r[a];else if(Array.isArray(s))for(let l of s)r[a]=[...r[a]??[],l];else s!==undefined&&(r[a]=typeof s=="object"?JSON.stringify(s):s);}return r},x=(t={})=>({...t});var I=(t={})=>{let r=S(x(),t),{auth:e,...i}=r,a=B__default.default.create(i),s=()=>({...r}),l=o=>(r=S(r,o),a.defaults={...a.defaults,...r,headers:y(a.defaults.headers,r.headers)},s()),n=async o=>{let u={...r,...o,axios:o.axios??r.axios??a,headers:y(r.headers,o.headers)};u.security&&await A({...u,security:u.security}),u.body&&u.bodySerializer&&(u.body=u.bodySerializer(u.body));let d=b(u);try{let m=u.axios,{auth:c,...R}=u,C=await m({...R,baseURL:u.baseURL,data:u.body,headers:u.headers,params:u.paramsSerializer?u.query:void 0,url:d}),{data:p}=C;return u.responseType==="json"&&(u.responseValidator&&await u.responseValidator(p),u.responseTransformer&&(p=await u.responseTransformer(p))),{...C,data:p??{}}}catch(m){let c=m;if(u.throwOnError)throw c;return c.error=c.response?.data??{},c}};return {buildUrl:b,delete:o=>n({...o,method:"DELETE"}),get:o=>n({...o,method:"GET"}),getConfig:s,head:o=>n({...o,method:"HEAD"}),instance:a,options:o=>n({...o,method:"OPTIONS"}),patch:o=>n({...o,method:"PATCH"}),post:o=>n({...o,method:"POST"}),put:o=>n({...o,method:"PUT"}),request:n,setConfig:l}};exports.createClient=I;exports.createConfig=x;exports.formDataBodySerializer=j;exports.jsonBodySerializer=q;exports.urlSearchParamsBodySerializer=P;//# sourceMappingURL=index.cjs.map 2 2 //# sourceMappingURL=index.cjs.map
+16 -6
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/bundle/client/index.d.cts
··· 110 110 responseValidator?: (data: unknown) => Promise<unknown>; 111 111 } 112 112 113 - interface Config<ThrowOnError extends boolean = boolean> extends Omit<CreateAxiosDefaults, 'auth' | 'headers' | 'method'>, Config$1 { 113 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>, Config$1 { 114 114 /** 115 115 * Axios implementation. You can use this option to provide a custom 116 116 * Axios instance. ··· 118 118 * @default axios 119 119 */ 120 120 axios?: AxiosStatic; 121 + /** 122 + * Base URL for all requests made by this client. 123 + */ 124 + baseURL?: T['baseURL']; 121 125 /** 122 126 * An object containing any HTTP headers that you want to pre-populate your 123 127 * `Headers` object with. ··· 130 134 * 131 135 * @default false 132 136 */ 133 - throwOnError?: ThrowOnError; 137 + throwOnError?: T['throwOnError']; 134 138 } 135 - interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<ThrowOnError> { 139 + interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{ 140 + throwOnError: ThrowOnError; 141 + }> { 136 142 /** 137 143 * Any body that you want to add to your request. 138 144 * ··· 153 159 data: undefined; 154 160 error: TError; 155 161 })>; 162 + interface ClientOptions { 163 + baseURL?: string; 164 + throwOnError?: boolean; 165 + } 156 166 type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 157 167 type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'> & Pick<Required<RequestOptions<ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 158 168 type BuildUrlFn = <TData extends { ··· 172 182 * `setConfig()`. This is useful for example if you're using Next.js 173 183 * to ensure your client always has the correct values. 174 184 */ 175 - type CreateClientConfig = (override?: Config) => Config; 185 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 176 186 interface TDataShape { 177 187 body?: unknown; 178 188 headers?: unknown; ··· 192 202 193 203 declare const createClient: (config?: Config) => Client; 194 204 195 - declare const createConfig: CreateClientConfig; 205 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 196 206 197 - export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 207 + export { type Auth, type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+16 -6
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/bundle/client/index.d.ts
··· 110 110 responseValidator?: (data: unknown) => Promise<unknown>; 111 111 } 112 112 113 - interface Config<ThrowOnError extends boolean = boolean> extends Omit<CreateAxiosDefaults, 'auth' | 'headers' | 'method'>, Config$1 { 113 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>, Config$1 { 114 114 /** 115 115 * Axios implementation. You can use this option to provide a custom 116 116 * Axios instance. ··· 118 118 * @default axios 119 119 */ 120 120 axios?: AxiosStatic; 121 + /** 122 + * Base URL for all requests made by this client. 123 + */ 124 + baseURL?: T['baseURL']; 121 125 /** 122 126 * An object containing any HTTP headers that you want to pre-populate your 123 127 * `Headers` object with. ··· 130 134 * 131 135 * @default false 132 136 */ 133 - throwOnError?: ThrowOnError; 137 + throwOnError?: T['throwOnError']; 134 138 } 135 - interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<ThrowOnError> { 139 + interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{ 140 + throwOnError: ThrowOnError; 141 + }> { 136 142 /** 137 143 * Any body that you want to add to your request. 138 144 * ··· 153 159 data: undefined; 154 160 error: TError; 155 161 })>; 162 + interface ClientOptions { 163 + baseURL?: string; 164 + throwOnError?: boolean; 165 + } 156 166 type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 157 167 type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'> & Pick<Required<RequestOptions<ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 158 168 type BuildUrlFn = <TData extends { ··· 172 182 * `setConfig()`. This is useful for example if you're using Next.js 173 183 * to ensure your client always has the correct values. 174 184 */ 175 - type CreateClientConfig = (override?: Config) => Config; 185 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 176 186 interface TDataShape { 177 187 body?: unknown; 178 188 headers?: unknown; ··· 192 202 193 203 declare const createClient: (config?: Config) => Client; 194 204 195 - declare const createConfig: CreateClientConfig; 205 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 196 206 197 - export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 207 + export { type Auth, type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/bundle/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/bundle/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from './client'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from './client'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+1 -1
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/bundle/client/index.cjs
··· 1 - 'use strict';var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},z=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},j=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},T={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>z(r,e,a)):z(r,e,i));}),r}},R={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},U={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>j(r,e,a)):j(r,e,i));}),r}},k=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},_=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},D=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},q=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(!r){let s=(t?a:a.map(l=>encodeURIComponent(l))).join(_(i));switch(i){case "label":return `.${s}`;case "matrix":return `;${e}=${s}`;case "simple":return s;default:return `${e}=${s}`}}let o=k(i),n=a.map(s=>i==="label"||i==="simple"?t?s:encodeURIComponent(s):y({allowReserved:t,name:e,value:s})).join(o);return i==="label"||i==="matrix"?o+n:n},y=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},S=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(a instanceof Date)return `${e}=${a.toISOString()}`;if(i!=="deepObject"&&!r){let s=[];Object.entries(a).forEach(([f,u])=>{s=[...s,f,t?u:encodeURIComponent(u)];});let l=s.join(",");switch(i){case "form":return `${e}=${l}`;case "label":return `.${l}`;case "matrix":return `;${e}=${l}`;default:return l}}let o=D(i),n=Object.entries(a).map(([s,l])=>y({allowReserved:t,name:i==="deepObject"?`${e}[${s}]`:s,value:l})).join(o);return i==="label"||i==="matrix"?o+n:n};var H=/\{[^{}]+\}/g,B=({path:t,url:r})=>{let e=r,i=r.match(H);if(i)for(let a of i){let o=false,n=a.substring(1,a.length-1),s="simple";n.endsWith("*")&&(o=true,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),s="label"):n.startsWith(";")&&(n=n.substring(1),s="matrix");let l=t[n];if(l==null)continue;if(Array.isArray(l)){e=e.replace(a,q({explode:o,name:n,style:s,value:l}));continue}if(typeof l=="object"){e=e.replace(a,S({explode:o,name:n,style:s,value:l}));continue}if(s==="matrix"){e=e.replace(a,`;${y({name:n,value:l})}`);continue}let f=encodeURIComponent(s==="label"?`.${l}`:l);e=e.replace(a,f);}return e},E=({allowReserved:t,array:r,object:e}={})=>a=>{let o=[];if(a&&typeof a=="object")for(let n in a){let s=a[n];if(s!=null){if(Array.isArray(s)){o=[...o,q({allowReserved:t,explode:true,name:n,style:"form",value:s,...r})];continue}if(typeof s=="object"){o=[...o,S({allowReserved:t,explode:true,name:n,style:"deepObject",value:s,...e})];continue}o=[...o,y({allowReserved:t,name:n,value:s})];}}return o.join("&")},P=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},I=async({security:t,...r})=>{for(let e of t){let i=await A(e,r.auth);if(!i)continue;let a=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[a]=i;break;case "header":default:r.headers.set(a,i);break}return}},O=t=>W({baseUrl:t.baseUrl??"",path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:E(t.querySerializer),url:t.url}),W=({baseUrl:t,path:r,query:e,querySerializer:i,url:a})=>{let o=a.startsWith("/")?a:`/${a}`,n=t+o;r&&(n=B({path:r,url:n}));let s=e?i(e):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(n+=`?${s}`),n},C=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=x(t.headers,r.headers),e},x=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let i=e instanceof Headers?e.entries():Object.entries(e);for(let[a,o]of i)if(o===null)r.delete(a);else if(Array.isArray(o))for(let n of o)r.append(a,n);else o!==undefined&&r.set(a,typeof o=="object"?JSON.stringify(o):o);}return r},h=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let e=this._fns.indexOf(r);e!==-1&&(this._fns=[...this._fns.slice(0,e),...this._fns.slice(e+1)]);}use(r){this._fns=[...this._fns,r];}},v=()=>({error:new h,request:new h,response:new h}),N=E({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),Q={"Content-Type":"application/json"},w=(t={})=>({...R,baseUrl:"",headers:Q,parseAs:"auto",querySerializer:N,...t});var J=(t={})=>{let r=C(w(),t),e=()=>({...r}),i=n=>(r=C(r,n),e()),a=v(),o=async n=>{let s={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:x(r.headers,n.headers)};s.security&&await I({...s,security:s.security}),s.body&&s.bodySerializer&&(s.body=s.bodySerializer(s.body)),s.body||s.headers.delete("Content-Type");let l=O(s),f={redirect:"follow",...s},u=new Request(l,f);for(let p of a.request._fns)u=await p(u,s);let $=s.fetch,c=await $(u);for(let p of a.response._fns)c=await p(c,u,s);let m={request:u,response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return {data:{},...m};let p=(s.parseAs==="auto"?P(c.headers.get("Content-Type")):s.parseAs)??"json";if(p==="stream")return {data:c.body,...m};let b=await c[p]();return p==="json"&&(s.responseValidator&&await s.responseValidator(b),s.responseTransformer&&(b=await s.responseTransformer(b))),{data:b,...m}}let g=await c.text();try{g=JSON.parse(g);}catch{}let d=g;for(let p of a.error._fns)d=await p(g,c,u,s);if(d=d||{},s.throwOnError)throw d;return {error:d,...m}};return {buildUrl:O,connect:n=>o({...n,method:"CONNECT"}),delete:n=>o({...n,method:"DELETE"}),get:n=>o({...n,method:"GET"}),getConfig:e,head:n=>o({...n,method:"HEAD"}),interceptors:a,options:n=>o({...n,method:"OPTIONS"}),patch:n=>o({...n,method:"PATCH"}),post:n=>o({...n,method:"POST"}),put:n=>o({...n,method:"PUT"}),request:o,setConfig:i,trace:n=>o({...n,method:"TRACE"})}};exports.createClient=J;exports.createConfig=w;exports.formDataBodySerializer=T;exports.jsonBodySerializer=R;exports.urlSearchParamsBodySerializer=U;//# sourceMappingURL=index.cjs.map 1 + 'use strict';var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},z=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},j=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},$={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,a])=>{a!=null&&(Array.isArray(a)?a.forEach(i=>z(r,e,i)):z(r,e,a));}),r}},b={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},k={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,a])=>{a!=null&&(Array.isArray(a)?a.forEach(i=>j(r,e,i)):j(r,e,a));}),r}},U=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},_=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},D=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},O=({allowReserved:t,explode:r,name:e,style:a,value:i})=>{if(!r){let s=(t?i:i.map(l=>encodeURIComponent(l))).join(_(a));switch(a){case "label":return `.${s}`;case "matrix":return `;${e}=${s}`;case "simple":return s;default:return `${e}=${s}`}}let o=U(a),n=i.map(s=>a==="label"||a==="simple"?t?s:encodeURIComponent(s):y({allowReserved:t,name:e,value:s})).join(o);return a==="label"||a==="matrix"?o+n:n},y=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},q=({allowReserved:t,explode:r,name:e,style:a,value:i})=>{if(i instanceof Date)return `${e}=${i.toISOString()}`;if(a!=="deepObject"&&!r){let s=[];Object.entries(i).forEach(([f,u])=>{s=[...s,f,t?u:encodeURIComponent(u)];});let l=s.join(",");switch(a){case "form":return `${e}=${l}`;case "label":return `.${l}`;case "matrix":return `;${e}=${l}`;default:return l}}let o=D(a),n=Object.entries(i).map(([s,l])=>y({allowReserved:t,name:a==="deepObject"?`${e}[${s}]`:s,value:l})).join(o);return a==="label"||a==="matrix"?o+n:n};var H=/\{[^{}]+\}/g,B=({path:t,url:r})=>{let e=r,a=r.match(H);if(a)for(let i of a){let o=false,n=i.substring(1,i.length-1),s="simple";n.endsWith("*")&&(o=true,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),s="label"):n.startsWith(";")&&(n=n.substring(1),s="matrix");let l=t[n];if(l==null)continue;if(Array.isArray(l)){e=e.replace(i,O({explode:o,name:n,style:s,value:l}));continue}if(typeof l=="object"){e=e.replace(i,q({explode:o,name:n,style:s,value:l}));continue}if(s==="matrix"){e=e.replace(i,`;${y({name:n,value:l})}`);continue}let f=encodeURIComponent(s==="label"?`.${l}`:l);e=e.replace(i,f);}return e},E=({allowReserved:t,array:r,object:e}={})=>i=>{let o=[];if(i&&typeof i=="object")for(let n in i){let s=i[n];if(s!=null){if(Array.isArray(s)){o=[...o,O({allowReserved:t,explode:true,name:n,style:"form",value:s,...r})];continue}if(typeof s=="object"){o=[...o,q({allowReserved:t,explode:true,name:n,style:"deepObject",value:s,...e})];continue}o=[...o,y({allowReserved:t,name:n,value:s})];}}return o.join("&")},P=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},I=async({security:t,...r})=>{for(let e of t){let a=await A(e,r.auth);if(!a)continue;let i=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[i]=a;break;case "header":default:r.headers.set(i,a);break}return}},S=t=>W({baseUrl:t.baseUrl,path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:E(t.querySerializer),url:t.url}),W=({baseUrl:t,path:r,query:e,querySerializer:a,url:i})=>{let o=i.startsWith("/")?i:`/${i}`,n=(t??"")+o;r&&(n=B({path:r,url:n}));let s=e?a(e):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(n+=`?${s}`),n},C=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=x(t.headers,r.headers),e},x=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let a=e instanceof Headers?e.entries():Object.entries(e);for(let[i,o]of a)if(o===null)r.delete(i);else if(Array.isArray(o))for(let n of o)r.append(i,n);else o!==undefined&&r.set(i,typeof o=="object"?JSON.stringify(o):o);}return r},m=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let e=this._fns.indexOf(r);e!==-1&&(this._fns=[...this._fns.slice(0,e),...this._fns.slice(e+1)]);}use(r){this._fns=[...this._fns,r];}},T=()=>({error:new m,request:new m,response:new m}),N=E({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),Q={"Content-Type":"application/json"},w=(t={})=>({...b,headers:Q,parseAs:"auto",querySerializer:N,...t});var J=(t={})=>{let r=C(w(),t),e=()=>({...r}),a=n=>(r=C(r,n),e()),i=T(),o=async n=>{let s={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:x(r.headers,n.headers)};s.security&&await I({...s,security:s.security}),s.body&&s.bodySerializer&&(s.body=s.bodySerializer(s.body)),s.body||s.headers.delete("Content-Type");let l=S(s),f={redirect:"follow",...s},u=new Request(l,f);for(let p of i.request._fns)u=await p(u,s);let v=s.fetch,c=await v(u);for(let p of i.response._fns)c=await p(c,u,s);let h={request:u,response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return {data:{},...h};let p=(s.parseAs==="auto"?P(c.headers.get("Content-Type")):s.parseAs)??"json";if(p==="stream")return {data:c.body,...h};let R=await c[p]();return p==="json"&&(s.responseValidator&&await s.responseValidator(R),s.responseTransformer&&(R=await s.responseTransformer(R))),{data:R,...h}}let g=await c.text();try{g=JSON.parse(g);}catch{}let d=g;for(let p of i.error._fns)d=await p(g,c,u,s);if(d=d||{},s.throwOnError)throw d;return {error:d,...h}};return {buildUrl:S,connect:n=>o({...n,method:"CONNECT"}),delete:n=>o({...n,method:"DELETE"}),get:n=>o({...n,method:"GET"}),getConfig:e,head:n=>o({...n,method:"HEAD"}),interceptors:i,options:n=>o({...n,method:"OPTIONS"}),patch:n=>o({...n,method:"PATCH"}),post:n=>o({...n,method:"POST"}),put:n=>o({...n,method:"PUT"}),request:o,setConfig:a,trace:n=>o({...n,method:"TRACE"})}};exports.createClient=J;exports.createConfig=w;exports.formDataBodySerializer=$;exports.jsonBodySerializer=b;exports.urlSearchParamsBodySerializer=k;//# sourceMappingURL=index.cjs.map 2 2 //# sourceMappingURL=index.cjs.map
+13 -9
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/bundle/client/index.d.cts
··· 124 124 request: Pick<Interceptors<ReqInterceptor<Req, Options>>, 'eject' | 'use'>; 125 125 response: Pick<Interceptors<ResInterceptor<Res, Req, Options>>, 'eject' | 'use'>; 126 126 } 127 - declare const createConfig: CreateClientConfig; 127 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 128 128 129 - interface Config<ThrowOnError extends boolean = boolean> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 129 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 130 130 /** 131 131 * Base URL for all requests made by this client. 132 - * 133 - * @default '' 134 132 */ 135 - baseUrl?: string; 133 + baseUrl?: T['baseUrl']; 136 134 /** 137 135 * Fetch API implementation. You can use this option to provide a custom 138 136 * fetch instance. ··· 154 152 * 155 153 * @default false 156 154 */ 157 - throwOnError?: ThrowOnError; 155 + throwOnError?: T['throwOnError']; 158 156 } 159 - interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<ThrowOnError> { 157 + interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{ 158 + throwOnError: ThrowOnError; 159 + }> { 160 160 /** 161 161 * Any body that you want to add to your request. 162 162 * ··· 185 185 request: Request; 186 186 response: Response; 187 187 }>; 188 + interface ClientOptions { 189 + baseUrl?: string; 190 + throwOnError?: boolean; 191 + } 188 192 type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 189 193 type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'> & Pick<Required<RequestOptions<ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 190 194 type BuildUrlFn = <TData extends { ··· 204 208 * `setConfig()`. This is useful for example if you're using Next.js 205 209 * to ensure your client always has the correct values. 206 210 */ 207 - type CreateClientConfig = (override?: Config) => Config; 211 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 208 212 interface TDataShape { 209 213 body?: unknown; 210 214 headers?: unknown; ··· 224 228 225 229 declare const createClient: (config?: Config) => Client; 226 230 227 - export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 231 + export { type Auth, type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+13 -9
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/bundle/client/index.d.ts
··· 124 124 request: Pick<Interceptors<ReqInterceptor<Req, Options>>, 'eject' | 'use'>; 125 125 response: Pick<Interceptors<ResInterceptor<Res, Req, Options>>, 'eject' | 'use'>; 126 126 } 127 - declare const createConfig: CreateClientConfig; 127 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 128 128 129 - interface Config<ThrowOnError extends boolean = boolean> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 129 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 130 130 /** 131 131 * Base URL for all requests made by this client. 132 - * 133 - * @default '' 134 132 */ 135 - baseUrl?: string; 133 + baseUrl?: T['baseUrl']; 136 134 /** 137 135 * Fetch API implementation. You can use this option to provide a custom 138 136 * fetch instance. ··· 154 152 * 155 153 * @default false 156 154 */ 157 - throwOnError?: ThrowOnError; 155 + throwOnError?: T['throwOnError']; 158 156 } 159 - interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<ThrowOnError> { 157 + interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{ 158 + throwOnError: ThrowOnError; 159 + }> { 160 160 /** 161 161 * Any body that you want to add to your request. 162 162 * ··· 185 185 request: Request; 186 186 response: Response; 187 187 }>; 188 + interface ClientOptions { 189 + baseUrl?: string; 190 + throwOnError?: boolean; 191 + } 188 192 type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 189 193 type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'> & Pick<Required<RequestOptions<ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 190 194 type BuildUrlFn = <TData extends { ··· 204 208 * `setConfig()`. This is useful for example if you're using Next.js 205 209 * to ensure your client always has the correct values. 206 210 */ 207 - type CreateClientConfig = (override?: Config) => Config; 211 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 208 212 interface TDataShape { 209 213 body?: unknown; 210 214 headers?: unknown; ··· 224 228 225 229 declare const createClient: (config?: Config) => Client; 226 230 227 - export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 231 + export { type Auth, type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/bundle/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/bundle/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from './client'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from './client'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+1 -1
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/bundle/client/index.cjs
··· 1 - 'use strict';var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},z=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},j=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},v={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>z(r,e,a)):z(r,e,i));}),r}},b={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},$={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(a=>j(r,e,a)):j(r,e,i));}),r}},T=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},U=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},k=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},S=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(!r){let s=(t?a:a.map(l=>encodeURIComponent(l))).join(U(i));switch(i){case "label":return `.${s}`;case "matrix":return `;${e}=${s}`;case "simple":return s;default:return `${e}=${s}`}}let o=T(i),n=a.map(s=>i==="label"||i==="simple"?t?s:encodeURIComponent(s):d({allowReserved:t,name:e,value:s})).join(o);return i==="label"||i==="matrix"?o+n:n},d=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},O=({allowReserved:t,explode:r,name:e,style:i,value:a})=>{if(a instanceof Date)return `${e}=${a.toISOString()}`;if(i!=="deepObject"&&!r){let s=[];Object.entries(a).forEach(([p,c])=>{s=[...s,p,t?c:encodeURIComponent(c)];});let l=s.join(",");switch(i){case "form":return `${e}=${l}`;case "label":return `.${l}`;case "matrix":return `;${e}=${l}`;default:return l}}let o=k(i),n=Object.entries(a).map(([s,l])=>d({allowReserved:t,name:i==="deepObject"?`${e}[${s}]`:s,value:l})).join(o);return i==="label"||i==="matrix"?o+n:n};var _=/\{[^{}]+\}/g,D=({path:t,url:r})=>{let e=r,i=r.match(_);if(i)for(let a of i){let o=false,n=a.substring(1,a.length-1),s="simple";n.endsWith("*")&&(o=true,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),s="label"):n.startsWith(";")&&(n=n.substring(1),s="matrix");let l=t[n];if(l==null)continue;if(Array.isArray(l)){e=e.replace(a,S({explode:o,name:n,style:s,value:l}));continue}if(typeof l=="object"){e=e.replace(a,O({explode:o,name:n,style:s,value:l}));continue}if(s==="matrix"){e=e.replace(a,`;${d({name:n,value:l})}`);continue}let p=encodeURIComponent(s==="label"?`.${l}`:l);e=e.replace(a,p);}return e},q=({allowReserved:t,array:r,object:e}={})=>a=>{let o=[];if(a&&typeof a=="object")for(let n in a){let s=a[n];if(s!=null){if(Array.isArray(s)){o=[...o,S({allowReserved:t,explode:true,name:n,style:"form",value:s,...r})];continue}if(typeof s=="object"){o=[...o,O({allowReserved:t,explode:true,name:n,style:"deepObject",value:s,...e})];continue}o=[...o,d({allowReserved:t,name:n,value:s})];}}return o.join("&")},E=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},P=async({security:t,...r})=>{for(let e of t){let i=await A(e,r.auth);if(!i)continue;let a=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[a]=i;break;case "header":default:r.headers.set(a,i);break}return}},R=t=>H({baseUrl:t.baseUrl??"",path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:q(t.querySerializer),url:t.url}),H=({baseUrl:t,path:r,query:e,querySerializer:i,url:a})=>{let o=a.startsWith("/")?a:`/${a}`,n=t+o;r&&(n=D({path:r,url:n}));let s=e?i(e):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(n+=`?${s}`),n},C=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=x(t.headers,r.headers),e},x=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let i=e instanceof Headers?e.entries():Object.entries(e);for(let[a,o]of i)if(o===null)r.delete(a);else if(Array.isArray(o))for(let n of o)r.append(a,n);else o!==undefined&&r.set(a,typeof o=="object"?JSON.stringify(o):o);}return r},y=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let e=this._fns.indexOf(r);e!==-1&&(this._fns=[...this._fns.slice(0,e),...this._fns.slice(e+1)]);}use(r){this._fns=[...this._fns,r];}},I=()=>({error:new y,request:new y,response:new y}),B=q({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),W={"Content-Type":"application/json"},w=(t={})=>({...b,baseUrl:"",headers:W,parseAs:"auto",querySerializer:B,...t});var N=(t={})=>{let r=C(w(),t),e=()=>({...r}),i=n=>(r=C(r,n),e()),a=I(),o=async n=>{let s={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:x(r.headers,n.headers)};s.security&&await P({...s,security:s.security}),s.body&&s.bodySerializer&&(s.body=s.bodySerializer(s.body)),s.body||s.headers.delete("Content-Type");for(let u of a.request._fns)await u(s);let l=R(s),p=s.fetch,c=await p(l,{...s,body:s.body});for(let u of a.response._fns)c=await u(c,s);let h={response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return {data:{},...h};let u=(s.parseAs==="auto"?E(c.headers.get("Content-Type")):s.parseAs)??"json";if(u==="stream")return {data:c.body,...h};let g=await c[u]();return u==="json"&&(s.responseValidator&&await s.responseValidator(g),s.responseTransformer&&(g=await s.responseTransformer(g))),{data:g,...h}}let m=await c.text();try{m=JSON.parse(m);}catch{}let f=m;for(let u of a.error._fns)f=await u(m,c,s);if(f=f||{},s.throwOnError)throw f;return {error:f,...h}};return {buildUrl:R,connect:n=>o({...n,method:"CONNECT"}),delete:n=>o({...n,method:"DELETE"}),get:n=>o({...n,method:"GET"}),getConfig:e,head:n=>o({...n,method:"HEAD"}),interceptors:a,options:n=>o({...n,method:"OPTIONS"}),patch:n=>o({...n,method:"PATCH"}),post:n=>o({...n,method:"POST"}),put:n=>o({...n,method:"PUT"}),request:o,setConfig:i,trace:n=>o({...n,method:"TRACE"})}};exports.createClient=N;exports.createConfig=w;exports.formDataBodySerializer=v;exports.jsonBodySerializer=b;exports.urlSearchParamsBodySerializer=$;//# sourceMappingURL=index.cjs.map 1 + 'use strict';var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e},z=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},j=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},v={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,a])=>{a!=null&&(Array.isArray(a)?a.forEach(i=>z(r,e,i)):z(r,e,a));}),r}},b={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},T={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,a])=>{a!=null&&(Array.isArray(a)?a.forEach(i=>j(r,e,i)):j(r,e,a));}),r}},$=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},k=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},U=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},O=({allowReserved:t,explode:r,name:e,style:a,value:i})=>{if(!r){let s=(t?i:i.map(l=>encodeURIComponent(l))).join(k(a));switch(a){case "label":return `.${s}`;case "matrix":return `;${e}=${s}`;case "simple":return s;default:return `${e}=${s}`}}let o=$(a),n=i.map(s=>a==="label"||a==="simple"?t?s:encodeURIComponent(s):d({allowReserved:t,name:e,value:s})).join(o);return a==="label"||a==="matrix"?o+n:n},d=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},S=({allowReserved:t,explode:r,name:e,style:a,value:i})=>{if(i instanceof Date)return `${e}=${i.toISOString()}`;if(a!=="deepObject"&&!r){let s=[];Object.entries(i).forEach(([p,c])=>{s=[...s,p,t?c:encodeURIComponent(c)];});let l=s.join(",");switch(a){case "form":return `${e}=${l}`;case "label":return `.${l}`;case "matrix":return `;${e}=${l}`;default:return l}}let o=U(a),n=Object.entries(i).map(([s,l])=>d({allowReserved:t,name:a==="deepObject"?`${e}[${s}]`:s,value:l})).join(o);return a==="label"||a==="matrix"?o+n:n};var _=/\{[^{}]+\}/g,D=({path:t,url:r})=>{let e=r,a=r.match(_);if(a)for(let i of a){let o=false,n=i.substring(1,i.length-1),s="simple";n.endsWith("*")&&(o=true,n=n.substring(0,n.length-1)),n.startsWith(".")?(n=n.substring(1),s="label"):n.startsWith(";")&&(n=n.substring(1),s="matrix");let l=t[n];if(l==null)continue;if(Array.isArray(l)){e=e.replace(i,O({explode:o,name:n,style:s,value:l}));continue}if(typeof l=="object"){e=e.replace(i,S({explode:o,name:n,style:s,value:l}));continue}if(s==="matrix"){e=e.replace(i,`;${d({name:n,value:l})}`);continue}let p=encodeURIComponent(s==="label"?`.${l}`:l);e=e.replace(i,p);}return e},q=({allowReserved:t,array:r,object:e}={})=>i=>{let o=[];if(i&&typeof i=="object")for(let n in i){let s=i[n];if(s!=null){if(Array.isArray(s)){o=[...o,O({allowReserved:t,explode:true,name:n,style:"form",value:s,...r})];continue}if(typeof s=="object"){o=[...o,S({allowReserved:t,explode:true,name:n,style:"deepObject",value:s,...e})];continue}o=[...o,d({allowReserved:t,name:n,value:s})];}}return o.join("&")},E=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},P=async({security:t,...r})=>{for(let e of t){let a=await A(e,r.auth);if(!a)continue;let i=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[i]=a;break;case "header":default:r.headers.set(i,a);break}return}},C=t=>H({baseUrl:t.baseUrl,path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:q(t.querySerializer),url:t.url}),H=({baseUrl:t,path:r,query:e,querySerializer:a,url:i})=>{let o=i.startsWith("/")?i:`/${i}`,n=(t??"")+o;r&&(n=D({path:r,url:n}));let s=e?a(e):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(n+=`?${s}`),n},R=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=x(t.headers,r.headers),e},x=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let a=e instanceof Headers?e.entries():Object.entries(e);for(let[i,o]of a)if(o===null)r.delete(i);else if(Array.isArray(o))for(let n of o)r.append(i,n);else o!==undefined&&r.set(i,typeof o=="object"?JSON.stringify(o):o);}return r},y=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}exists(r){return this._fns.indexOf(r)!==-1}eject(r){let e=this._fns.indexOf(r);e!==-1&&(this._fns=[...this._fns.slice(0,e),...this._fns.slice(e+1)]);}use(r){this._fns=[...this._fns,r];}},I=()=>({error:new y,request:new y,response:new y}),B=q({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),W={"Content-Type":"application/json"},w=(t={})=>({...b,headers:W,parseAs:"auto",querySerializer:B,...t});var N=(t={})=>{let r=R(w(),t),e=()=>({...r}),a=n=>(r=R(r,n),e()),i=I(),o=async n=>{let s={...r,...n,fetch:n.fetch??r.fetch??globalThis.fetch,headers:x(r.headers,n.headers)};s.security&&await P({...s,security:s.security}),s.body&&s.bodySerializer&&(s.body=s.bodySerializer(s.body)),s.body||s.headers.delete("Content-Type");for(let u of i.request._fns)await u(s);let l=C(s),p=s.fetch,c=await p(l,{...s,body:s.body});for(let u of i.response._fns)c=await u(c,s);let m={response:c};if(c.ok){if(c.status===204||c.headers.get("Content-Length")==="0")return {data:{},...m};let u=(s.parseAs==="auto"?E(c.headers.get("Content-Type")):s.parseAs)??"json";if(u==="stream")return {data:c.body,...m};let g=await c[u]();return u==="json"&&(s.responseValidator&&await s.responseValidator(g),s.responseTransformer&&(g=await s.responseTransformer(g))),{data:g,...m}}let h=await c.text();try{h=JSON.parse(h);}catch{}let f=h;for(let u of i.error._fns)f=await u(h,c,s);if(f=f||{},s.throwOnError)throw f;return {error:f,...m}};return {buildUrl:C,connect:n=>o({...n,method:"CONNECT"}),delete:n=>o({...n,method:"DELETE"}),get:n=>o({...n,method:"GET"}),getConfig:e,head:n=>o({...n,method:"HEAD"}),interceptors:i,options:n=>o({...n,method:"OPTIONS"}),patch:n=>o({...n,method:"PATCH"}),post:n=>o({...n,method:"POST"}),put:n=>o({...n,method:"PUT"}),request:o,setConfig:a,trace:n=>o({...n,method:"TRACE"})}};exports.createClient=N;exports.createConfig=w;exports.formDataBodySerializer=v;exports.jsonBodySerializer=b;exports.urlSearchParamsBodySerializer=T;//# sourceMappingURL=index.cjs.map 2 2 //# sourceMappingURL=index.cjs.map
+13 -9
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/bundle/client/index.d.cts
··· 124 124 request: Pick<Interceptors<ReqInterceptor<Options>>, 'eject' | 'use'>; 125 125 response: Pick<Interceptors<ResInterceptor<Res, Options>>, 'eject' | 'use'>; 126 126 } 127 - declare const createConfig: CreateClientConfig; 127 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 128 128 129 - interface Config<ThrowOnError extends boolean = boolean> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 129 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 130 130 /** 131 131 * Base URL for all requests made by this client. 132 - * 133 - * @default '' 134 132 */ 135 - baseUrl?: string; 133 + baseUrl?: T['baseUrl']; 136 134 /** 137 135 * Fetch API implementation. You can use this option to provide a custom 138 136 * fetch instance. ··· 154 152 * 155 153 * @default false 156 154 */ 157 - throwOnError?: ThrowOnError; 155 + throwOnError?: T['throwOnError']; 158 156 } 159 - interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<ThrowOnError> { 157 + interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{ 158 + throwOnError: ThrowOnError; 159 + }> { 160 160 /** 161 161 * Any body that you want to add to your request. 162 162 * ··· 183 183 }) & { 184 184 response: Response; 185 185 }>; 186 + interface ClientOptions { 187 + baseUrl?: string; 188 + throwOnError?: boolean; 189 + } 186 190 type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 187 191 type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'> & Pick<Required<RequestOptions<ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 188 192 type BuildUrlFn = <TData extends { ··· 202 206 * `setConfig()`. This is useful for example if you're using Next.js 203 207 * to ensure your client always has the correct values. 204 208 */ 205 - type CreateClientConfig = (override?: Config) => Config; 209 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 206 210 interface TDataShape { 207 211 body?: unknown; 208 212 headers?: unknown; ··· 222 226 223 227 declare const createClient: (config?: Config) => Client; 224 228 225 - export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 229 + export { type Auth, type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+13 -9
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/bundle/client/index.d.ts
··· 124 124 request: Pick<Interceptors<ReqInterceptor<Options>>, 'eject' | 'use'>; 125 125 response: Pick<Interceptors<ResInterceptor<Res, Options>>, 'eject' | 'use'>; 126 126 } 127 - declare const createConfig: CreateClientConfig; 127 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 128 128 129 - interface Config<ThrowOnError extends boolean = boolean> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 129 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 { 130 130 /** 131 131 * Base URL for all requests made by this client. 132 - * 133 - * @default '' 134 132 */ 135 - baseUrl?: string; 133 + baseUrl?: T['baseUrl']; 136 134 /** 137 135 * Fetch API implementation. You can use this option to provide a custom 138 136 * fetch instance. ··· 154 152 * 155 153 * @default false 156 154 */ 157 - throwOnError?: ThrowOnError; 155 + throwOnError?: T['throwOnError']; 158 156 } 159 - interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<ThrowOnError> { 157 + interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{ 158 + throwOnError: ThrowOnError; 159 + }> { 160 160 /** 161 161 * Any body that you want to add to your request. 162 162 * ··· 183 183 }) & { 184 184 response: Response; 185 185 }>; 186 + interface ClientOptions { 187 + baseUrl?: string; 188 + throwOnError?: boolean; 189 + } 186 190 type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 187 191 type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'> & Pick<Required<RequestOptions<ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>; 188 192 type BuildUrlFn = <TData extends { ··· 202 206 * `setConfig()`. This is useful for example if you're using Next.js 203 207 * to ensure your client always has the correct values. 204 208 */ 205 - type CreateClientConfig = (override?: Config) => Config; 209 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 206 210 interface TDataShape { 207 211 body?: unknown; 208 212 headers?: unknown; ··· 222 226 223 227 declare const createClient: (config?: Config) => Client; 224 228 225 - export { type Auth, type Client, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 229 + export { type Auth, type Client, type ClientOptions, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/bundle/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-next'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-next'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-next'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-next'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-next'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-next'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/bundle/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from './client'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from './client'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+1 -1
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/bundle/client/index.cjs
··· 1 - 'use strict';var app=require('nuxt/app'),vue=require('vue');var E=async(r,t)=>{let e=typeof t=="function"?await t(r):t;if(e)return r.scheme==="bearer"?`Bearer ${e}`:r.scheme==="basic"?`Basic ${btoa(e)}`:e},$=(r,t,e)=>{typeof e=="string"||e instanceof Blob?r.append(t,e):r.append(t,JSON.stringify(e));},k=(r,t,e)=>{typeof e=="string"?r.append(t,e):r.append(t,JSON.stringify(e));},F={bodySerializer:r=>{let t=new FormData;return Object.entries(r).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(o=>$(t,e,o)):$(t,e,i));}),t}},C={bodySerializer:r=>JSON.stringify(r,(t,e)=>typeof e=="bigint"?e.toString():e)},N={bodySerializer:r=>{let t=new URLSearchParams;return Object.entries(r).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(o=>k(t,e,o)):k(t,e,i));}),t}},I=r=>{switch(r){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},Q=r=>{switch(r){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},V=r=>{switch(r){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},S=({allowReserved:r,explode:t,name:e,style:i,value:o})=>{if(!t){let n=(r?o:o.map(u=>encodeURIComponent(u))).join(Q(i));switch(i){case "label":return `.${n}`;case "matrix":return `;${e}=${n}`;case "simple":return n;default:return `${e}=${n}`}}let a=I(i),s=o.map(n=>i==="label"||i==="simple"?r?n:encodeURIComponent(n):p({allowReserved:r,name:e,value:n})).join(a);return i==="label"||i==="matrix"?a+s:s},p=({allowReserved:r,name:t,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${t}=${r?e:encodeURIComponent(e)}`},z=({allowReserved:r,explode:t,name:e,style:i,value:o})=>{if(o instanceof Date)return `${e}=${o.toISOString()}`;if(i!=="deepObject"&&!t){let n=[];Object.entries(o).forEach(([l,d])=>{n=[...n,l,r?d:encodeURIComponent(d)];});let u=n.join(",");switch(i){case "form":return `${e}=${u}`;case "label":return `.${u}`;case "matrix":return `;${e}=${u}`;default:return u}}let a=V(i),s=Object.entries(o).map(([n,u])=>p({allowReserved:r,name:i==="deepObject"?`${e}[${n}]`:n,value:u})).join(a);return i==="label"||i==="matrix"?a+s:s};var W=/\{[^{}]+\}/g,J=({path:r,url:t})=>{let e=t,i=t.match(W);if(i)for(let o of i){let a=false,s=o.substring(1,o.length-1),n="simple";s.endsWith("*")&&(a=true,s=s.substring(0,s.length-1)),s.startsWith(".")?(s=s.substring(1),n="label"):s.startsWith(";")&&(s=s.substring(1),n="matrix");let u=vue.toValue(vue.toValue(r)[s]);if(u==null)continue;if(Array.isArray(u)){e=e.replace(o,S({explode:a,name:s,style:n,value:u}));continue}if(typeof u=="object"){e=e.replace(o,z({explode:a,name:s,style:n,value:u}));continue}if(n==="matrix"){e=e.replace(o,`;${p({name:s,value:u})}`);continue}let l=encodeURIComponent(n==="label"?`.${u}`:u);e=e.replace(o,l);}return e},v=({allowReserved:r,array:t,object:e}={})=>o=>{let a=[],s=vue.toValue(o);if(s&&typeof s=="object")for(let n in s){let u=vue.toValue(s[n]);if(u!=null){if(Array.isArray(u)){a=[...a,S({allowReserved:r,explode:true,name:n,style:"form",value:u,...t})];continue}if(typeof u=="object"){a=[...a,z({allowReserved:r,explode:true,name:n,style:"deepObject",value:u,...e})];continue}a=[...a,p({allowReserved:r,name:n,value:u})];}}return a.join("&")},B=async({security:r,...t})=>{for(let e of r){let i=await E(e,t.auth);if(!i)continue;let o=e.name??"Authorization";switch(e.in){case "query":t.query||(t.query={}),vue.toValue(t.query)[o]=i;break;case "header":default:t.headers.set(o,i);break}return}},h=r=>M({baseUrl:r.baseURL??"",path:r.path,query:r.query,querySerializer:typeof r.querySerializer=="function"?r.querySerializer:v(r.querySerializer),url:r.url}),M=({baseUrl:r,path:t,query:e,querySerializer:i,url:o})=>{let a=o.startsWith("/")?o:`/${o}`,s=r+a;t&&(s=J({path:t,url:s}));let n=e?i(e):"";return n.startsWith("?")&&(n=n.substring(1)),n&&(s+=`?${n}`),s},T=(r,t)=>{let e={...r,...t};return e.baseURL?.endsWith("/")&&(e.baseURL=e.baseURL.substring(0,e.baseURL.length-1)),e.headers=w(r.headers,t.headers),e},w=(...r)=>{let t=new Headers;for(let e of r){if(!e||typeof e!="object")continue;let i=e;vue.isRef(i)&&(i=vue.unref(i));let o=i instanceof Headers?i.entries():Object.entries(i);for(let[a,s]of o)if(s===null)t.delete(a);else if(Array.isArray(s))for(let n of s)t.append(a,y(n));else if(s!==undefined){let n=y(s);t.set(a,typeof n=="object"?JSON.stringify(n):n);}}return t},q=(...r)=>r.reduce((t,e)=>{if(typeof e=="function")t.push(e);else if(Array.isArray(e))return t.concat(e);return t},[]),_=v({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),K={"Content-Type":"application/json"},P=(r={})=>({...C,baseURL:"",headers:K,querySerializer:_,...r}),y=r=>{if(r===null||typeof r!="object"||r instanceof Headers)return vue.isRef(r)?vue.unref(r):r;if(Array.isArray(r))return r.map(e=>y(e));if(vue.isRef(r))return y(vue.unref(r));let t={};for(let e in r)t[e]=y(r[e]);return t},g=r=>r.body&&r.bodySerializer?r.bodySerializer(r.body):r.body,O=(r,t)=>{let e=y(r);return e.body=g(e),t(h(r),e)};var re=(r={})=>{let t=T(P(),r),e=()=>({...t}),i=a=>(t=T(t,a),e()),o=({asyncDataOptions:a,composable:s,key:n,...u})=>{let l={...t,...u,$fetch:u.$fetch??t.$fetch??$fetch,headers:w(t.headers,u.headers),onRequest:q(t.onRequest,u.onRequest),onResponse:q(t.onResponse,u.onResponse)},{responseTransformer:d,responseValidator:R,security:j}=l;j&&(l.onRequest=[async({options:c})=>{await B({auth:l.auth,headers:c.headers,query:c.query,security:j});},...l.onRequest]),(d||R)&&(l.onResponse=[...l.onResponse,async({options:c,response:f})=>{c.responseType&&c.responseType!=="json"||f.ok&&(R&&await R(f._data),d&&(f._data=await d(f._data)));}]),l.body||l.headers.delete("Content-Type");let U=l.$fetch;if(s==="$fetch")return O(l,U);if(s==="useFetch"||s==="useLazyFetch"){let c=vue.reactive({body:l.body,bodySerializer:l.bodySerializer}),f=vue.ref(g(l));return l.body=f,vue.watch(c,D=>{f.value=g(D);}),s==="useLazyFetch"?app.useLazyFetch(()=>h(l),l):app.useFetch(()=>h(l),l)}let b=()=>O(l,U);if(s==="useAsyncData")return n?app.useAsyncData(n,b,a):app.useAsyncData(b,a);if(s==="useLazyAsyncData")return n?app.useLazyAsyncData(n,b,a):app.useLazyAsyncData(b,a)};return {buildUrl:h,connect:a=>o({...a,method:"CONNECT"}),delete:a=>o({...a,method:"DELETE"}),get:a=>o({...a,method:"GET"}),getConfig:e,head:a=>o({...a,method:"HEAD"}),options:a=>o({...a,method:"OPTIONS"}),patch:a=>o({...a,method:"PATCH"}),post:a=>o({...a,method:"POST"}),put:a=>o({...a,method:"PUT"}),request:o,setConfig:i,trace:a=>o({...a,method:"TRACE"})}};exports.createClient=re;exports.createConfig=P;exports.formDataBodySerializer=F;exports.jsonBodySerializer=C;exports.urlSearchParamsBodySerializer=N;//# sourceMappingURL=index.cjs.map 1 + 'use strict';var app=require('nuxt/app'),vue=require('vue');var E=async(r,t)=>{let e=typeof t=="function"?await t(r):t;if(e)return r.scheme==="bearer"?`Bearer ${e}`:r.scheme==="basic"?`Basic ${btoa(e)}`:e},U=(r,t,e)=>{typeof e=="string"||e instanceof Blob?r.append(t,e):r.append(t,JSON.stringify(e));},k=(r,t,e)=>{typeof e=="string"?r.append(t,e):r.append(t,JSON.stringify(e));},F={bodySerializer:r=>{let t=new FormData;return Object.entries(r).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(o=>U(t,e,o)):U(t,e,i));}),t}},C={bodySerializer:r=>JSON.stringify(r,(t,e)=>typeof e=="bigint"?e.toString():e)},N={bodySerializer:r=>{let t=new URLSearchParams;return Object.entries(r).forEach(([e,i])=>{i!=null&&(Array.isArray(i)?i.forEach(o=>k(t,e,o)):k(t,e,i));}),t}},I=r=>{switch(r){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},Q=r=>{switch(r){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},V=r=>{switch(r){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},S=({allowReserved:r,explode:t,name:e,style:i,value:o})=>{if(!t){let a=(r?o:o.map(u=>encodeURIComponent(u))).join(Q(i));switch(i){case "label":return `.${a}`;case "matrix":return `;${e}=${a}`;case "simple":return a;default:return `${e}=${a}`}}let n=I(i),s=o.map(a=>i==="label"||i==="simple"?r?a:encodeURIComponent(a):p({allowReserved:r,name:e,value:a})).join(n);return i==="label"||i==="matrix"?n+s:s},p=({allowReserved:r,name:t,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${t}=${r?e:encodeURIComponent(e)}`},z=({allowReserved:r,explode:t,name:e,style:i,value:o})=>{if(o instanceof Date)return `${e}=${o.toISOString()}`;if(i!=="deepObject"&&!t){let a=[];Object.entries(o).forEach(([l,d])=>{a=[...a,l,r?d:encodeURIComponent(d)];});let u=a.join(",");switch(i){case "form":return `${e}=${u}`;case "label":return `.${u}`;case "matrix":return `;${e}=${u}`;default:return u}}let n=V(i),s=Object.entries(o).map(([a,u])=>p({allowReserved:r,name:i==="deepObject"?`${e}[${a}]`:a,value:u})).join(n);return i==="label"||i==="matrix"?n+s:s};var W=/\{[^{}]+\}/g,J=({path:r,url:t})=>{let e=t,i=t.match(W);if(i)for(let o of i){let n=false,s=o.substring(1,o.length-1),a="simple";s.endsWith("*")&&(n=true,s=s.substring(0,s.length-1)),s.startsWith(".")?(s=s.substring(1),a="label"):s.startsWith(";")&&(s=s.substring(1),a="matrix");let u=vue.toValue(vue.toValue(r)[s]);if(u==null)continue;if(Array.isArray(u)){e=e.replace(o,S({explode:n,name:s,style:a,value:u}));continue}if(typeof u=="object"){e=e.replace(o,z({explode:n,name:s,style:a,value:u}));continue}if(a==="matrix"){e=e.replace(o,`;${p({name:s,value:u})}`);continue}let l=encodeURIComponent(a==="label"?`.${u}`:u);e=e.replace(o,l);}return e},v=({allowReserved:r,array:t,object:e}={})=>o=>{let n=[],s=vue.toValue(o);if(s&&typeof s=="object")for(let a in s){let u=vue.toValue(s[a]);if(u!=null){if(Array.isArray(u)){n=[...n,S({allowReserved:r,explode:true,name:a,style:"form",value:u,...t})];continue}if(typeof u=="object"){n=[...n,z({allowReserved:r,explode:true,name:a,style:"deepObject",value:u,...e})];continue}n=[...n,p({allowReserved:r,name:a,value:u})];}}return n.join("&")},B=async({security:r,...t})=>{for(let e of r){let i=await E(e,t.auth);if(!i)continue;let o=e.name??"Authorization";switch(e.in){case "query":t.query||(t.query={}),vue.toValue(t.query)[o]=i;break;case "header":default:t.headers.set(o,i);break}return}},h=r=>M({baseUrl:r.baseURL,path:r.path,query:r.query,querySerializer:typeof r.querySerializer=="function"?r.querySerializer:v(r.querySerializer),url:r.url}),M=({baseUrl:r,path:t,query:e,querySerializer:i,url:o})=>{let n=o.startsWith("/")?o:`/${o}`,s=(r??"")+n;t&&(s=J({path:t,url:s}));let a=e?i(e):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(s+=`?${a}`),s},A=(r,t)=>{let e={...r,...t};return e.baseURL?.endsWith("/")&&(e.baseURL=e.baseURL.substring(0,e.baseURL.length-1)),e.headers=O(r.headers,t.headers),e},O=(...r)=>{let t=new Headers;for(let e of r){if(!e||typeof e!="object")continue;let i=e;vue.isRef(i)&&(i=vue.unref(i));let o=i instanceof Headers?i.entries():Object.entries(i);for(let[n,s]of o)if(s===null)t.delete(n);else if(Array.isArray(s))for(let a of s)t.append(n,y(a));else if(s!==undefined){let a=y(s);t.set(n,typeof a=="object"?JSON.stringify(a):a);}}return t},w=(...r)=>r.reduce((t,e)=>{if(typeof e=="function")t.push(e);else if(Array.isArray(e))return t.concat(e);return t},[]),_=v({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),K={"Content-Type":"application/json"},q=(r={})=>({...C,headers:K,querySerializer:_,...r}),y=r=>{if(r===null||typeof r!="object"||r instanceof Headers)return vue.isRef(r)?vue.unref(r):r;if(Array.isArray(r))return r.map(e=>y(e));if(vue.isRef(r))return y(vue.unref(r));let t={};for(let e in r)t[e]=y(r[e]);return t},g=r=>r.body&&r.bodySerializer?r.bodySerializer(r.body):r.body,P=(r,t)=>{let e=y(r);return e.body=g(e),t(h(r),e)};var re=(r={})=>{let t=A(q(),r),e=()=>({...t}),i=n=>(t=A(t,n),e()),o=({asyncDataOptions:n,composable:s,key:a,...u})=>{let l={...t,...u,$fetch:u.$fetch??t.$fetch??$fetch,headers:O(t.headers,u.headers),onRequest:w(t.onRequest,u.onRequest),onResponse:w(t.onResponse,u.onResponse)},{responseTransformer:d,responseValidator:R,security:j}=l;j&&(l.onRequest=[async({options:c})=>{await B({auth:l.auth,headers:c.headers,query:c.query,security:j});},...l.onRequest]),(d||R)&&(l.onResponse=[...l.onResponse,async({options:c,response:f})=>{c.responseType&&c.responseType!=="json"||f.ok&&(R&&await R(f._data),d&&(f._data=await d(f._data)));}]),l.body||l.headers.delete("Content-Type");let $=l.$fetch;if(s==="$fetch")return P(l,$);if(s==="useFetch"||s==="useLazyFetch"){let c=vue.reactive({body:l.body,bodySerializer:l.bodySerializer}),f=vue.ref(g(l));return l.body=f,vue.watch(c,D=>{f.value=g(D);}),s==="useLazyFetch"?app.useLazyFetch(()=>h(l),l):app.useFetch(()=>h(l),l)}let b=()=>P(l,$);if(s==="useAsyncData")return a?app.useAsyncData(a,b,n):app.useAsyncData(b,n);if(s==="useLazyAsyncData")return a?app.useLazyAsyncData(a,b,n):app.useLazyAsyncData(b,n)};return {buildUrl:h,connect:n=>o({...n,method:"CONNECT"}),delete:n=>o({...n,method:"DELETE"}),get:n=>o({...n,method:"GET"}),getConfig:e,head:n=>o({...n,method:"HEAD"}),options:n=>o({...n,method:"OPTIONS"}),patch:n=>o({...n,method:"PATCH"}),post:n=>o({...n,method:"POST"}),put:n=>o({...n,method:"PUT"}),request:o,setConfig:i,trace:n=>o({...n,method:"TRACE"})}};exports.createClient=re;exports.createConfig=q;exports.formDataBodySerializer=F;exports.jsonBodySerializer=C;exports.urlSearchParamsBodySerializer=N;//# sourceMappingURL=index.cjs.map 2 2 //# sourceMappingURL=index.cjs.map
+8 -7
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/bundle/client/index.d.cts
··· 115 115 type WithRefs<TData> = { 116 116 [K in keyof TData]: NonNullable<TData[K]> extends object ? WithRefs<NonNullable<TData[K]>> | Ref<NonNullable<TData[K]>> : NonNullable<TData[K]> | Ref<NonNullable<TData[K]>>; 117 117 }; 118 - interface Config extends Omit<FetchOptions<unknown>, 'baseURL' | 'body' | 'headers' | 'method' | 'query'>, WithRefs<Pick<FetchOptions<unknown>, 'query'>>, Omit<Config$1, 'querySerializer'> { 118 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<FetchOptions<unknown>, 'baseURL' | 'body' | 'headers' | 'method' | 'query'>, WithRefs<Pick<FetchOptions<unknown>, 'query'>>, Omit<Config$1, 'querySerializer'> { 119 119 /** 120 120 * Base URL for all requests made by this client. 121 - * 122 - * @default '' 123 121 */ 124 - baseURL?: string; 122 + baseURL?: T['baseURL']; 125 123 /** 126 124 * A function for serializing request query parameters. By default, arrays 127 125 * will be exploded in form style, objects will be exploded in deepObject ··· 151 149 url: Url; 152 150 } 153 151 type RequestResult<TComposable extends Composable, TData, TError> = TComposable extends '$fetch' ? ReturnType<typeof $fetch<TData>> : TComposable extends 'useAsyncData' ? ReturnType<typeof useAsyncData<TData | null, TError>> : TComposable extends 'useFetch' ? ReturnType<typeof useFetch<TData | null, TError>> : TComposable extends 'useLazyAsyncData' ? ReturnType<typeof useLazyAsyncData<TData | null, TError>> : TComposable extends 'useLazyFetch' ? ReturnType<typeof useLazyFetch<TData | null, TError>> : never; 152 + interface ClientOptions { 153 + baseURL?: string; 154 + } 154 155 type MethodFn = <TComposable extends Composable, TData = unknown, TError = unknown>(options: Omit<RequestOptions<TComposable>, 'method'>) => RequestResult<TComposable, TData, TError>; 155 156 type RequestFn = <TComposable extends Composable, TData = unknown, TError = unknown>(options: Omit<RequestOptions<TComposable>, 'method'> & Pick<Required<RequestOptions<TComposable>>, 'method'>) => RequestResult<TComposable, TData, TError>; 156 157 /** ··· 161 162 * `setConfig()`. This is useful for example if you're using Next.js 162 163 * to ensure your client always has the correct values. 163 164 */ 164 - type CreateClientConfig = (override?: Config) => Config; 165 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 165 166 interface TDataShape { 166 167 body?: unknown; 167 168 headers?: unknown; ··· 186 187 187 188 declare const createClient: (config?: Config) => Client; 188 189 189 - declare const createConfig: CreateClientConfig; 190 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 190 191 191 - export { type Auth, type Client, type Composable, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 192 + export { type Auth, type Client, type ClientOptions, type Composable, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+8 -7
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/bundle/client/index.d.ts
··· 115 115 type WithRefs<TData> = { 116 116 [K in keyof TData]: NonNullable<TData[K]> extends object ? WithRefs<NonNullable<TData[K]>> | Ref<NonNullable<TData[K]>> : NonNullable<TData[K]> | Ref<NonNullable<TData[K]>>; 117 117 }; 118 - interface Config extends Omit<FetchOptions<unknown>, 'baseURL' | 'body' | 'headers' | 'method' | 'query'>, WithRefs<Pick<FetchOptions<unknown>, 'query'>>, Omit<Config$1, 'querySerializer'> { 118 + interface Config<T extends ClientOptions = ClientOptions> extends Omit<FetchOptions<unknown>, 'baseURL' | 'body' | 'headers' | 'method' | 'query'>, WithRefs<Pick<FetchOptions<unknown>, 'query'>>, Omit<Config$1, 'querySerializer'> { 119 119 /** 120 120 * Base URL for all requests made by this client. 121 - * 122 - * @default '' 123 121 */ 124 - baseURL?: string; 122 + baseURL?: T['baseURL']; 125 123 /** 126 124 * A function for serializing request query parameters. By default, arrays 127 125 * will be exploded in form style, objects will be exploded in deepObject ··· 151 149 url: Url; 152 150 } 153 151 type RequestResult<TComposable extends Composable, TData, TError> = TComposable extends '$fetch' ? ReturnType<typeof $fetch<TData>> : TComposable extends 'useAsyncData' ? ReturnType<typeof useAsyncData<TData | null, TError>> : TComposable extends 'useFetch' ? ReturnType<typeof useFetch<TData | null, TError>> : TComposable extends 'useLazyAsyncData' ? ReturnType<typeof useLazyAsyncData<TData | null, TError>> : TComposable extends 'useLazyFetch' ? ReturnType<typeof useLazyFetch<TData | null, TError>> : never; 152 + interface ClientOptions { 153 + baseURL?: string; 154 + } 154 155 type MethodFn = <TComposable extends Composable, TData = unknown, TError = unknown>(options: Omit<RequestOptions<TComposable>, 'method'>) => RequestResult<TComposable, TData, TError>; 155 156 type RequestFn = <TComposable extends Composable, TData = unknown, TError = unknown>(options: Omit<RequestOptions<TComposable>, 'method'> & Pick<Required<RequestOptions<TComposable>>, 'method'>) => RequestResult<TComposable, TData, TError>; 156 157 /** ··· 161 162 * `setConfig()`. This is useful for example if you're using Next.js 162 163 * to ensure your client always has the correct values. 163 164 */ 164 - type CreateClientConfig = (override?: Config) => Config; 165 + type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>; 165 166 interface TDataShape { 166 167 body?: unknown; 167 168 headers?: unknown; ··· 186 187 187 188 declare const createClient: (config?: Config) => Client; 188 189 189 - declare const createConfig: CreateClientConfig; 190 + declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>; 190 191 191 - export { type Auth, type Client, type Composable, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer }; 192 + export { type Auth, type Client, type ClientOptions, type Composable, type Config, type CreateClientConfig, type Options, type OptionsLegacyParser, type QuerySerializerOptions, type RequestOptions, type RequestResult, type TDataShape, createClient, createConfig, formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/bundle/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-nuxt'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-nuxt'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-nuxt'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-nuxt'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-nuxt'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-nuxt'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/components-request-bodies/types.gen.ts
··· 22 22 * OK 23 23 */ 24 24 200: unknown; 25 + }; 26 + 27 + export type ClientOptions = { 28 + baseUrl: string; 25 29 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/const/types.gen.ts
··· 14 14 200: 'First line.\n\nSecond line.\n\nPS: I love you.'; 15 15 }; 16 16 17 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 17 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: string; 21 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/content-binary/types.gen.ts
··· 24 24 200: Blob | File; 25 25 }; 26 26 27 - export type GetBarResponse = GetBarResponses[keyof GetBarResponses]; 27 + export type GetBarResponse = GetBarResponses[keyof GetBarResponses]; 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-all-of/types.gen.ts
··· 42 42 id: 'QuxMapped'; 43 43 } & { 44 44 qux?: boolean; 45 + }; 46 + 47 + export type ClientOptions = { 48 + baseUrl: string; 45 49 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-any-of/types.gen.ts
··· 21 21 type?: 'bar'; 22 22 } & Bar) | ({ 23 23 type?: 'baz'; 24 - } & Baz); 24 + } & Baz); 25 + 26 + export type ClientOptions = { 27 + baseUrl: string; 28 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/discriminator-one-of/types.gen.ts
··· 21 21 type?: 'bar'; 22 22 } & Bar) | ({ 23 23 type?: 'baz'; 24 - } & Baz); 24 + } & Baz); 25 + 26 + export type ClientOptions = { 27 + baseUrl: string; 28 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/duplicate-null/types.gen.ts
··· 3 3 /** 4 4 * should not produce duplicate null 5 5 */ 6 - export type WeirdEnum = '' | string | null; 6 + export type WeirdEnum = '' | string | null; 7 + 8 + export type ClientOptions = { 9 + baseUrl: string; 10 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-escape/types.gen.ts
··· 4 4 foo?: "foo'bar" | 'foo"bar'; 5 5 }; 6 6 7 - export type Bar = "foo'bar" | 'foo"bar'; 7 + export type Bar = "foo'bar" | 'foo"bar'; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 11 + };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/enum-inline-javascript/types.gen.ts
··· 9 9 10 10 export type Foo = { 11 11 type?: 'foo' | 'bar'; 12 + }; 13 + 14 + export type ClientOptions = { 15 + baseUrl: string; 12 16 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/enum-inline-typescript-namespace/types.gen.ts
··· 9 9 10 10 export type Foo = { 11 11 type?: 'foo' | 'bar'; 12 + }; 13 + 14 + export type ClientOptions = { 15 + baseUrl: string; 12 16 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/enum-inline-typescript/types.gen.ts
··· 7 7 8 8 export type Foo = { 9 9 type?: 'foo' | 'bar'; 10 + }; 11 + 12 + export type ClientOptions = { 13 + baseUrl: string; 10 14 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/enum-inline/types.gen.ts
··· 4 4 5 5 export type Foo = { 6 6 type?: 'foo' | 'bar'; 7 + }; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 7 11 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-javascript-PascalCase/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-javascript-camelCase/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-javascript-preserve/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-javascript-snake_case/types.gen.ts
··· 41 41 '-100': -100, 42 42 '-200': -200, 43 43 '-300': -300 44 - } as const; 44 + } as const; 45 + 46 + export type ClientOptions = { 47 + baseUrl: string; 48 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-typescript-PascalCase/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-typescript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-typescript-camelCase/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-typescript-preserve/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values-typescript-snake_case/types.gen.ts
··· 24 24 '_-100' = -100, 25 25 '_-200' = -200, 26 26 '_-300' = -300 27 - } 27 + } 28 + 29 + export type ClientOptions = { 30 + baseUrl: string; 31 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-names-values/types.gen.ts
··· 8 8 9 9 export type Foo = 'foo' | 'bar' | null | '' | true | false; 10 10 11 - export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 11 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 15 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/enum-null/types.gen.ts
··· 4 4 5 5 export type Bar = 'foo' | 'bar'; 6 6 7 - export type Baz = 'foo' | 'bar'; 7 + export type Baz = 'foo' | 'bar'; 8 + 9 + export type ClientOptions = { 10 + baseUrl: string; 11 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/internal-name-conflict/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/internal-name-conflict/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/object-properties-all-of/types.gen.ts
··· 8 8 foo: string; 9 9 bar?: string; 10 10 baz?: string; 11 + }; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 11 15 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/object-properties-any-of/types.gen.ts
··· 8 8 foo: string; 9 9 bar?: string; 10 10 baz?: string; 11 + }; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 11 15 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/object-properties-one-of/types.gen.ts
··· 8 8 foo: string; 9 9 bar?: string; 10 10 baz?: string; 11 + }; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 11 15 };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/operation-204/types.gen.ts
··· 18 18 204: void; 19 19 }; 20 20 21 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 21 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 22 + 23 + export type ClientOptions = { 24 + baseUrl: string; 25 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/pagination-ref-any-of/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/pagination-ref-any-of/types.gen.ts
··· 16 16 * OK 17 17 */ 18 18 200: unknown; 19 + }; 20 + 21 + export type ClientOptions = { 22 + baseUrl: string; 19 23 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/parameter-explode-false-axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/parameter-explode-false-axios/types.gen.ts
··· 14 14 * OK 15 15 */ 16 16 default: unknown; 17 + }; 18 + 19 + export type ClientOptions = { 20 + baseURL: string; 17 21 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/parameter-explode-false/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/parameter-explode-false/types.gen.ts
··· 14 14 * OK 15 15 */ 16 16 default: unknown; 17 + }; 18 + 19 + export type ClientOptions = { 20 + baseUrl: string; 17 21 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig({ 16 + export const client = createClient(createConfig<ClientOptions>({ 6 17 throwOnError: true 7 18 }));
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format/types.gen.ts
··· 25 25 200: Foo; 26 26 }; 27 27 28 - export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 28 + export type PostFooResponse = PostFooResponses[keyof PostFooResponses]; 29 + 30 + export type ClientOptions = { 31 + baseUrl: string; 32 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-axios'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-axios'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseURL: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/plugins/fastify/default/types.gen.ts
··· 1936 1936 path?: never; 1937 1937 query?: never; 1938 1938 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1939 + }; 1940 + 1941 + export type ClientOptions = { 1942 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1939 1943 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/required-all-of-ref/types.gen.ts
··· 9 9 bar: number; 10 10 foo: string; 11 11 baz: string; 12 + }; 13 + 14 + export type ClientOptions = { 15 + baseUrl: string; 12 16 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/required-any-of-ref/types.gen.ts
··· 7 7 8 8 export type Bar = Foo & { 9 9 bar: number; 10 + }; 11 + 12 + export type ClientOptions = { 13 + baseUrl: string; 10 14 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/required-one-of-ref/types.gen.ts
··· 7 7 8 8 export type Bar = Foo & { 9 9 bar: number; 10 + }; 11 + 12 + export type ClientOptions = { 13 + baseUrl: string; 10 14 };
+4
packages/openapi-ts/test/__snapshots__/3.1.x/schema-const/types.gen.ts
··· 16 16 [key: string]: unknown; 17 17 }; 18 18 garply?: 10n; 19 + }; 20 + 21 + export type ClientOptions = { 22 + baseUrl: string; 19 23 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/security-api-key/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/security-api-key/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/security-false/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/security-false/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/security-http-bearer/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/security-http-bearer/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/security-oauth2/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/security-oauth2/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/security-open-id-connect/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/3.1.x/security-open-id-connect/types.gen.ts
··· 12 12 * OK 13 13 */ 14 14 200: unknown; 15 + }; 16 + 17 + export type ClientOptions = { 18 + baseUrl: string; 15 19 };
+16
packages/openapi-ts/test/__snapshots__/3.1.x/servers/client.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 15 + 16 + export const client = createClient(createConfig<ClientOptions>());
+2
packages/openapi-ts/test/__snapshots__/3.1.x/servers/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+21
packages/openapi-ts/test/__snapshots__/3.1.x/servers/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type GetFooData = { 4 + body?: never; 5 + path?: never; 6 + query?: never; 7 + url: '/foo'; 8 + }; 9 + 10 + export type GetFooResponses = { 11 + /** 12 + * OK 13 + */ 14 + 200: string; 15 + }; 16 + 17 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 18 + 19 + export type ClientOptions = { 20 + baseUrl: 'https://foo.com/v1' | `${string}://${string}/v1` | (string & {}); 21 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/transformers-all-of/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/transformers-all-of/types.gen.ts
··· 39 39 200: Foo; 40 40 }; 41 41 42 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 42 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 43 + 44 + export type ClientOptions = { 45 + baseUrl: string; 46 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/transformers-any-of-null/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/transformers-any-of-null/types.gen.ts
··· 20 20 200: Array<Foo>; 21 21 }; 22 22 23 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 23 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 24 + 25 + export type ClientOptions = { 26 + baseUrl: string; 27 + };
+13 -2
packages/openapi-ts/test/__snapshots__/3.1.x/transformers-array/client.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/transformers-array/types.gen.ts
··· 18 18 }; 19 19 }; 20 20 21 - export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 21 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 22 + 23 + export type ClientOptions = { 24 + baseUrl: string; 25 + };
+5 -1
packages/openapi-ts/test/__snapshots__/3.1.x/type-invalid/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - export type Foo = unknown; 3 + export type Foo = unknown; 4 + 5 + export type ClientOptions = { 6 + baseUrl: string; 7 + };
+4
packages/openapi-ts/test/__snapshots__/test/generated/v3-types-PascalCase/types.gen.ts.snap
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+13 -2
packages/openapi-ts/test/__snapshots__/test/generated/v3_no_index/client.gen.ts.snap
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { createClient, createConfig } from '@hey-api/client-fetch'; 3 + import { createClient, createConfig, type Config, type ClientOptions as DefaultClientOptions } from '@hey-api/client-fetch'; 4 + import type { ClientOptions } from './types.gen'; 5 + 6 + /** 7 + * The `createClientConfig()` function will be called on client initialization 8 + * and the returned object will become the client's initial configuration. 9 + * 10 + * You may want to initialize your client this way instead of calling 11 + * `setConfig()`. This is useful for example if you're using Next.js 12 + * to ensure your client always has the correct values. 13 + */ 14 + export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> = (override?: Config<DefaultClientOptions & T>) => Config<Required<DefaultClientOptions> & T>; 4 15 5 - export const client = createClient(createConfig()); 16 + export const client = createClient(createConfig<ClientOptions>());
+4
packages/openapi-ts/test/__snapshots__/test/generated/v3_no_index/types.gen.ts.snap
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+4
packages/openapi-ts/test/__snapshots__/test/generated/v3_types/types.gen.ts.snap
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+4
packages/openapi-ts/test/__snapshots__/test/generated/v3_types_no_tree/types.gen.ts.snap
··· 1926 1926 path?: never; 1927 1927 query?: never; 1928 1928 url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串'; 1929 + }; 1930 + 1931 + export type ClientOptions = { 1932 + baseUrl: 'http://localhost:3000/base' | (string & {}); 1929 1933 };
+1 -1
packages/openapi-ts/test/openapi-ts.config.ts
··· 6 6 // exclude: '^#/components/schemas/ModelWithCircularReference$', 7 7 // include: 8 8 // '^(#/components/schemas/import|#/paths/api/v{api-version}/simple/options)$', 9 - path: './packages/openapi-ts/test/spec/3.1.x/servers.yaml', 9 + path: './packages/openapi-ts/test/spec/3.0.x/servers.yaml', 10 10 // path: './test/spec/v3-transforms.json', 11 11 // path: 'https://mongodb-mms-prod-build-server.s3.amazonaws.com/openapi/2caffd88277a4e27c95dcefc7e3b6a63a3b03297-v2-2023-11-15.json', 12 12 // path: 'https://raw.githubusercontent.com/swagger-api/swagger-petstore/master/src/main/resources/openapi.yaml',
+15
packages/openapi-ts/test/spec/2.0.x/servers-base-path.yaml
··· 1 + swagger: '2.0' 2 + info: 3 + title: OpenAPI 2.0 servers base path example 4 + version: '1' 5 + basePath: /v1 6 + paths: 7 + /foo: 8 + get: 9 + produces: 10 + - application/json 11 + responses: 12 + '200': 13 + description: OK 14 + schema: 15 + type: string
+15
packages/openapi-ts/test/spec/2.0.x/servers-host.yaml
··· 1 + swagger: '2.0' 2 + info: 3 + title: OpenAPI 2.0 servers host example 4 + version: '1' 5 + host: foo.com 6 + paths: 7 + /foo: 8 + get: 9 + produces: 10 + - application/json 11 + responses: 12 + '200': 13 + description: OK 14 + schema: 15 + type: string
+18
packages/openapi-ts/test/spec/2.0.x/servers.yaml
··· 1 + swagger: '2.0' 2 + info: 3 + title: OpenAPI 2.0 servers example 4 + version: '1' 5 + host: foo.com 6 + basePath: /v1 7 + schemes: 8 + - https 9 + paths: 10 + /foo: 11 + get: 12 + produces: 13 + - application/json 14 + responses: 15 + '200': 16 + description: OK 17 + schema: 18 + type: string
+18
packages/openapi-ts/test/spec/3.0.x/servers.yaml
··· 1 + openapi: 3.0.4 2 + info: 3 + title: OpenAPI 3.0.4 servers example 4 + version: 1 5 + servers: 6 + - url: https://foo.com/v1 7 + description: foo 8 + - url: /v1 9 + paths: 10 + /foo: 11 + get: 12 + responses: 13 + '200': 14 + content: 15 + '*/*': 16 + schema: 17 + type: string 18 + description: OK
+3 -6
packages/openapi-ts/test/spec/3.1.x/servers.yaml
··· 3 3 title: OpenAPI 3.1.1 servers example 4 4 version: 1 5 5 servers: 6 - - url: https://development.gigantic-server.com/v1 7 - description: Development server 8 - - url: https://staging.gigantic-server.com/v1 9 - description: Staging server 10 - - url: https://api.gigantic-server.com/v1 11 - description: Production server 6 + - url: https://foo.com/v1 7 + description: foo 8 + - url: /v1 12 9 paths: 13 10 /foo: 14 11 get: