From 3fce9f79be300f8c75509ad8639d1f294f6a10cf Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Sat, 13 Apr 2024 16:35:46 +0200 Subject: [PATCH 1/4] fix: Give format precendence over type property --- packages/swagger-faker/src/fakerParser.tsx | 3 +- packages/swagger-ts/mocks/typeAssertions.yaml | 52 +++++++ .../swagger-ts/src/SchemaGenerator.test.tsx | 94 ++++++++++++ .../SchemaGenerator.test.tsx.snap | 66 ++++++++ .../src/__snapshots__/typeParser.test.ts.snap | 1 + packages/swagger-ts/src/typeParser.ts | 10 +- .../src/__snapshots__/zodParser.test.ts.snap | 4 +- packages/swagger-zod/src/zodParser.tsx | 8 +- packages/swagger/mocks/schemas.ts | 33 ++-- packages/swagger/src/SchemaGenerator.ts | 144 ++++++++++-------- packages/swagger/src/SchemaMapper.ts | 9 +- 11 files changed, 329 insertions(+), 95 deletions(-) create mode 100644 packages/swagger-ts/mocks/typeAssertions.yaml diff --git a/packages/swagger-faker/src/fakerParser.tsx b/packages/swagger-faker/src/fakerParser.tsx index df9aa9b7c..e2471210b 100644 --- a/packages/swagger-faker/src/fakerParser.tsx +++ b/packages/swagger-faker/src/fakerParser.tsx @@ -84,8 +84,7 @@ export const fakerKeywordMapper = { strict: undefined, deprecated: undefined, example: undefined, - type: undefined, - format: undefined, + schema: undefined, catchall: undefined, } satisfies SchemaMapper diff --git a/packages/swagger-ts/mocks/typeAssertions.yaml b/packages/swagger-ts/mocks/typeAssertions.yaml new file mode 100644 index 000000000..6e35dc5e6 --- /dev/null +++ b/packages/swagger-ts/mocks/typeAssertions.yaml @@ -0,0 +1,52 @@ +info: + title: Type Assertions +openapi: 3.1.0 +paths: {} +components: + schemas: + Body_upload_file_api_assets_post: + properties: + file: + format: binary + title: File + type: string + required: + - file + title: Body_upload_file_api_assets_post + type: object + $comment: | + export type BodyUploadFileApiAssetsPost = { + /** + * @type string binary + */ + file: Blob; + }; + Plain_file: + format: binary + title: File + type: string + $comment: export type PlainFile = Blob; + Plain_date: + format: date + title: Date + type: string + $comment: export type PlainDate = Date; + Plain_time: + format: time + title: Time + type: number + $comment: export type PlainTime = number; + Plain_date_time: + format: date-time + title: Datetime + type: string + $comment: + Plain_email: + format: email + title: Email + type: string + Plain_uuid: + format: uuid + title: UUID + type: string + diff --git a/packages/swagger-ts/src/SchemaGenerator.test.tsx b/packages/swagger-ts/src/SchemaGenerator.test.tsx index 0da0bf9c8..496257ff7 100644 --- a/packages/swagger-ts/src/SchemaGenerator.test.tsx +++ b/packages/swagger-ts/src/SchemaGenerator.test.tsx @@ -611,3 +611,97 @@ describe('SchemaGenerator enums', async () => { expect(node).toMatchSnapshot() }) }) + +describe('TypeGenerator type assertions', async () => { + const schemaPath = path.resolve(__dirname, '../mocks/typeAssertions.yaml') + const oas = await new OasManager().parse(schemaPath) + + const defaultGenerator = new SchemaGenerator( + { + usedEnumNames: {}, + enumType: 'asConst', + enumSuffix: '', + dateType: 'string', + optionalType: 'questionToken', + transformers: {}, + oasType: false, + unknownType: 'any', + override: [], + }, + { + oas, + pluginManager: mockedPluginManager, + plugin: {} as Plugin, + contentType: undefined, + include: undefined, + mode: 'split', + override: [], + }, + ) + + const schemas = oas.getDefinition().components?.schemas + + test('generates file property with `File` type', async () => { + const node = defaultGenerator.buildSource('Body_upload_file_api_assets_post', schemas?.Body_upload_file_api_assets_post as SchemaObject) + + expect(node).toMatchSnapshot() + }) + + test('generates Plain_File types correctly', async () => { + const node = defaultGenerator.buildSource('Plain_file', schemas?.Plain_file as SchemaObject) + + expect(node).toMatchSnapshot() + }) + + test('generates Date type correctly when dateType = string', async () => { + const node = defaultGenerator.buildSource('Plain_date', schemas?.Plain_date as SchemaObject) + + expect(node).toMatchSnapshot() + }) + + test('generates Date type correctly when dateType = date', async () => { + const generator = new SchemaGenerator( + { + usedEnumNames: {}, + enumType: 'asConst', + enumSuffix: '', + dateType: 'date', + optionalType: 'questionToken', + transformers: {}, + oasType: false, + unknownType: 'any', + override: [], + }, + { + oas, + pluginManager: mockedPluginManager, + plugin: {} as Plugin, + contentType: undefined, + include: undefined, + mode: 'split', + override: [], + }, + ) + const node = defaultGenerator.buildSource('Plain_date', schemas?.Plain_date as SchemaObject) + + expect(node).toMatchSnapshot() + }) + + test('generates Time type correctly', async () => { + const node = defaultGenerator.buildSource('Plain_time', schemas?.Plain_time as SchemaObject) + + expect(node).toMatchSnapshot() + }) + + test('generates Email type correctly', async () => { + const node = defaultGenerator.buildSource('Plain_email', schemas?.Plain_email as SchemaObject) + + expect(node).toMatchSnapshot() + }) + + test('generates UUID type correctly', async () => { + const node = defaultGenerator.buildSource('Plain_uuid', schemas?.Plain_uuid as SchemaObject) + + expect(node).toMatchSnapshot() + }) +}) diff --git a/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap b/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap index f54bc8caa..7a572a19d 100644 --- a/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap +++ b/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap @@ -37,6 +37,9 @@ exports[`SchemaGenerator discriminator > Dog.type defined as const 1`] = ` exports[`SchemaGenerator discriminator > MixedValueTypeConst ignores type constraint in favor of const constraint 1`] = ` [ "export type MixedValueTypeConst = { + /** + * @type number | undefined + */ foobar?: "foobar"; }; ", @@ -55,6 +58,9 @@ exports[`SchemaGenerator discriminator > NullConst correctly produces "null" 1`] exports[`SchemaGenerator discriminator > NumberValueConst const correctly produces \`42\` 1`] = ` [ "export type NumberValueConst = { + /** + * @type number | undefined + */ foobar?: 42; }; ", @@ -80,6 +86,9 @@ exports[`SchemaGenerator discriminator > PetStore defined as array with type uni exports[`SchemaGenerator discriminator > StringValueConst const correctly produces "foobar" 1`] = ` [ "export type StringValueConst = { + /** + * @type string | undefined + */ foobar?: "foobar"; }; ", @@ -110,6 +119,9 @@ exports[`SchemaGenerator enums > generate enum Array 1`] = ` } as const; export type EnumArrayIdentifier = (typeof enumArrayIdentifier)[keyof typeof enumArrayIdentifier]; export type enumArray = { + /** + * @type array | undefined + */ identifier?: [ number, string, @@ -236,6 +248,60 @@ exports[`SchemaGenerator petStoreRef > generate type for Pets 1`] = ` ] `; +exports[`TypeGenerator type assertions > generates Date type correctly when dateType = date 1`] = ` +[ + "export type Plain_date = string; +", +] +`; + +exports[`TypeGenerator type assertions > generates Date type correctly when dateType = string 1`] = ` +[ + "export type Plain_date = string; +", +] +`; + +exports[`TypeGenerator type assertions > generates Email type correctly 1`] = ` +[ + "export type Plain_email = string; +", +] +`; + +exports[`TypeGenerator type assertions > generates Plain_File types correctly 1`] = ` +[ + "export type Plain_file = string; +", +] +`; + +exports[`TypeGenerator type assertions > generates Time type correctly 1`] = ` +[ + "export type Plain_time = number; +", +] +`; + +exports[`TypeGenerator type assertions > generates UUID type correctly 1`] = ` +[ + "export type Plain_uuid = string; +", +] +`; + +exports[`TypeGenerator type assertions > generates file property with \`File\` type 1`] = ` +[ + "export type Body_upload_file_api_assets_post = { + /** + * @type string binary + */ + file: string; +}; +", +] +`; + exports[`TypeScript SchemaGenerator petStore > generate type for Pet with optionalType \`questionToken\` 1`] = ` [ "export type Pet = { diff --git a/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap b/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap index 9fef0d6ea..2dffbcd8e 100644 --- a/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap +++ b/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap @@ -134,6 +134,7 @@ exports[`parseTypeMeta > 'objectEnum' 1`] = ` "{ /** * @description Your address + * @type string string */ version: Enum; } diff --git a/packages/swagger-ts/src/typeParser.ts b/packages/swagger-ts/src/typeParser.ts index 930d34923..eca5dc8b3 100644 --- a/packages/swagger-ts/src/typeParser.ts +++ b/packages/swagger-ts/src/typeParser.ts @@ -103,8 +103,7 @@ export const typeKeywordMapper = { blob: () => factory.createTypeReferenceNode('Blob', []), deprecated: undefined, example: undefined, - type: undefined, - format: undefined, + schema: undefined, catchall: undefined, } satisfies SchemaMapper @@ -181,8 +180,7 @@ export function parseTypeMeta(parent: Schema | undefined, current: Schema, optio const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined - const typeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.type) as SchemaKeywordMapper['type'] | undefined - const formatSchema = schemas.find((schema) => schema.keyword === schemaKeywords.format) as SchemaKeywordMapper['format'] | undefined + const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined let type = schemas.map((schema) => parseTypeMeta(current, schema, options)).filter(Boolean)[0] as ts.TypeNode @@ -218,7 +216,9 @@ export function parseTypeMeta(parent: Schema | undefined, current: Schema, optio deprecatedSchema ? '@deprecated' : undefined, defaultSchema ? `@default ${defaultSchema.args}` : undefined, exampleSchema ? `@example ${exampleSchema.args}` : undefined, - typeSchema ? `@type ${typeSchema.args}${!isOptional ? '' : ' | undefined'} ${formatSchema?.args || ''}` : undefined, + schemaSchema?.args?.type || schemaSchema?.args?.format + ? `@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'} ${schemaSchema?.args?.format || ''}` + : undefined, ].filter(Boolean), }) }) diff --git a/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap b/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap index eb2caae1b..127d7da74 100644 --- a/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap +++ b/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap @@ -22,7 +22,7 @@ exports[`parseZodMeta > 'catchall' 1`] = `"z.object({}).catchall(z.lazy(() => Pe exports[`parseZodMeta > 'date' 1`] = `"z.date()"`; -exports[`parseZodMeta > 'datetime' 1`] = `"z.string().datetime()"`; +exports[`parseZodMeta > 'datetime' 1`] = `".datetime()"`; exports[`parseZodMeta > 'default' 1`] = `".default()"`; @@ -58,7 +58,7 @@ exports[`parseZodMeta > 'ref' 1`] = `"z.lazy(() => Pet).schema"`; exports[`parseZodMeta > 'string' 1`] = `"z.string()"`; -exports[`parseZodMeta > 'stringOffset' 1`] = `"z.string().datetime({ offset: true })"`; +exports[`parseZodMeta > 'stringOffset' 1`] = `".datetime({ offset: true })"`; exports[`parseZodMeta > 'tuple' 1`] = `"z.tuple([])"`; diff --git a/packages/swagger-zod/src/zodParser.tsx b/packages/swagger-zod/src/zodParser.tsx index 9168c519f..9207f9fcd 100644 --- a/packages/swagger-zod/src/zodParser.tsx +++ b/packages/swagger-zod/src/zodParser.tsx @@ -1,5 +1,5 @@ import transformers, { createJSDocBlockText } from '@kubb/core/transformers' -import { SchemaGenerator, isKeyword, schemaKeywords } from '@kubb/swagger' +import { isKeyword, schemaKeywords } from '@kubb/swagger' import type { Schema, SchemaKeywordBase, SchemaMapper } from '@kubb/swagger' @@ -30,7 +30,7 @@ export const zodKeywordMapper = { enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`, union: (items: string[] = []) => `z.union([${items?.join(', ')}])`, const: (value?: string | number) => `z.literal(${value ?? ''})`, - datetime: (offset = false) => (offset ? `z.string().datetime({ offset: ${offset} })` : 'z.string().datetime()'), + datetime: (offset = false) => (offset ? `.datetime({ offset: ${offset} })` : '.datetime()'), date: () => 'z.date()', uuid: () => '.uuid()', url: () => '.url()', @@ -52,8 +52,7 @@ export const zodKeywordMapper = { blob: undefined, deprecated: undefined, example: undefined, - type: undefined, - format: undefined, + schema: undefined, catchall: (value?: string) => (value ? `.catchall(${value})` : undefined), } satisfies SchemaMapper @@ -64,6 +63,7 @@ export const zodKeywordMapper = { function sort(items?: Schema[]): Schema[] { const order: string[] = [ schemaKeywords.string, + schemaKeywords.datetime, schemaKeywords.number, schemaKeywords.object, schemaKeywords.enum, diff --git a/packages/swagger/mocks/schemas.ts b/packages/swagger/mocks/schemas.ts index 43c095b52..1fefd590f 100644 --- a/packages/swagger/mocks/schemas.ts +++ b/packages/swagger/mocks/schemas.ts @@ -328,8 +328,11 @@ const basic: Array<{ name: string; schema: Schema }> = [ properties: { version: [ { - keyword: schemaKeywords.format, - args: 'string', + keyword: schemaKeywords.schema, + args: { + format: 'string', + type: 'string', + }, }, { keyword: schemaKeywords.enum, @@ -445,8 +448,10 @@ const full: Array<{ name: string; schema: Schema[] }> = [ name: 'Order', schema: [ { - keyword: schemaKeywords.type, - args: 'object', + keyword: schemaKeywords.schema, + args: { + type: 'object', + }, }, { keyword: schemaKeywords.object, @@ -484,12 +489,11 @@ const full: Array<{ name: string; schema: Schema[] }> = [ keyword: schemaKeywords.integer, }, { - keyword: schemaKeywords.type, - args: 'integer', - }, - { - keyword: schemaKeywords.format, - args: 'int32', + keyword: schemaKeywords.schema, + args: { + type: 'integer', + format: 'int32', + }, }, { keyword: schemaKeywords.optional, @@ -498,11 +502,14 @@ const full: Array<{ name: string; schema: Schema[] }> = [ }, }, { - keyword: 'type', - args: 'object', + keyword: schemaKeywords.schema, + args: { + type: 'integer', + format: 'int32', + }, }, { - keyword: 'optional', + keyword: schemaKeywords.optional, }, ], }, diff --git a/packages/swagger/src/SchemaGenerator.ts b/packages/swagger/src/SchemaGenerator.ts index ba42f4257..41edb393e 100644 --- a/packages/swagger/src/SchemaGenerator.ts +++ b/packages/swagger/src/SchemaGenerator.ts @@ -2,7 +2,7 @@ import { Generator } from '@kubb/core' import transformers, { pascalCase } from '@kubb/core/transformers' import { getUniqueName } from '@kubb/core/utils' -import { isNumber } from 'remeda' +import { equals, isDeepEqual, isNumber, uniqueWith } from 'remeda' import { isKeyword, schemaKeywords } from './SchemaMapper.ts' import { getSchemaFactory } from './utils/getSchemaFactory.ts' import { getSchemas } from './utils/getSchemas.ts' @@ -72,7 +72,9 @@ export abstract class SchemaGenerator< buildSchemas(schema: SchemaObject | undefined, baseName?: string): Schema[] { const options = this.#getOptions(schema, baseName) - return options.transformers?.schema?.(schema, baseName) || this.#parseSchemaObject(schema, baseName) || [] + const schemas = options.transformers?.schema?.(schema, baseName) || this.#parseSchemaObject(schema, baseName) || [] + + return uniqueWith(schemas, isDeepEqual) } deepSearch(schemas: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T][] { @@ -339,7 +341,15 @@ export abstract class SchemaGenerator< return [{ keyword: unknownReturn }] } - const baseItems: Schema[] = [] + const baseItems: Schema[] = [ + { + keyword: schemaKeywords.schema, + args: { + type: schema.type as any, + format: schema.format, + }, + }, + ] const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined const nullable = schema.nullable ?? schema['x-nullable'] ?? false @@ -366,19 +376,11 @@ export abstract class SchemaGenerator< }) } - if (schema.type) { - baseItems.push({ - keyword: schemaKeywords.type, - args: schema.type as string, + if (schema.pattern) { + baseItems.unshift({ + keyword: schemaKeywords.matches, + args: schema.pattern, }) - - if (Array.isArray(schema.type)) { - const [_schema, nullable] = schema.type - - if (nullable === 'null') { - baseItems.push({ keyword: schemaKeywords.nullable }) - } - } } if (max !== undefined) { @@ -389,14 +391,18 @@ export abstract class SchemaGenerator< baseItems.unshift({ keyword: schemaKeywords.min, args: min }) } - if (schema.format) { - baseItems.push({ keyword: schemaKeywords.format, args: schema.format }) - } - if (nullable) { baseItems.push({ keyword: schemaKeywords.nullable }) } + if (schema.type && Array.isArray(schema.type)) { + const [_schema, nullable] = schema.type + + if (nullable === 'null') { + baseItems.push({ keyword: schemaKeywords.nullable }) + } + } + if (schema.readOnly) { baseItems.push({ keyword: schemaKeywords.readOnly }) } @@ -582,6 +588,7 @@ export abstract class SchemaGenerator< }) .filter(Boolean), }, + ...baseItems, ] } @@ -619,11 +626,67 @@ export abstract class SchemaGenerator< value: schema['const'], }, }, + ...baseItems, ] } return [{ keyword: schemaKeywords.null }] } + /** + * > Structural validation alone may be insufficient to allow an application to correctly utilize certain values. The "format" + * > annotation keyword is defined to allow schema authors to convey semantic information for a fixed subset of values which are + * > accurately described by authoritative resources, be they RFCs or other external specifications. + * + * In other words: format is more specific than type alone, hence it should override the type value, if possible. + * + * see also https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7 + */ + if (schema.format) { + switch (schema.format) { + case 'binary': + baseItems.push({ keyword: schemaKeywords.blob }) + break + case 'date-time': + case 'date': + case 'time': + if (options.dateType) { + if (options.dateType === 'date') { + baseItems.unshift({ keyword: schemaKeywords.date }) + break + } + + if (options.dateType === 'stringOffset') { + baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } }) + break + } + + baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } }) + } + break + case 'uuid': + baseItems.unshift({ keyword: schemaKeywords.uuid }) + break + case 'email': + case 'idn-email': + baseItems.unshift({ keyword: schemaKeywords.email }) + break + case 'uri': + case 'ipv4': + case 'ipv6': + case 'uri-reference': + case 'hostname': + case 'idn-hostname': + baseItems.unshift({ keyword: schemaKeywords.url }) + break + // case 'duration': + // case 'json-pointer': + // case 'relative-json-pointer': + default: + // formats not yet implemented: ignore. + break + } + } + if (schema.type) { if (Array.isArray(schema.type)) { // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0 @@ -641,53 +704,10 @@ export abstract class SchemaGenerator< ].filter(Boolean) } - if (schema.pattern) { - baseItems.unshift({ - keyword: schemaKeywords.matches, - args: schema.pattern, - }) - } - - if (options.dateType && ['date', 'date-time'].some((item) => item === schema.format)) { - if (options.dateType === 'date') { - baseItems.unshift({ keyword: schemaKeywords.date }) - - return baseItems - } - - if (options.dateType === 'stringOffset') { - baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } }) - - return baseItems - } - - baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } }) - - return baseItems - } - - if (schema.format === 'email') { - baseItems.unshift({ keyword: schemaKeywords.email }) - } - - if (schema.format === 'uri' || schema.format === 'hostname') { - baseItems.unshift({ keyword: schemaKeywords.url }) - } - - if (schema.format === 'uuid') { - baseItems.unshift({ keyword: schemaKeywords.uuid }) - } - // string, boolean, null, number if (schema.type in schemaKeywords) { return [{ keyword: schema.type }, ...baseItems] } - - return baseItems - } - - if (schema.format === 'binary') { - return [{ keyword: schemaKeywords.blob }] } return [{ keyword: unknownReturn }] diff --git a/packages/swagger/src/SchemaMapper.ts b/packages/swagger/src/SchemaMapper.ts index 80b56376f..dbe8c09d0 100644 --- a/packages/swagger/src/SchemaMapper.ts +++ b/packages/swagger/src/SchemaMapper.ts @@ -71,11 +71,7 @@ export type SchemaKeywordMapper = { any: { keyword: 'any' } unknown: { keyword: 'unknown' } blob: { keyword: 'blob' } - type: { - keyword: 'type' - args: string - } - format: { keyword: 'format'; args: string } + schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } } catchall: { keyword: 'catchall' } } @@ -121,8 +117,7 @@ export const schemaKeywords = { blob: 'blob', deprecated: 'deprecated', example: 'example', - type: 'type', - format: 'format', + schema: 'schema', catchall: 'catchall', } satisfies { [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword'] From 225a2df59f36e56b3bf50972bfee9c803a4e2762 Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Sat, 13 Apr 2024 17:04:43 +0200 Subject: [PATCH 2/4] chore: update examples --- .changeset/green-tips-hope.md | 9 + .../src/gen/models/ts/AddPetRequest.ts | 2 +- .../advanced/src/gen/models/ts/ApiResponse.ts | 2 +- .../advanced/src/gen/models/ts/Category.ts | 2 +- .../advanced/src/gen/models/ts/Customer.ts | 2 +- examples/advanced/src/gen/models/ts/Order.ts | 8 +- examples/advanced/src/gen/models/ts/Pet.ts | 2 +- .../advanced/src/gen/models/ts/PetNotFound.ts | 2 +- examples/advanced/src/gen/models/ts/User.ts | 4 +- .../src/gen/models/ts/petController/AddPet.ts | 2 +- .../gen/models/ts/petController/DeletePet.ts | 2 +- .../gen/models/ts/petController/GetPetById.ts | 2 +- .../ts/petController/UpdatePetWithForm.ts | 2 +- .../gen/models/ts/petController/UploadFile.ts | 2 +- .../models/ts/storeController/DeleteOrder.ts | 2 +- .../models/ts/storeController/GetOrderById.ts | 2 +- .../advanced/src/gen/models/ts/tag/Tag.ts | 2 +- .../client/src/gen/models/ts/AddPetRequest.ts | 2 +- .../client/src/gen/models/ts/ApiResponse.ts | 2 +- examples/client/src/gen/models/ts/Category.ts | 2 +- examples/client/src/gen/models/ts/Customer.ts | 2 +- examples/client/src/gen/models/ts/Order.ts | 8 +- examples/client/src/gen/models/ts/Pet.ts | 2 +- .../client/src/gen/models/ts/PetNotFound.ts | 2 +- examples/client/src/gen/models/ts/Tag.ts | 2 +- examples/client/src/gen/models/ts/User.ts | 4 +- .../src/gen/models/ts/petController/AddPet.ts | 2 +- .../gen/models/ts/petController/DeletePet.ts | 2 +- .../gen/models/ts/petController/GetPetById.ts | 2 +- .../ts/petController/UpdatePetWithForm.ts | 2 +- .../gen/models/ts/petController/UploadFile.ts | 2 +- .../models/ts/storeController/DeleteOrder.ts | 2 +- .../models/ts/storeController/GetOrderById.ts | 2 +- examples/faker/src/gen/models/Address.ts | 3 + examples/faker/src/gen/models/ApiResponse.ts | 2 +- examples/faker/src/gen/models/Category.ts | 2 +- examples/faker/src/gen/models/Customer.ts | 2 +- examples/faker/src/gen/models/DeleteOrder.ts | 2 +- examples/faker/src/gen/models/DeletePet.ts | 2 +- examples/faker/src/gen/models/GetOrderById.ts | 2 +- examples/faker/src/gen/models/GetPetById.ts | 2 +- examples/faker/src/gen/models/Order.ts | 8 +- examples/faker/src/gen/models/Pet.ts | 2 +- examples/faker/src/gen/models/Tag.ts | 2 +- .../faker/src/gen/models/UpdatePetWithForm.ts | 2 +- examples/faker/src/gen/models/UploadFile.ts | 2 +- examples/faker/src/gen/models/User.ts | 4 +- examples/msw-v2/src/gen/models/AddPet.ts | 2 +- .../msw-v2/src/gen/models/AddPetRequest.ts | 2 +- examples/msw-v2/src/gen/models/ApiResponse.ts | 2 +- examples/msw-v2/src/gen/models/Category.ts | 2 +- examples/msw-v2/src/gen/models/Customer.ts | 2 +- examples/msw-v2/src/gen/models/DeleteOrder.ts | 2 +- examples/msw-v2/src/gen/models/DeletePet.ts | 2 +- .../msw-v2/src/gen/models/GetOrderById.ts | 2 +- examples/msw-v2/src/gen/models/GetPetById.ts | 2 +- examples/msw-v2/src/gen/models/Order.ts | 8 +- examples/msw-v2/src/gen/models/Pet.ts | 2 +- examples/msw-v2/src/gen/models/PetNotFound.ts | 2 +- examples/msw-v2/src/gen/models/Tag.ts | 2 +- .../src/gen/models/UpdatePetWithForm.ts | 2 +- examples/msw-v2/src/gen/models/UploadFile.ts | 2 +- examples/msw-v2/src/gen/models/User.ts | 4 +- examples/msw/src/gen/models/AddPet.ts | 2 +- examples/msw/src/gen/models/AddPetRequest.ts | 2 +- examples/msw/src/gen/models/ApiResponse.ts | 2 +- examples/msw/src/gen/models/Category.ts | 2 +- examples/msw/src/gen/models/Customer.ts | 2 +- examples/msw/src/gen/models/DeleteOrder.ts | 2 +- examples/msw/src/gen/models/DeletePet.ts | 2 +- examples/msw/src/gen/models/GetOrderById.ts | 2 +- examples/msw/src/gen/models/GetPetById.ts | 2 +- examples/msw/src/gen/models/Order.ts | 8 +- examples/msw/src/gen/models/Pet.ts | 2 +- examples/msw/src/gen/models/PetNotFound.ts | 2 +- examples/msw/src/gen/models/Tag.ts | 2 +- .../msw/src/gen/models/UpdatePetWithForm.ts | 2 +- examples/msw/src/gen/models/UploadFile.ts | 2 +- examples/msw/src/gen/models/User.ts | 4 +- .../react-query-v5/src/gen/hooks/index.ts | 40 +-- .../src/gen/hooks/useAddPetHook.ts | 86 +++--- .../src/gen/hooks/useCreateUserHook.ts | 86 +++--- .../hooks/useCreateUsersWithListInputHook.ts | 86 +++--- .../src/gen/hooks/useDeleteOrderHook.ts | 85 +++--- .../src/gen/hooks/useDeletePetHook.ts | 88 +++--- .../src/gen/hooks/useDeleteUserHook.ts | 85 +++--- .../src/gen/hooks/useFindPetsByStatusHook.ts | 175 ++++++------ .../src/gen/hooks/useFindPetsByTagsHook.ts | 266 ++++++++---------- .../src/gen/hooks/useGetInventoryHook.ts | 164 ++++++----- .../src/gen/hooks/useGetOrderByIdHook.ts | 168 ++++++----- .../src/gen/hooks/useGetPetByIdHook.ts | 166 ++++++----- .../src/gen/hooks/useGetUserByNameHook.ts | 172 ++++++----- .../src/gen/hooks/useLoginUserHook.ts | 170 ++++++----- .../src/gen/hooks/useLogoutUserHook.ts | 164 ++++++----- .../src/gen/hooks/usePlaceOrderHook.ts | 86 +++--- .../src/gen/hooks/usePlaceOrderPatchHook.ts | 86 +++--- .../src/gen/hooks/useUpdatePetHook.ts | 86 +++--- .../src/gen/hooks/useUpdatePetWithFormHook.ts | 191 ++++++------- .../src/gen/hooks/useUpdateUserHook.ts | 87 +++--- .../src/gen/hooks/useUploadFileHook.ts | 90 +++--- examples/react-query-v5/src/gen/index.ts | 4 +- .../react-query-v5/src/gen/invalidations.ts | 77 ++--- .../react-query-v5/src/gen/models/AddPet.ts | 54 ++-- .../src/gen/models/AddPetRequest.ts | 62 ++-- .../react-query-v5/src/gen/models/Address.ts | 34 +-- .../src/gen/models/ApiResponse.ts | 26 +- .../react-query-v5/src/gen/models/Category.ts | 18 +- .../src/gen/models/CreateUser.ts | 24 +- .../gen/models/CreateUsersWithListInput.ts | 30 +- .../react-query-v5/src/gen/models/Customer.ts | 30 +- .../src/gen/models/DeleteOrder.ts | 36 +-- .../src/gen/models/DeletePet.ts | 44 +-- .../src/gen/models/DeleteUser.ts | 36 +-- .../src/gen/models/FindPetsByStatus.ts | 56 ++-- .../src/gen/models/FindPetsByTags.ts | 64 ++--- .../src/gen/models/GetInventory.ts | 20 +- .../src/gen/models/GetOrderById.ts | 50 ++-- .../src/gen/models/GetPetById.ts | 50 ++-- .../src/gen/models/GetUserByName.ts | 50 ++-- .../src/gen/models/LoginUser.ts | 50 ++-- .../src/gen/models/LogoutUser.ts | 12 +- .../react-query-v5/src/gen/models/Order.ts | 82 +++--- examples/react-query-v5/src/gen/models/Pet.ts | 62 ++-- .../src/gen/models/PetNotFound.ts | 18 +- .../src/gen/models/PlaceOrder.ts | 32 +-- .../src/gen/models/PlaceOrderPatch.ts | 32 +-- examples/react-query-v5/src/gen/models/Tag.ts | 18 +- .../src/gen/models/UpdatePet.ts | 48 ++-- .../src/gen/models/UpdatePetWithForm.ts | 56 ++-- .../src/gen/models/UpdateUser.ts | 40 +-- .../src/gen/models/UploadFile.ts | 56 ++-- .../react-query-v5/src/gen/models/User.ts | 68 ++--- .../src/gen/models/UserArray.ts | 4 +- .../react-query-v5/src/gen/models/index.ts | 62 ++-- examples/react-query/src/gen/models/AddPet.ts | 2 +- .../src/gen/models/AddPetRequest.ts | 2 +- .../react-query/src/gen/models/ApiResponse.ts | 2 +- .../react-query/src/gen/models/Category.ts | 2 +- .../react-query/src/gen/models/Customer.ts | 2 +- .../react-query/src/gen/models/DeleteOrder.ts | 2 +- .../react-query/src/gen/models/DeletePet.ts | 2 +- .../src/gen/models/GetOrderById.ts | 2 +- .../react-query/src/gen/models/GetPetById.ts | 2 +- examples/react-query/src/gen/models/Order.ts | 8 +- examples/react-query/src/gen/models/Pet.ts | 2 +- .../react-query/src/gen/models/PetNotFound.ts | 2 +- examples/react-query/src/gen/models/Tag.ts | 2 +- .../src/gen/models/UpdatePetWithForm.ts | 2 +- .../react-query/src/gen/models/UploadFile.ts | 2 +- examples/react-query/src/gen/models/User.ts | 4 +- examples/simple-single/src/gen/models.ts | 40 +-- examples/solid-query/src/gen/models/AddPet.ts | 2 +- .../src/gen/models/AddPetRequest.ts | 2 +- .../solid-query/src/gen/models/ApiResponse.ts | 2 +- .../solid-query/src/gen/models/Category.ts | 2 +- .../solid-query/src/gen/models/Customer.ts | 2 +- .../solid-query/src/gen/models/DeleteOrder.ts | 2 +- .../solid-query/src/gen/models/DeletePet.ts | 2 +- .../src/gen/models/GetOrderById.ts | 2 +- .../solid-query/src/gen/models/GetPetById.ts | 2 +- examples/solid-query/src/gen/models/Order.ts | 8 +- examples/solid-query/src/gen/models/Pet.ts | 2 +- .../solid-query/src/gen/models/PetNotFound.ts | 2 +- examples/solid-query/src/gen/models/Tag.ts | 2 +- .../src/gen/models/UpdatePetWithForm.ts | 2 +- .../solid-query/src/gen/models/UploadFile.ts | 2 +- examples/solid-query/src/gen/models/User.ts | 4 +- .../svelte-query/src/gen/models/AddPet.ts | 2 +- .../src/gen/models/AddPetRequest.ts | 2 +- .../src/gen/models/ApiResponse.ts | 2 +- .../svelte-query/src/gen/models/Category.ts | 2 +- .../svelte-query/src/gen/models/Customer.ts | 2 +- .../src/gen/models/DeleteOrder.ts | 2 +- .../svelte-query/src/gen/models/DeletePet.ts | 2 +- .../src/gen/models/GetOrderById.ts | 2 +- .../svelte-query/src/gen/models/GetPetById.ts | 2 +- examples/svelte-query/src/gen/models/Order.ts | 8 +- examples/svelte-query/src/gen/models/Pet.ts | 2 +- .../src/gen/models/PetNotFound.ts | 2 +- examples/svelte-query/src/gen/models/Tag.ts | 2 +- .../src/gen/models/UpdatePetWithForm.ts | 2 +- .../svelte-query/src/gen/models/UploadFile.ts | 2 +- examples/svelte-query/src/gen/models/User.ts | 4 +- examples/swr/src/gen/models/AddPet.ts | 2 +- examples/swr/src/gen/models/AddPetRequest.ts | 2 +- examples/swr/src/gen/models/ApiResponse.ts | 2 +- examples/swr/src/gen/models/Category.ts | 2 +- examples/swr/src/gen/models/Customer.ts | 2 +- examples/swr/src/gen/models/DeleteOrder.ts | 2 +- examples/swr/src/gen/models/DeletePet.ts | 2 +- examples/swr/src/gen/models/GetOrderById.ts | 2 +- examples/swr/src/gen/models/GetPetById.ts | 2 +- examples/swr/src/gen/models/Order.ts | 8 +- examples/swr/src/gen/models/Pet.ts | 2 +- examples/swr/src/gen/models/PetNotFound.ts | 2 +- examples/swr/src/gen/models/Tag.ts | 2 +- .../swr/src/gen/models/UpdatePetWithForm.ts | 2 +- examples/swr/src/gen/models/UploadFile.ts | 2 +- examples/swr/src/gen/models/User.ts | 4 +- examples/typescript/src/gen/models.ts | 40 +-- examples/typescript/src/gen/modelsConst.ts | 40 +-- .../typescript/src/gen/modelsConstEnum.ts | 40 +-- examples/typescript/src/gen/modelsLiteral.ts | 40 +-- .../typescript/src/gen/modelsPascalConst.ts | 40 +-- .../typescript/src/gen/ts/models/AddPet.ts | 2 +- .../src/gen/ts/models/AddPetRequest.ts | 2 +- .../src/gen/ts/models/ApiResponse.ts | 2 +- .../typescript/src/gen/ts/models/Category.ts | 2 +- .../typescript/src/gen/ts/models/Customer.ts | 2 +- .../src/gen/ts/models/DeleteOrder.ts | 2 +- .../typescript/src/gen/ts/models/DeletePet.ts | 2 +- .../src/gen/ts/models/GetOrderById.ts | 2 +- .../src/gen/ts/models/GetPetById.ts | 2 +- .../typescript/src/gen/ts/models/Order.ts | 8 +- examples/typescript/src/gen/ts/models/Pet.ts | 2 +- .../src/gen/ts/models/PetNotFound.ts | 2 +- examples/typescript/src/gen/ts/models/Tag.ts | 2 +- .../src/gen/ts/models/UpdatePetWithForm.ts | 2 +- .../src/gen/ts/models/UploadFile.ts | 2 +- examples/typescript/src/gen/ts/models/User.ts | 4 +- examples/vue-query-v5/src/gen/hooks/index.ts | 38 +-- .../vue-query-v5/src/gen/hooks/useAddPet.ts | 72 +++-- .../src/gen/hooks/useCreateUser.ts | 72 +++-- .../gen/hooks/useCreateUsersWithListInput.ts | 72 +++-- .../src/gen/hooks/useDeleteOrder.ts | 77 +++-- .../src/gen/hooks/useDeletePet.ts | 82 +++--- .../src/gen/hooks/useDeleteUser.ts | 77 +++-- .../src/gen/hooks/useFindPetsByStatus.ts | 114 ++++---- .../src/gen/hooks/useFindPetsByTags.ts | 113 ++++---- .../src/gen/hooks/useGetInventory.ts | 100 ++++--- .../src/gen/hooks/useGetOrderById.ts | 108 ++++--- .../src/gen/hooks/useGetPetById.ts | 107 ++++--- .../src/gen/hooks/useGetUserByName.ts | 108 ++++--- .../src/gen/hooks/useLoginUser.ts | 109 ++++--- .../src/gen/hooks/useLogoutUser.ts | 100 ++++--- .../src/gen/hooks/usePlaceOrder.ts | 72 +++-- .../src/gen/hooks/useUpdatePet.ts | 72 +++-- .../src/gen/hooks/useUpdatePetWithForm.ts | 87 +++--- .../src/gen/hooks/useUpdateUser.ts | 79 +++--- .../src/gen/hooks/useUploadFile.ts | 84 +++--- examples/vue-query-v5/src/gen/index.ts | 4 +- .../vue-query-v5/src/gen/models/AddPet.ts | 36 +-- .../vue-query-v5/src/gen/models/Address.ts | 55 ++-- .../src/gen/models/ApiResponse.ts | 26 +- .../vue-query-v5/src/gen/models/Category.ts | 18 +- .../vue-query-v5/src/gen/models/CreateUser.ts | 24 +- .../gen/models/CreateUsersWithListInput.ts | 30 +- .../vue-query-v5/src/gen/models/Customer.ts | 30 +- .../src/gen/models/DeleteOrder.ts | 36 +-- .../vue-query-v5/src/gen/models/DeletePet.ts | 44 +-- .../vue-query-v5/src/gen/models/DeleteUser.ts | 36 +-- .../src/gen/models/FindPetsByStatus.ts | 56 ++-- .../src/gen/models/FindPetsByTags.ts | 44 +-- .../src/gen/models/GetInventory.ts | 20 +- .../src/gen/models/GetOrderById.ts | 50 ++-- .../vue-query-v5/src/gen/models/GetPetById.ts | 50 ++-- .../src/gen/models/GetUserByName.ts | 50 ++-- .../vue-query-v5/src/gen/models/LoginUser.ts | 50 ++-- .../vue-query-v5/src/gen/models/LogoutUser.ts | 12 +- examples/vue-query-v5/src/gen/models/Order.ts | 62 ++-- examples/vue-query-v5/src/gen/models/Pet.ts | 62 ++-- .../vue-query-v5/src/gen/models/PlaceOrder.ts | 32 +-- examples/vue-query-v5/src/gen/models/Tag.ts | 18 +- .../vue-query-v5/src/gen/models/UpdatePet.ts | 48 ++-- .../src/gen/models/UpdatePetWithForm.ts | 56 ++-- .../vue-query-v5/src/gen/models/UpdateUser.ts | 40 +-- .../vue-query-v5/src/gen/models/UploadFile.ts | 56 ++-- examples/vue-query-v5/src/gen/models/User.ts | 68 ++--- .../vue-query-v5/src/gen/models/UserArray.ts | 4 +- examples/vue-query-v5/src/gen/models/index.ts | 56 ++-- examples/vue-query/src/gen/models/Address.ts | 3 + .../vue-query/src/gen/models/ApiResponse.ts | 2 +- examples/vue-query/src/gen/models/Category.ts | 2 +- examples/vue-query/src/gen/models/Customer.ts | 2 +- .../vue-query/src/gen/models/DeleteOrder.ts | 2 +- .../vue-query/src/gen/models/DeletePet.ts | 2 +- .../vue-query/src/gen/models/GetOrderById.ts | 2 +- .../vue-query/src/gen/models/GetPetById.ts | 2 +- examples/vue-query/src/gen/models/Order.ts | 8 +- examples/vue-query/src/gen/models/Pet.ts | 2 +- examples/vue-query/src/gen/models/Tag.ts | 2 +- .../src/gen/models/UpdatePetWithForm.ts | 2 +- .../vue-query/src/gen/models/UploadFile.ts | 2 +- examples/vue-query/src/gen/models/User.ts | 4 +- examples/zod/src/gen/ts/AddPet.ts | 2 +- examples/zod/src/gen/ts/AddPetRequest.ts | 2 +- examples/zod/src/gen/ts/ApiResponse.ts | 2 +- examples/zod/src/gen/ts/Category.ts | 2 +- examples/zod/src/gen/ts/Customer.ts | 2 +- examples/zod/src/gen/ts/DeleteOrder.ts | 2 +- examples/zod/src/gen/ts/DeletePet.ts | 2 +- examples/zod/src/gen/ts/GetOrderById.ts | 2 +- examples/zod/src/gen/ts/GetPetById.ts | 2 +- examples/zod/src/gen/ts/Order.ts | 8 +- examples/zod/src/gen/ts/Pet.ts | 2 +- examples/zod/src/gen/ts/PetNotFound.ts | 2 +- examples/zod/src/gen/ts/Tag.ts | 2 +- examples/zod/src/gen/ts/UpdatePetWithForm.ts | 2 +- examples/zod/src/gen/ts/UploadFile.ts | 2 +- examples/zod/src/gen/ts/User.ts | 4 +- packages/cli/package.json | 16 +- packages/core/package.json | 37 +-- packages/kubb/package.json | 16 +- packages/parser/package.json | 18 +- packages/react/package.json | 24 +- packages/swagger-client/package.json | 24 +- packages/swagger-faker/package.json | 23 +- packages/swagger-msw/package.json | 24 +- packages/swagger-swr/package.json | 25 +- packages/swagger-tanstack-query/CHANGELOG.md | 2 +- packages/swagger-tanstack-query/package.json | 24 +- packages/swagger-ts/package.json | 24 +- .../SchemaGenerator.test.tsx.snap | 16 +- .../src/__snapshots__/typeParser.test.ts.snap | 2 +- packages/swagger-ts/src/typeParser.ts | 2 +- packages/swagger-zod/package.json | 20 +- .../src/__snapshots__/zodParser.test.ts.snap | 4 +- packages/swagger-zod/src/zodParser.tsx | 2 +- packages/swagger-zodios/package.json | 21 +- packages/swagger/package.json | 32 +-- packages/swagger/src/SchemaGenerator.ts | 67 ++--- packages/types/package.json | 16 +- packages/unplugin/package.json | 27 +- 323 files changed, 3845 insertions(+), 4292 deletions(-) create mode 100644 .changeset/green-tips-hope.md diff --git a/.changeset/green-tips-hope.md b/.changeset/green-tips-hope.md new file mode 100644 index 000000000..198b7a275 --- /dev/null +++ b/.changeset/green-tips-hope.md @@ -0,0 +1,9 @@ +--- +"@kubb/swagger-tanstack-query": minor +"@kubb/swagger-faker": minor +"@kubb/swagger-zod": minor +"@kubb/swagger-ts": minor +"@kubb/swagger": minor +--- + +Give format precendence over type property diff --git a/examples/advanced/src/gen/models/ts/AddPetRequest.ts b/examples/advanced/src/gen/models/ts/AddPetRequest.ts index 882b3e9ab..c3b11a7cd 100644 --- a/examples/advanced/src/gen/models/ts/AddPetRequest.ts +++ b/examples/advanced/src/gen/models/ts/AddPetRequest.ts @@ -9,7 +9,7 @@ export const AddPetRequestStatusEnum = { export type AddPetRequestStatusEnum = (typeof AddPetRequestStatusEnum)[keyof typeof AddPetRequestStatusEnum] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/advanced/src/gen/models/ts/ApiResponse.ts b/examples/advanced/src/gen/models/ts/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/advanced/src/gen/models/ts/ApiResponse.ts +++ b/examples/advanced/src/gen/models/ts/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/advanced/src/gen/models/ts/Category.ts b/examples/advanced/src/gen/models/ts/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/advanced/src/gen/models/ts/Category.ts +++ b/examples/advanced/src/gen/models/ts/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/advanced/src/gen/models/ts/Customer.ts b/examples/advanced/src/gen/models/ts/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/advanced/src/gen/models/ts/Customer.ts +++ b/examples/advanced/src/gen/models/ts/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/advanced/src/gen/models/ts/Order.ts b/examples/advanced/src/gen/models/ts/Order.ts index 0d2295d26..33f82366e 100644 --- a/examples/advanced/src/gen/models/ts/Order.ts +++ b/examples/advanced/src/gen/models/ts/Order.ts @@ -16,15 +16,15 @@ export const OrderHttpStatusEnum = { export type OrderHttpStatusEnum = (typeof OrderHttpStatusEnum)[keyof typeof OrderHttpStatusEnum] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** @@ -37,7 +37,7 @@ export type Order = { */ type?: string /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: Date /** diff --git a/examples/advanced/src/gen/models/ts/Pet.ts b/examples/advanced/src/gen/models/ts/Pet.ts index de4d37a3d..e4e82439c 100644 --- a/examples/advanced/src/gen/models/ts/Pet.ts +++ b/examples/advanced/src/gen/models/ts/Pet.ts @@ -9,7 +9,7 @@ export const PetStatusEnum = { export type PetStatusEnum = (typeof PetStatusEnum)[keyof typeof PetStatusEnum] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ readonly id?: number /** diff --git a/examples/advanced/src/gen/models/ts/PetNotFound.ts b/examples/advanced/src/gen/models/ts/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/advanced/src/gen/models/ts/PetNotFound.ts +++ b/examples/advanced/src/gen/models/ts/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/advanced/src/gen/models/ts/User.ts b/examples/advanced/src/gen/models/ts/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/advanced/src/gen/models/ts/User.ts +++ b/examples/advanced/src/gen/models/ts/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/advanced/src/gen/models/ts/petController/AddPet.ts b/examples/advanced/src/gen/models/ts/petController/AddPet.ts index b9f90f20d..4ca0cdc53 100644 --- a/examples/advanced/src/gen/models/ts/petController/AddPet.ts +++ b/examples/advanced/src/gen/models/ts/petController/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/advanced/src/gen/models/ts/petController/DeletePet.ts b/examples/advanced/src/gen/models/ts/petController/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/advanced/src/gen/models/ts/petController/DeletePet.ts +++ b/examples/advanced/src/gen/models/ts/petController/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/advanced/src/gen/models/ts/petController/GetPetById.ts b/examples/advanced/src/gen/models/ts/petController/GetPetById.ts index 4a2000aa0..497fb41ab 100644 --- a/examples/advanced/src/gen/models/ts/petController/GetPetById.ts +++ b/examples/advanced/src/gen/models/ts/petController/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from '../Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts b/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts +++ b/examples/advanced/src/gen/models/ts/petController/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/advanced/src/gen/models/ts/petController/UploadFile.ts b/examples/advanced/src/gen/models/ts/petController/UploadFile.ts index fe078ea12..d90857244 100644 --- a/examples/advanced/src/gen/models/ts/petController/UploadFile.ts +++ b/examples/advanced/src/gen/models/ts/petController/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from '../ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts b/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts +++ b/examples/advanced/src/gen/models/ts/storeController/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts b/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts index 7ea84394f..95834be03 100644 --- a/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts +++ b/examples/advanced/src/gen/models/ts/storeController/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from '../Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/advanced/src/gen/models/ts/tag/Tag.ts b/examples/advanced/src/gen/models/ts/tag/Tag.ts index 4d03c8601..38366ba71 100644 --- a/examples/advanced/src/gen/models/ts/tag/Tag.ts +++ b/examples/advanced/src/gen/models/ts/tag/Tag.ts @@ -1,6 +1,6 @@ export type TagTag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/client/src/gen/models/ts/AddPetRequest.ts b/examples/client/src/gen/models/ts/AddPetRequest.ts index 331719d27..18b1569dc 100644 --- a/examples/client/src/gen/models/ts/AddPetRequest.ts +++ b/examples/client/src/gen/models/ts/AddPetRequest.ts @@ -9,7 +9,7 @@ export const AddPetRequestStatus = { export type AddPetRequestStatus = (typeof AddPetRequestStatus)[keyof typeof AddPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/client/src/gen/models/ts/ApiResponse.ts b/examples/client/src/gen/models/ts/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/client/src/gen/models/ts/ApiResponse.ts +++ b/examples/client/src/gen/models/ts/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/client/src/gen/models/ts/Category.ts b/examples/client/src/gen/models/ts/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/client/src/gen/models/ts/Category.ts +++ b/examples/client/src/gen/models/ts/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/client/src/gen/models/ts/Customer.ts b/examples/client/src/gen/models/ts/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/client/src/gen/models/ts/Customer.ts +++ b/examples/client/src/gen/models/ts/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/client/src/gen/models/ts/Order.ts b/examples/client/src/gen/models/ts/Order.ts index eec7002e6..7b9fe57d8 100644 --- a/examples/client/src/gen/models/ts/Order.ts +++ b/examples/client/src/gen/models/ts/Order.ts @@ -11,19 +11,19 @@ export const OrderHttpStatus = { export type OrderHttpStatus = (typeof OrderHttpStatus)[keyof typeof OrderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: Date /** diff --git a/examples/client/src/gen/models/ts/Pet.ts b/examples/client/src/gen/models/ts/Pet.ts index bfd40a0df..54e7ec22c 100644 --- a/examples/client/src/gen/models/ts/Pet.ts +++ b/examples/client/src/gen/models/ts/Pet.ts @@ -9,7 +9,7 @@ export const PetStatus = { export type PetStatus = (typeof PetStatus)[keyof typeof PetStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/client/src/gen/models/ts/PetNotFound.ts b/examples/client/src/gen/models/ts/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/client/src/gen/models/ts/PetNotFound.ts +++ b/examples/client/src/gen/models/ts/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/client/src/gen/models/ts/Tag.ts b/examples/client/src/gen/models/ts/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/client/src/gen/models/ts/Tag.ts +++ b/examples/client/src/gen/models/ts/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/client/src/gen/models/ts/User.ts b/examples/client/src/gen/models/ts/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/client/src/gen/models/ts/User.ts +++ b/examples/client/src/gen/models/ts/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/client/src/gen/models/ts/petController/AddPet.ts b/examples/client/src/gen/models/ts/petController/AddPet.ts index 143ef056e..92bc1fc4d 100644 --- a/examples/client/src/gen/models/ts/petController/AddPet.ts +++ b/examples/client/src/gen/models/ts/petController/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/client/src/gen/models/ts/petController/DeletePet.ts b/examples/client/src/gen/models/ts/petController/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/client/src/gen/models/ts/petController/DeletePet.ts +++ b/examples/client/src/gen/models/ts/petController/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/client/src/gen/models/ts/petController/GetPetById.ts b/examples/client/src/gen/models/ts/petController/GetPetById.ts index a2bd92cc3..fa18d58ab 100644 --- a/examples/client/src/gen/models/ts/petController/GetPetById.ts +++ b/examples/client/src/gen/models/ts/petController/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from '../Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts b/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts +++ b/examples/client/src/gen/models/ts/petController/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/client/src/gen/models/ts/petController/UploadFile.ts b/examples/client/src/gen/models/ts/petController/UploadFile.ts index fe078ea12..d90857244 100644 --- a/examples/client/src/gen/models/ts/petController/UploadFile.ts +++ b/examples/client/src/gen/models/ts/petController/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from '../ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts b/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts +++ b/examples/client/src/gen/models/ts/storeController/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/client/src/gen/models/ts/storeController/GetOrderById.ts b/examples/client/src/gen/models/ts/storeController/GetOrderById.ts index 7ea84394f..95834be03 100644 --- a/examples/client/src/gen/models/ts/storeController/GetOrderById.ts +++ b/examples/client/src/gen/models/ts/storeController/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from '../Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/faker/src/gen/models/Address.ts b/examples/faker/src/gen/models/Address.ts index 6e6411f01..0dc7e4f8d 100644 --- a/examples/faker/src/gen/models/Address.ts +++ b/examples/faker/src/gen/models/Address.ts @@ -22,5 +22,8 @@ export type Address = { * @type string | undefined */ zip?: string + /** + * @type array | undefined + */ identifier?: [number, string, AddressIdentifier] } diff --git a/examples/faker/src/gen/models/ApiResponse.ts b/examples/faker/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/faker/src/gen/models/ApiResponse.ts +++ b/examples/faker/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/faker/src/gen/models/Category.ts b/examples/faker/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/faker/src/gen/models/Category.ts +++ b/examples/faker/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/faker/src/gen/models/Customer.ts b/examples/faker/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/faker/src/gen/models/Customer.ts +++ b/examples/faker/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/faker/src/gen/models/DeleteOrder.ts b/examples/faker/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/faker/src/gen/models/DeleteOrder.ts +++ b/examples/faker/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/faker/src/gen/models/DeletePet.ts b/examples/faker/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/faker/src/gen/models/DeletePet.ts +++ b/examples/faker/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/faker/src/gen/models/GetOrderById.ts b/examples/faker/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/faker/src/gen/models/GetOrderById.ts +++ b/examples/faker/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/faker/src/gen/models/GetPetById.ts b/examples/faker/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/faker/src/gen/models/GetPetById.ts +++ b/examples/faker/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/faker/src/gen/models/Order.ts b/examples/faker/src/gen/models/Order.ts index 09cb16946..0305ad4e4 100644 --- a/examples/faker/src/gen/models/Order.ts +++ b/examples/faker/src/gen/models/Order.ts @@ -6,19 +6,19 @@ export const orderStatus = { export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/faker/src/gen/models/Pet.ts b/examples/faker/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/faker/src/gen/models/Pet.ts +++ b/examples/faker/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/faker/src/gen/models/Tag.ts b/examples/faker/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/faker/src/gen/models/Tag.ts +++ b/examples/faker/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/faker/src/gen/models/UpdatePetWithForm.ts b/examples/faker/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/faker/src/gen/models/UpdatePetWithForm.ts +++ b/examples/faker/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/faker/src/gen/models/UploadFile.ts b/examples/faker/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/faker/src/gen/models/UploadFile.ts +++ b/examples/faker/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/faker/src/gen/models/User.ts b/examples/faker/src/gen/models/User.ts index d3d593a2f..33ae7a753 100644 --- a/examples/faker/src/gen/models/User.ts +++ b/examples/faker/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number /** diff --git a/examples/msw-v2/src/gen/models/AddPet.ts b/examples/msw-v2/src/gen/models/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/msw-v2/src/gen/models/AddPet.ts +++ b/examples/msw-v2/src/gen/models/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/msw-v2/src/gen/models/AddPetRequest.ts b/examples/msw-v2/src/gen/models/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/msw-v2/src/gen/models/AddPetRequest.ts +++ b/examples/msw-v2/src/gen/models/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw-v2/src/gen/models/ApiResponse.ts b/examples/msw-v2/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/msw-v2/src/gen/models/ApiResponse.ts +++ b/examples/msw-v2/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/msw-v2/src/gen/models/Category.ts b/examples/msw-v2/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/msw-v2/src/gen/models/Category.ts +++ b/examples/msw-v2/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw-v2/src/gen/models/Customer.ts b/examples/msw-v2/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/msw-v2/src/gen/models/Customer.ts +++ b/examples/msw-v2/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw-v2/src/gen/models/DeleteOrder.ts b/examples/msw-v2/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/msw-v2/src/gen/models/DeleteOrder.ts +++ b/examples/msw-v2/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/msw-v2/src/gen/models/DeletePet.ts b/examples/msw-v2/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/msw-v2/src/gen/models/DeletePet.ts +++ b/examples/msw-v2/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw-v2/src/gen/models/GetOrderById.ts b/examples/msw-v2/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/msw-v2/src/gen/models/GetOrderById.ts +++ b/examples/msw-v2/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/msw-v2/src/gen/models/GetPetById.ts b/examples/msw-v2/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/msw-v2/src/gen/models/GetPetById.ts +++ b/examples/msw-v2/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw-v2/src/gen/models/Order.ts b/examples/msw-v2/src/gen/models/Order.ts index 878fe6ba2..869963878 100644 --- a/examples/msw-v2/src/gen/models/Order.ts +++ b/examples/msw-v2/src/gen/models/Order.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/msw-v2/src/gen/models/Pet.ts b/examples/msw-v2/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/msw-v2/src/gen/models/Pet.ts +++ b/examples/msw-v2/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw-v2/src/gen/models/PetNotFound.ts b/examples/msw-v2/src/gen/models/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/msw-v2/src/gen/models/PetNotFound.ts +++ b/examples/msw-v2/src/gen/models/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/msw-v2/src/gen/models/Tag.ts b/examples/msw-v2/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/msw-v2/src/gen/models/Tag.ts +++ b/examples/msw-v2/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts b/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts +++ b/examples/msw-v2/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw-v2/src/gen/models/UploadFile.ts b/examples/msw-v2/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/msw-v2/src/gen/models/UploadFile.ts +++ b/examples/msw-v2/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw-v2/src/gen/models/User.ts b/examples/msw-v2/src/gen/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/msw-v2/src/gen/models/User.ts +++ b/examples/msw-v2/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/msw/src/gen/models/AddPet.ts b/examples/msw/src/gen/models/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/msw/src/gen/models/AddPet.ts +++ b/examples/msw/src/gen/models/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/msw/src/gen/models/AddPetRequest.ts b/examples/msw/src/gen/models/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/msw/src/gen/models/AddPetRequest.ts +++ b/examples/msw/src/gen/models/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw/src/gen/models/ApiResponse.ts b/examples/msw/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/msw/src/gen/models/ApiResponse.ts +++ b/examples/msw/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/msw/src/gen/models/Category.ts b/examples/msw/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/msw/src/gen/models/Category.ts +++ b/examples/msw/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw/src/gen/models/Customer.ts b/examples/msw/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/msw/src/gen/models/Customer.ts +++ b/examples/msw/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw/src/gen/models/DeleteOrder.ts b/examples/msw/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/msw/src/gen/models/DeleteOrder.ts +++ b/examples/msw/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/msw/src/gen/models/DeletePet.ts b/examples/msw/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/msw/src/gen/models/DeletePet.ts +++ b/examples/msw/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw/src/gen/models/GetOrderById.ts b/examples/msw/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/msw/src/gen/models/GetOrderById.ts +++ b/examples/msw/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/msw/src/gen/models/GetPetById.ts b/examples/msw/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/msw/src/gen/models/GetPetById.ts +++ b/examples/msw/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw/src/gen/models/Order.ts b/examples/msw/src/gen/models/Order.ts index 878fe6ba2..869963878 100644 --- a/examples/msw/src/gen/models/Order.ts +++ b/examples/msw/src/gen/models/Order.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/msw/src/gen/models/Pet.ts b/examples/msw/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/msw/src/gen/models/Pet.ts +++ b/examples/msw/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw/src/gen/models/PetNotFound.ts b/examples/msw/src/gen/models/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/msw/src/gen/models/PetNotFound.ts +++ b/examples/msw/src/gen/models/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/msw/src/gen/models/Tag.ts b/examples/msw/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/msw/src/gen/models/Tag.ts +++ b/examples/msw/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/msw/src/gen/models/UpdatePetWithForm.ts b/examples/msw/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/msw/src/gen/models/UpdatePetWithForm.ts +++ b/examples/msw/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw/src/gen/models/UploadFile.ts b/examples/msw/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/msw/src/gen/models/UploadFile.ts +++ b/examples/msw/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/msw/src/gen/models/User.ts b/examples/msw/src/gen/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/msw/src/gen/models/User.ts +++ b/examples/msw/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/react-query-v5/src/gen/hooks/index.ts b/examples/react-query-v5/src/gen/hooks/index.ts index 3cd1ec1db..ad8585388 100644 --- a/examples/react-query-v5/src/gen/hooks/index.ts +++ b/examples/react-query-v5/src/gen/hooks/index.ts @@ -1,20 +1,20 @@ -export * from './useAddPetHook' -export * from './useCreateUserHook' -export * from './useCreateUsersWithListInputHook' -export * from './useDeleteOrderHook' -export * from './useDeletePetHook' -export * from './useDeleteUserHook' -export * from './useFindPetsByStatusHook' -export * from './useFindPetsByTagsHook' -export * from './useGetInventoryHook' -export * from './useGetOrderByIdHook' -export * from './useGetPetByIdHook' -export * from './useGetUserByNameHook' -export * from './useLoginUserHook' -export * from './useLogoutUserHook' -export * from './usePlaceOrderHook' -export * from './usePlaceOrderPatchHook' -export * from './useUpdatePetHook' -export * from './useUpdatePetWithFormHook' -export * from './useUpdateUserHook' -export * from './useUploadFileHook' +export * from "./useAddPetHook"; +export * from "./useCreateUserHook"; +export * from "./useCreateUsersWithListInputHook"; +export * from "./useDeleteOrderHook"; +export * from "./useDeletePetHook"; +export * from "./useDeleteUserHook"; +export * from "./useFindPetsByStatusHook"; +export * from "./useFindPetsByTagsHook"; +export * from "./useGetInventoryHook"; +export * from "./useGetOrderByIdHook"; +export * from "./useGetPetByIdHook"; +export * from "./useGetUserByNameHook"; +export * from "./useLoginUserHook"; +export * from "./useLogoutUserHook"; +export * from "./usePlaceOrderHook"; +export * from "./usePlaceOrderPatchHook"; +export * from "./useUpdatePetHook"; +export * from "./useUpdatePetWithFormHook"; +export * from "./useUpdateUserHook"; +export * from "./useUploadFileHook"; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useAddPetHook.ts b/examples/react-query-v5/src/gen/hooks/useAddPetHook.ts index 7164710d1..21feb08d7 100644 --- a/examples/react-query-v5/src/gen/hooks/useAddPetHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useAddPetHook.ts @@ -1,50 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { AddPet405, AddPetMutationRequest, AddPetMutationResponse } from '../models/AddPet' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from "../models/AddPet"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type AddPetClient = typeof client + type AddPetClient = typeof client; type AddPet = { - data: AddPetMutationResponse - error: AddPet405 - request: AddPetMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: AddPetMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: AddPetMutationResponse; + error: AddPet405; + request: AddPetMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: AddPetMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Add a new pet to the store * @summary Add a new pet to the store * @link /pet */ -export function useAddPetHook( - options: { - mutation?: UseMutationOptions - client?: AddPet['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useAddPetHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/pet', - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useAddPetHook(options: { + mutation?: UseMutationOptions; + client?: AddPet["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useAddPetHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/pet`, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts b/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts index bfd58fda3..1e072b95f 100644 --- a/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useCreateUserHook.ts @@ -1,50 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { CreateUserMutationRequest, CreateUserMutationResponse } from "../models/CreateUser"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type CreateUserClient = typeof client + type CreateUserClient = typeof client; type CreateUser = { - data: CreateUserMutationResponse - error: never - request: CreateUserMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: CreateUserMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: CreateUserMutationResponse; + error: never; + request: CreateUserMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: CreateUserMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description This can only be done by the logged in user. * @summary Create user * @link /user */ -export function useCreateUserHook( - options: { - mutation?: UseMutationOptions - client?: CreateUser['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useCreateUserHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/user', - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useCreateUserHook(options: { + mutation?: UseMutationOptions; + client?: CreateUser["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useCreateUserHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/user`, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts b/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts index 5719ec915..dd62eb44e 100644 --- a/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useCreateUsersWithListInputHook.ts @@ -1,50 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from "../models/CreateUsersWithListInput"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type CreateUsersWithListInputClient = typeof client + type CreateUsersWithListInputClient = typeof client; type CreateUsersWithListInput = { - data: CreateUsersWithListInputMutationResponse - error: never - request: CreateUsersWithListInputMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: CreateUsersWithListInputMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: CreateUsersWithListInputMutationResponse; + error: never; + request: CreateUsersWithListInputMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: CreateUsersWithListInputMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Creates list of users with given input array * @summary Creates list of users with given input array * @link /user/createWithList */ -export function useCreateUsersWithListInputHook( - options: { - mutation?: UseMutationOptions - client?: CreateUsersWithListInput['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useCreateUsersWithListInputHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/user/createWithList', - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useCreateUsersWithListInputHook(options: { + mutation?: UseMutationOptions; + client?: CreateUsersWithListInput["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useCreateUsersWithListInputHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/user/createWithList`, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useDeleteOrderHook.ts b/examples/react-query-v5/src/gen/hooks/useDeleteOrderHook.ts index 29d3e5ae6..f3a400a5c 100644 --- a/examples/react-query-v5/src/gen/hooks/useDeleteOrderHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useDeleteOrderHook.ts @@ -1,50 +1,49 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, DeleteOrderPathParams } from '../models/DeleteOrder' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from "../models/DeleteOrder"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type DeleteOrderClient = typeof client + type DeleteOrderClient = typeof client; type DeleteOrder = { - data: DeleteOrderMutationResponse - error: DeleteOrder400 | DeleteOrder404 - request: never - pathParams: DeleteOrderPathParams - queryParams: never - headerParams: never - response: DeleteOrderMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: DeleteOrderMutationResponse; + error: DeleteOrder400 | DeleteOrder404; + request: never; + pathParams: DeleteOrderPathParams; + queryParams: never; + headerParams: never; + response: DeleteOrderMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * @link /store/order/:orderId */ -export function useDeleteOrderHook( - orderId: DeleteOrderPathParams['orderId'], - options: { - mutation?: UseMutationOptions - client?: DeleteOrder['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useDeleteOrderHook') - return useMutation({ - mutationFn: async () => { - const res = await client({ - method: 'delete', - url: `/store/order/${orderId}`, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useDeleteOrderHook(orderId: DeleteOrderPathParams["orderId"], options: { + mutation?: UseMutationOptions; + client?: DeleteOrder["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useDeleteOrderHook"); + return useMutation({ + mutationFn: async () => { + const res = await client({ + method: "delete", + url: `/store/order/${orderId}`, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useDeletePetHook.ts b/examples/react-query-v5/src/gen/hooks/useDeletePetHook.ts index ab5890e8f..1bab86b38 100644 --- a/examples/react-query-v5/src/gen/hooks/useDeletePetHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useDeletePetHook.ts @@ -1,52 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { DeletePet400, DeletePetHeaderParams, DeletePetMutationResponse, DeletePetPathParams } from '../models/DeletePet' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from "../models/DeletePet"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type DeletePetClient = typeof client + type DeletePetClient = typeof client; type DeletePet = { - data: DeletePetMutationResponse - error: DeletePet400 - request: never - pathParams: DeletePetPathParams - queryParams: never - headerParams: DeletePetHeaderParams - response: DeletePetMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: DeletePetMutationResponse; + error: DeletePet400; + request: never; + pathParams: DeletePetPathParams; + queryParams: never; + headerParams: DeletePetHeaderParams; + response: DeletePetMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description delete a pet * @summary Deletes a pet * @link /pet/:petId */ -export function useDeletePetHook( - petId: DeletePetPathParams['petId'], - headers?: DeletePet['headerParams'], - options: { - mutation?: UseMutationOptions - client?: DeletePet['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useDeletePetHook') - return useMutation({ - mutationFn: async () => { - const res = await client({ - method: 'delete', - url: `/pet/${petId}`, - headers: { ...headers, ...clientOptions.headers }, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useDeletePetHook(petId: DeletePetPathParams["petId"], headers?: DeletePet["headerParams"], options: { + mutation?: UseMutationOptions; + client?: DeletePet["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useDeletePetHook"); + return useMutation({ + mutationFn: async () => { + const res = await client({ + method: "delete", + url: `/pet/${petId}`, + headers: { ...headers, ...clientOptions.headers }, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useDeleteUserHook.ts b/examples/react-query-v5/src/gen/hooks/useDeleteUserHook.ts index f6a92f4fb..77e43d513 100644 --- a/examples/react-query-v5/src/gen/hooks/useDeleteUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useDeleteUserHook.ts @@ -1,50 +1,49 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUserPathParams } from '../models/DeleteUser' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from "../models/DeleteUser"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type DeleteUserClient = typeof client + type DeleteUserClient = typeof client; type DeleteUser = { - data: DeleteUserMutationResponse - error: DeleteUser400 | DeleteUser404 - request: never - pathParams: DeleteUserPathParams - queryParams: never - headerParams: never - response: DeleteUserMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: DeleteUserMutationResponse; + error: DeleteUser400 | DeleteUser404; + request: never; + pathParams: DeleteUserPathParams; + queryParams: never; + headerParams: never; + response: DeleteUserMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description This can only be done by the logged in user. * @summary Delete user * @link /user/:username */ -export function useDeleteUserHook( - username: DeleteUserPathParams['username'], - options: { - mutation?: UseMutationOptions - client?: DeleteUser['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useDeleteUserHook') - return useMutation({ - mutationFn: async () => { - const res = await client({ - method: 'delete', - url: `/user/${username}`, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useDeleteUserHook(username: DeleteUserPathParams["username"], options: { + mutation?: UseMutationOptions; + client?: DeleteUser["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useDeleteUserHook"); + return useMutation({ + mutationFn: async () => { + const res = await client({ + method: "delete", + url: `/user/${username}`, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts b/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts index e6ec86077..f7c10e351 100644 --- a/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useFindPetsByStatusHook.ts @@ -1,110 +1,99 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { FindPetsByStatus400, FindPetsByStatusQueryParams, FindPetsByStatusQueryResponse } from '../models/FindPetsByStatus' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from "../models/FindPetsByStatus"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type FindPetsByStatusClient = typeof client + type FindPetsByStatusClient = typeof client; type FindPetsByStatus = { - data: FindPetsByStatusQueryResponse - error: FindPetsByStatus400 - request: never - pathParams: never - queryParams: FindPetsByStatusQueryParams - headerParams: never - response: FindPetsByStatusQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const findPetsByStatusQueryKey = (params?: FindPetsByStatus['queryParams']) => ['v5', { url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const -export type FindPetsByStatusQueryKey = ReturnType -export function findPetsByStatusQueryOptions(params?: FindPetsByStatus['queryParams'], options: FindPetsByStatus['client']['parameters'] = {}) { - const queryKey = findPetsByStatusQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/pet/findByStatus', - params, - ...options, - }) - return res.data - }, - }) + data: FindPetsByStatusQueryResponse; + error: FindPetsByStatus400; + request: never; + pathParams: never; + queryParams: FindPetsByStatusQueryParams; + headerParams: never; + response: FindPetsByStatusQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const findPetsByStatusQueryKey = (params?: FindPetsByStatus["queryParams"]) => ["v5", { url: "/pet/findByStatus" }, ...(params ? [params] : [])] as const; +export type FindPetsByStatusQueryKey = ReturnType; +export function findPetsByStatusQueryOptions(params?: FindPetsByStatus["queryParams"], options: FindPetsByStatus["client"]["parameters"] = {}) { + const queryKey = findPetsByStatusQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/pet/findByStatus`, + params, + ...options + }); + return res.data; + }, + }); } /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * @link /pet/findByStatus */ -export function useFindPetsByStatusHook< - TData = FindPetsByStatus['response'], - TQueryData = FindPetsByStatus['response'], - TQueryKey extends QueryKey = FindPetsByStatusQueryKey, ->( - params?: FindPetsByStatus['queryParams'], - options: { - query?: Partial> - client?: FindPetsByStatus['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useFindPetsByStatusHook(params?: FindPetsByStatus["queryParams"], options: { + query?: Partial>; + client?: FindPetsByStatus["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params) - const query = useQuery({ - ...(findPetsByStatusQueryOptions(params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params); + const query = useQuery({ + ...findPetsByStatusQueryOptions(params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const findPetsByStatusSuspenseQueryKey = (params?: FindPetsByStatus['queryParams']) => - ['v5', { url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const -export type FindPetsByStatusSuspenseQueryKey = ReturnType -export function findPetsByStatusSuspenseQueryOptions(params?: FindPetsByStatus['queryParams'], options: FindPetsByStatus['client']['parameters'] = {}) { - const queryKey = findPetsByStatusSuspenseQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/pet/findByStatus', - params, - ...options, - }) - return res.data - }, - }) +export const findPetsByStatusSuspenseQueryKey = (params?: FindPetsByStatus["queryParams"]) => ["v5", { url: "/pet/findByStatus" }, ...(params ? [params] : [])] as const; +export type FindPetsByStatusSuspenseQueryKey = ReturnType; +export function findPetsByStatusSuspenseQueryOptions(params?: FindPetsByStatus["queryParams"], options: FindPetsByStatus["client"]["parameters"] = {}) { + const queryKey = findPetsByStatusSuspenseQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/pet/findByStatus`, + params, + ...options + }); + return res.data; + }, + }); } /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * @link /pet/findByStatus */ -export function useFindPetsByStatusHookSuspense( - params?: FindPetsByStatus['queryParams'], - options: { - query?: Partial> - client?: FindPetsByStatus['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useFindPetsByStatusHookSuspense(params?: FindPetsByStatus["queryParams"], options: { + query?: Partial>; + client?: FindPetsByStatus["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByStatusSuspenseQueryKey(params) - const query = useSuspenseQuery({ - ...(findPetsByStatusSuspenseQueryOptions(params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByStatusSuspenseQueryKey(params); + const query = useSuspenseQuery({ + ...findPetsByStatusSuspenseQueryOptions(params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts b/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts index 9a0798d6e..64e504064 100644 --- a/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useFindPetsByTagsHook.ts @@ -1,172 +1,146 @@ -import client from '@kubb/swagger-client/client' -import { infiniteQueryOptions, queryOptions, useInfiniteQuery, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { - InfiniteData, - InfiniteQueryObserverOptions, - QueryKey, - QueryObserverOptions, - UseInfiniteQueryResult, - UseQueryResult, - UseSuspenseQueryOptions, - UseSuspenseQueryResult, -} from '@tanstack/react-query' -import type { FindPetsByTags400, FindPetsByTagsQueryParams, FindPetsByTagsQueryResponse } from '../models/FindPetsByTags' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useInfiniteQuery, infiniteQueryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from "../models/FindPetsByTags"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult, InfiniteData, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type FindPetsByTagsClient = typeof client + type FindPetsByTagsClient = typeof client; type FindPetsByTags = { - data: FindPetsByTagsQueryResponse - error: FindPetsByTags400 - request: never - pathParams: never - queryParams: FindPetsByTagsQueryParams - headerParams: never - response: Awaited> - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const findPetsByTagsQueryKey = (params?: FindPetsByTags['queryParams']) => ['/pet/findByTags', ...(params ? [params] : [])] as const -export type FindPetsByTagsQueryKey = ReturnType -export function findPetsByTagsQueryOptions(params?: FindPetsByTags['queryParams'], options: FindPetsByTags['client']['parameters'] = {}) { - const queryKey = findPetsByTagsQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/pet/findByTags', - params, - ...options, - }) - return res - }, - }) + data: FindPetsByTagsQueryResponse; + error: FindPetsByTags400; + request: never; + pathParams: never; + queryParams: FindPetsByTagsQueryParams; + headerParams: never; + response: Awaited>; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const findPetsByTagsQueryKey = (params?: FindPetsByTags["queryParams"]) => ["/pet/findByTags", ...(params ? [params] : [])] as const; +export type FindPetsByTagsQueryKey = ReturnType; +export function findPetsByTagsQueryOptions(params?: FindPetsByTags["queryParams"], options: FindPetsByTags["client"]["parameters"] = {}) { + const queryKey = findPetsByTagsQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/pet/findByTags`, + params, + ...options + }); + return res; + }, + }); } /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTagsHook< - TData = FindPetsByTags['response'], - TQueryData = FindPetsByTags['response'], - TQueryKey extends QueryKey = FindPetsByTagsQueryKey, ->( - params?: FindPetsByTags['queryParams'], - options: { - query?: Partial> - client?: FindPetsByTags['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useFindPetsByTagsHook(params?: FindPetsByTags["queryParams"], options: { + query?: Partial>; + client?: FindPetsByTags["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params) - const query = useQuery({ - ...(findPetsByTagsQueryOptions(params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); + const query = useQuery({ + ...findPetsByTagsQueryOptions(params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTags['queryParams']) => ['/pet/findByTags', ...(params ? [params] : [])] as const -export type FindPetsByTagsInfiniteQueryKey = ReturnType -export function findPetsByTagsInfiniteQueryOptions(params?: FindPetsByTags['queryParams'], options: FindPetsByTags['client']['parameters'] = {}) { - const queryKey = findPetsByTagsInfiniteQueryKey(params) - return infiniteQueryOptions({ - queryKey, - queryFn: async ({ pageParam }) => { - const res = await client({ - method: 'get', - url: '/pet/findByTags', - ...options, - params: { - ...params, - ['pageSize']: pageParam, - ...(options.params || {}), +export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTags["queryParams"]) => ["/pet/findByTags", ...(params ? [params] : [])] as const; +export type FindPetsByTagsInfiniteQueryKey = ReturnType; +export function findPetsByTagsInfiniteQueryOptions(params?: FindPetsByTags["queryParams"], options: FindPetsByTags["client"]["parameters"] = {}) { + const queryKey = findPetsByTagsInfiniteQueryKey(params); + return infiniteQueryOptions({ + queryKey, + queryFn: async ({ pageParam }) => { + const res = await client({ + method: "get", + url: `/pet/findByTags`, + ...options, + params: { + ...params, + ["pageSize"]: pageParam, + ...(options.params || {}), + } + }); + return res; }, - }) - return res - }, - initialPageParam: 0, - getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1), - getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1), - }) + initialPageParam: 0, + getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1, + getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1 + }); } /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTagsHookInfinite< - TData = InfiniteData, - TQueryData = FindPetsByTags['response'], - TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey, ->( - params?: FindPetsByTags['queryParams'], - options: { - query?: Partial> - client?: FindPetsByTags['client']['parameters'] - } = {}, -): UseInfiniteQueryResult & { - queryKey: TQueryKey +export function useFindPetsByTagsHookInfinite, TQueryData = FindPetsByTags["response"], TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(params?: FindPetsByTags["queryParams"], options: { + query?: Partial>; + client?: FindPetsByTags["client"]["parameters"]; +} = {}): UseInfiniteQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params) - const query = useInfiniteQuery({ - ...(findPetsByTagsInfiniteQueryOptions(params, clientOptions) as unknown as InfiniteQueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseInfiniteQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params); + const query = useInfiniteQuery({ + ...findPetsByTagsInfiniteQueryOptions(params, clientOptions) as unknown as InfiniteQueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseInfiniteQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const findPetsByTagsSuspenseQueryKey = (params?: FindPetsByTags['queryParams']) => ['/pet/findByTags', ...(params ? [params] : [])] as const -export type FindPetsByTagsSuspenseQueryKey = ReturnType -export function findPetsByTagsSuspenseQueryOptions(params?: FindPetsByTags['queryParams'], options: FindPetsByTags['client']['parameters'] = {}) { - const queryKey = findPetsByTagsSuspenseQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/pet/findByTags', - params, - ...options, - }) - return res - }, - }) +export const findPetsByTagsSuspenseQueryKey = (params?: FindPetsByTags["queryParams"]) => ["/pet/findByTags", ...(params ? [params] : [])] as const; +export type FindPetsByTagsSuspenseQueryKey = ReturnType; +export function findPetsByTagsSuspenseQueryOptions(params?: FindPetsByTags["queryParams"], options: FindPetsByTags["client"]["parameters"] = {}) { + const queryKey = findPetsByTagsSuspenseQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/pet/findByTags`, + params, + ...options + }); + return res; + }, + }); } /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTagsHookSuspense( - params?: FindPetsByTags['queryParams'], - options: { - query?: Partial> - client?: FindPetsByTags['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useFindPetsByTagsHookSuspense(params?: FindPetsByTags["queryParams"], options: { + query?: Partial>; + client?: FindPetsByTags["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseQueryKey(params) - const query = useSuspenseQuery({ - ...(findPetsByTagsSuspenseQueryOptions(params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseQueryKey(params); + const query = useSuspenseQuery({ + ...findPetsByTagsSuspenseQueryOptions(params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts b/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts index f1a8f9833..c8756d9e7 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetInventoryHook.ts @@ -1,101 +1,97 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { GetInventoryQueryResponse } from '../models/GetInventory' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { GetInventoryQueryResponse } from "../models/GetInventory"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type GetInventoryClient = typeof client + type GetInventoryClient = typeof client; type GetInventory = { - data: GetInventoryQueryResponse - error: never - request: never - pathParams: never - queryParams: never - headerParams: never - response: GetInventoryQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getInventoryQueryKey = () => ['v5', { url: '/store/inventory' }] as const -export type GetInventoryQueryKey = ReturnType -export function getInventoryQueryOptions(options: GetInventory['client']['parameters'] = {}) { - const queryKey = getInventoryQueryKey() - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/store/inventory', - ...options, - }) - return res.data - }, - }) + data: GetInventoryQueryResponse; + error: never; + request: never; + pathParams: never; + queryParams: never; + headerParams: never; + response: GetInventoryQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getInventoryQueryKey = () => ["v5", { url: "/store/inventory" }] as const; +export type GetInventoryQueryKey = ReturnType; +export function getInventoryQueryOptions(options: GetInventory["client"]["parameters"] = {}) { + const queryKey = getInventoryQueryKey(); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/store/inventory`, + ...options + }); + return res.data; + }, + }); } /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * @link /store/inventory */ -export function useGetInventoryHook( - options: { - query?: Partial> - client?: GetInventory['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useGetInventoryHook(options: { + query?: Partial>; + client?: GetInventory["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey() - const query = useQuery({ - ...(getInventoryQueryOptions(clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey(); + const query = useQuery({ + ...getInventoryQueryOptions(clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const getInventorySuspenseQueryKey = () => ['v5', { url: '/store/inventory' }] as const -export type GetInventorySuspenseQueryKey = ReturnType -export function getInventorySuspenseQueryOptions(options: GetInventory['client']['parameters'] = {}) { - const queryKey = getInventorySuspenseQueryKey() - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/store/inventory', - ...options, - }) - return res.data - }, - }) +export const getInventorySuspenseQueryKey = () => ["v5", { url: "/store/inventory" }] as const; +export type GetInventorySuspenseQueryKey = ReturnType; +export function getInventorySuspenseQueryOptions(options: GetInventory["client"]["parameters"] = {}) { + const queryKey = getInventorySuspenseQueryKey(); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/store/inventory`, + ...options + }); + return res.data; + }, + }); } /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * @link /store/inventory */ -export function useGetInventoryHookSuspense( - options: { - query?: Partial> - client?: GetInventory['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useGetInventoryHookSuspense(options: { + query?: Partial>; + client?: GetInventory["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getInventorySuspenseQueryKey() - const query = useSuspenseQuery({ - ...(getInventorySuspenseQueryOptions(clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getInventorySuspenseQueryKey(); + const query = useSuspenseQuery({ + ...getInventorySuspenseQueryOptions(clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts b/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts index 6b138a91f..1e5bc115b 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetOrderByIdHook.ts @@ -1,105 +1,97 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { GetOrderById400, GetOrderById404, GetOrderByIdPathParams, GetOrderByIdQueryResponse } from '../models/GetOrderById' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from "../models/GetOrderById"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type GetOrderByIdClient = typeof client + type GetOrderByIdClient = typeof client; type GetOrderById = { - data: GetOrderByIdQueryResponse - error: GetOrderById400 | GetOrderById404 - request: never - pathParams: GetOrderByIdPathParams - queryParams: never - headerParams: never - response: GetOrderByIdQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => - ['v5', { url: '/store/order/:orderId', params: { orderId: orderId } }] as const -export type GetOrderByIdQueryKey = ReturnType -export function getOrderByIdQueryOptions(orderId: GetOrderByIdPathParams['orderId'], options: GetOrderById['client']['parameters'] = {}) { - const queryKey = getOrderByIdQueryKey(orderId) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: `/store/order/${orderId}`, - ...options, - }) - return res.data - }, - }) + data: GetOrderByIdQueryResponse; + error: GetOrderById400 | GetOrderById404; + request: never; + pathParams: GetOrderByIdPathParams; + queryParams: never; + headerParams: never; + response: GetOrderByIdQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams["orderId"]) => ["v5", { url: "/store/order/:orderId", params: { orderId: orderId } }] as const; +export type GetOrderByIdQueryKey = ReturnType; +export function getOrderByIdQueryOptions(orderId: GetOrderByIdPathParams["orderId"], options: GetOrderById["client"]["parameters"] = {}) { + const queryKey = getOrderByIdQueryKey(orderId); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/store/order/${orderId}`, + ...options + }); + return res.data; + }, + }); } /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * @link /store/order/:orderId */ -export function useGetOrderByIdHook( - orderId: GetOrderByIdPathParams['orderId'], - options: { - query?: Partial> - client?: GetOrderById['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useGetOrderByIdHook(orderId: GetOrderByIdPathParams["orderId"], options: { + query?: Partial>; + client?: GetOrderById["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey(orderId) - const query = useQuery({ - ...(getOrderByIdQueryOptions(orderId, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey(orderId); + const query = useQuery({ + ...getOrderByIdQueryOptions(orderId, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const getOrderByIdSuspenseQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => - ['v5', { url: '/store/order/:orderId', params: { orderId: orderId } }] as const -export type GetOrderByIdSuspenseQueryKey = ReturnType -export function getOrderByIdSuspenseQueryOptions(orderId: GetOrderByIdPathParams['orderId'], options: GetOrderById['client']['parameters'] = {}) { - const queryKey = getOrderByIdSuspenseQueryKey(orderId) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: `/store/order/${orderId}`, - ...options, - }) - return res.data - }, - }) +export const getOrderByIdSuspenseQueryKey = (orderId: GetOrderByIdPathParams["orderId"]) => ["v5", { url: "/store/order/:orderId", params: { orderId: orderId } }] as const; +export type GetOrderByIdSuspenseQueryKey = ReturnType; +export function getOrderByIdSuspenseQueryOptions(orderId: GetOrderByIdPathParams["orderId"], options: GetOrderById["client"]["parameters"] = {}) { + const queryKey = getOrderByIdSuspenseQueryKey(orderId); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/store/order/${orderId}`, + ...options + }); + return res.data; + }, + }); } /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * @link /store/order/:orderId */ -export function useGetOrderByIdHookSuspense( - orderId: GetOrderByIdPathParams['orderId'], - options: { - query?: Partial> - client?: GetOrderById['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useGetOrderByIdHookSuspense(orderId: GetOrderByIdPathParams["orderId"], options: { + query?: Partial>; + client?: GetOrderById["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getOrderByIdSuspenseQueryKey(orderId) - const query = useSuspenseQuery({ - ...(getOrderByIdSuspenseQueryOptions(orderId, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getOrderByIdSuspenseQueryKey(orderId); + const query = useSuspenseQuery({ + ...getOrderByIdSuspenseQueryOptions(orderId, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts b/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts index fcd1822f0..daf9aea6e 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetPetByIdHook.ts @@ -1,103 +1,97 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQueryResponse } from '../models/GetPetById' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from "../models/GetPetById"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type GetPetByIdClient = typeof client + type GetPetByIdClient = typeof client; type GetPetById = { - data: GetPetByIdQueryResponse - error: GetPetById400 | GetPetById404 - request: never - pathParams: GetPetByIdPathParams - queryParams: never - headerParams: never - response: GetPetByIdQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => ['v5', { url: '/pet/:petId', params: { petId: petId } }] as const -export type GetPetByIdQueryKey = ReturnType -export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['petId'], options: GetPetById['client']['parameters'] = {}) { - const queryKey = getPetByIdQueryKey(petId) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: `/pet/${petId}`, - ...options, - }) - return res.data - }, - }) + data: GetPetByIdQueryResponse; + error: GetPetById400 | GetPetById404; + request: never; + pathParams: GetPetByIdPathParams; + queryParams: never; + headerParams: never; + response: GetPetByIdQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getPetByIdQueryKey = (petId: GetPetByIdPathParams["petId"]) => ["v5", { url: "/pet/:petId", params: { petId: petId } }] as const; +export type GetPetByIdQueryKey = ReturnType; +export function getPetByIdQueryOptions(petId: GetPetByIdPathParams["petId"], options: GetPetById["client"]["parameters"] = {}) { + const queryKey = getPetByIdQueryKey(petId); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/pet/${petId}`, + ...options + }); + return res.data; + }, + }); } /** * @description Returns a single pet * @summary Find pet by ID * @link /pet/:petId */ -export function useGetPetByIdHook( - petId: GetPetByIdPathParams['petId'], - options: { - query?: Partial> - client?: GetPetById['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useGetPetByIdHook(petId: GetPetByIdPathParams["petId"], options: { + query?: Partial>; + client?: GetPetById["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId) - const query = useQuery({ - ...(getPetByIdQueryOptions(petId, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId); + const query = useQuery({ + ...getPetByIdQueryOptions(petId, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const getPetByIdSuspenseQueryKey = (petId: GetPetByIdPathParams['petId']) => ['v5', { url: '/pet/:petId', params: { petId: petId } }] as const -export type GetPetByIdSuspenseQueryKey = ReturnType -export function getPetByIdSuspenseQueryOptions(petId: GetPetByIdPathParams['petId'], options: GetPetById['client']['parameters'] = {}) { - const queryKey = getPetByIdSuspenseQueryKey(petId) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: `/pet/${petId}`, - ...options, - }) - return res.data - }, - }) +export const getPetByIdSuspenseQueryKey = (petId: GetPetByIdPathParams["petId"]) => ["v5", { url: "/pet/:petId", params: { petId: petId } }] as const; +export type GetPetByIdSuspenseQueryKey = ReturnType; +export function getPetByIdSuspenseQueryOptions(petId: GetPetByIdPathParams["petId"], options: GetPetById["client"]["parameters"] = {}) { + const queryKey = getPetByIdSuspenseQueryKey(petId); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/pet/${petId}`, + ...options + }); + return res.data; + }, + }); } /** * @description Returns a single pet * @summary Find pet by ID * @link /pet/:petId */ -export function useGetPetByIdHookSuspense( - petId: GetPetByIdPathParams['petId'], - options: { - query?: Partial> - client?: GetPetById['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useGetPetByIdHookSuspense(petId: GetPetByIdPathParams["petId"], options: { + query?: Partial>; + client?: GetPetById["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdSuspenseQueryKey(petId) - const query = useSuspenseQuery({ - ...(getPetByIdSuspenseQueryOptions(petId, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getPetByIdSuspenseQueryKey(petId); + const query = useSuspenseQuery({ + ...getPetByIdSuspenseQueryOptions(petId, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts b/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts index cd44fdf16..f49556b11 100644 --- a/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useGetUserByNameHook.ts @@ -1,107 +1,95 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUserByNameQueryResponse } from '../models/GetUserByName' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from "../models/GetUserByName"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type GetUserByNameClient = typeof client + type GetUserByNameClient = typeof client; type GetUserByName = { - data: GetUserByNameQueryResponse - error: GetUserByName400 | GetUserByName404 - request: never - pathParams: GetUserByNamePathParams - queryParams: never - headerParams: never - response: GetUserByNameQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => - ['v5', { url: '/user/:username', params: { username: username } }] as const -export type GetUserByNameQueryKey = ReturnType -export function getUserByNameQueryOptions(username: GetUserByNamePathParams['username'], options: GetUserByName['client']['parameters'] = {}) { - const queryKey = getUserByNameQueryKey(username) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: `/user/${username}`, - ...options, - }) - return res.data - }, - }) + data: GetUserByNameQueryResponse; + error: GetUserByName400 | GetUserByName404; + request: never; + pathParams: GetUserByNamePathParams; + queryParams: never; + headerParams: never; + response: GetUserByNameQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getUserByNameQueryKey = (username: GetUserByNamePathParams["username"]) => ["v5", { url: "/user/:username", params: { username: username } }] as const; +export type GetUserByNameQueryKey = ReturnType; +export function getUserByNameQueryOptions(username: GetUserByNamePathParams["username"], options: GetUserByName["client"]["parameters"] = {}) { + const queryKey = getUserByNameQueryKey(username); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/user/${username}`, + ...options + }); + return res.data; + }, + }); } /** * @summary Get user by user name * @link /user/:username */ -export function useGetUserByNameHook< - TData = GetUserByName['response'], - TQueryData = GetUserByName['response'], - TQueryKey extends QueryKey = GetUserByNameQueryKey, ->( - username: GetUserByNamePathParams['username'], - options: { - query?: Partial> - client?: GetUserByName['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useGetUserByNameHook(username: GetUserByNamePathParams["username"], options: { + query?: Partial>; + client?: GetUserByName["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(username) - const query = useQuery({ - ...(getUserByNameQueryOptions(username, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(username); + const query = useQuery({ + ...getUserByNameQueryOptions(username, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const getUserByNameSuspenseQueryKey = (username: GetUserByNamePathParams['username']) => - ['v5', { url: '/user/:username', params: { username: username } }] as const -export type GetUserByNameSuspenseQueryKey = ReturnType -export function getUserByNameSuspenseQueryOptions(username: GetUserByNamePathParams['username'], options: GetUserByName['client']['parameters'] = {}) { - const queryKey = getUserByNameSuspenseQueryKey(username) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: `/user/${username}`, - ...options, - }) - return res.data - }, - }) +export const getUserByNameSuspenseQueryKey = (username: GetUserByNamePathParams["username"]) => ["v5", { url: "/user/:username", params: { username: username } }] as const; +export type GetUserByNameSuspenseQueryKey = ReturnType; +export function getUserByNameSuspenseQueryOptions(username: GetUserByNamePathParams["username"], options: GetUserByName["client"]["parameters"] = {}) { + const queryKey = getUserByNameSuspenseQueryKey(username); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/user/${username}`, + ...options + }); + return res.data; + }, + }); } /** * @summary Get user by user name * @link /user/:username */ -export function useGetUserByNameHookSuspense( - username: GetUserByNamePathParams['username'], - options: { - query?: Partial> - client?: GetUserByName['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useGetUserByNameHookSuspense(username: GetUserByNamePathParams["username"], options: { + query?: Partial>; + client?: GetUserByName["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameSuspenseQueryKey(username) - const query = useSuspenseQuery({ - ...(getUserByNameSuspenseQueryOptions(username, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getUserByNameSuspenseQueryKey(username); + const query = useSuspenseQuery({ + ...getUserByNameSuspenseQueryOptions(username, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts b/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts index 6b80522d2..0ffee680e 100644 --- a/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useLoginUserHook.ts @@ -1,103 +1,97 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { LoginUser400, LoginUserQueryParams, LoginUserQueryResponse } from '../models/LoginUser' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from "../models/LoginUser"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type LoginUserClient = typeof client + type LoginUserClient = typeof client; type LoginUser = { - data: LoginUserQueryResponse - error: LoginUser400 - request: never - pathParams: never - queryParams: LoginUserQueryParams - headerParams: never - response: LoginUserQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const loginUserQueryKey = (params?: LoginUser['queryParams']) => ['v5', { url: '/user/login' }, ...(params ? [params] : [])] as const -export type LoginUserQueryKey = ReturnType -export function loginUserQueryOptions(params?: LoginUser['queryParams'], options: LoginUser['client']['parameters'] = {}) { - const queryKey = loginUserQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/user/login', - params, - ...options, - }) - return res.data - }, - }) + data: LoginUserQueryResponse; + error: LoginUser400; + request: never; + pathParams: never; + queryParams: LoginUserQueryParams; + headerParams: never; + response: LoginUserQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const loginUserQueryKey = (params?: LoginUser["queryParams"]) => ["v5", { url: "/user/login" }, ...(params ? [params] : [])] as const; +export type LoginUserQueryKey = ReturnType; +export function loginUserQueryOptions(params?: LoginUser["queryParams"], options: LoginUser["client"]["parameters"] = {}) { + const queryKey = loginUserQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/user/login`, + params, + ...options + }); + return res.data; + }, + }); } /** * @summary Logs user into the system * @link /user/login */ -export function useLoginUserHook( - params?: LoginUser['queryParams'], - options: { - query?: Partial> - client?: LoginUser['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useLoginUserHook(params?: LoginUser["queryParams"], options: { + query?: Partial>; + client?: LoginUser["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params) - const query = useQuery({ - ...(loginUserQueryOptions(params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params); + const query = useQuery({ + ...loginUserQueryOptions(params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const loginUserSuspenseQueryKey = (params?: LoginUser['queryParams']) => ['v5', { url: '/user/login' }, ...(params ? [params] : [])] as const -export type LoginUserSuspenseQueryKey = ReturnType -export function loginUserSuspenseQueryOptions(params?: LoginUser['queryParams'], options: LoginUser['client']['parameters'] = {}) { - const queryKey = loginUserSuspenseQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/user/login', - params, - ...options, - }) - return res.data - }, - }) +export const loginUserSuspenseQueryKey = (params?: LoginUser["queryParams"]) => ["v5", { url: "/user/login" }, ...(params ? [params] : [])] as const; +export type LoginUserSuspenseQueryKey = ReturnType; +export function loginUserSuspenseQueryOptions(params?: LoginUser["queryParams"], options: LoginUser["client"]["parameters"] = {}) { + const queryKey = loginUserSuspenseQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/user/login`, + params, + ...options + }); + return res.data; + }, + }); } /** * @summary Logs user into the system * @link /user/login */ -export function useLoginUserHookSuspense( - params?: LoginUser['queryParams'], - options: { - query?: Partial> - client?: LoginUser['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useLoginUserHookSuspense(params?: LoginUser["queryParams"], options: { + query?: Partial>; + client?: LoginUser["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? loginUserSuspenseQueryKey(params) - const query = useSuspenseQuery({ - ...(loginUserSuspenseQueryOptions(params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? loginUserSuspenseQueryKey(params); + const query = useSuspenseQuery({ + ...loginUserSuspenseQueryOptions(params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts b/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts index e5d7d7841..b7eaa5186 100644 --- a/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useLogoutUserHook.ts @@ -1,99 +1,95 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { LogoutUserQueryResponse } from '../models/LogoutUser' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { LogoutUserQueryResponse } from "../models/LogoutUser"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type LogoutUserClient = typeof client + type LogoutUserClient = typeof client; type LogoutUser = { - data: LogoutUserQueryResponse - error: never - request: never - pathParams: never - queryParams: never - headerParams: never - response: LogoutUserQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const logoutUserQueryKey = () => ['v5', { url: '/user/logout' }] as const -export type LogoutUserQueryKey = ReturnType -export function logoutUserQueryOptions(options: LogoutUser['client']['parameters'] = {}) { - const queryKey = logoutUserQueryKey() - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/user/logout', - ...options, - }) - return res.data - }, - }) + data: LogoutUserQueryResponse; + error: never; + request: never; + pathParams: never; + queryParams: never; + headerParams: never; + response: LogoutUserQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const logoutUserQueryKey = () => ["v5", { url: "/user/logout" }] as const; +export type LogoutUserQueryKey = ReturnType; +export function logoutUserQueryOptions(options: LogoutUser["client"]["parameters"] = {}) { + const queryKey = logoutUserQueryKey(); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/user/logout`, + ...options + }); + return res.data; + }, + }); } /** * @summary Logs out current logged in user session * @link /user/logout */ -export function useLogoutUserHook( - options: { - query?: Partial> - client?: LogoutUser['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useLogoutUserHook(options: { + query?: Partial>; + client?: LogoutUser["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey() - const query = useQuery({ - ...(logoutUserQueryOptions(clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey(); + const query = useQuery({ + ...logoutUserQueryOptions(clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const logoutUserSuspenseQueryKey = () => ['v5', { url: '/user/logout' }] as const -export type LogoutUserSuspenseQueryKey = ReturnType -export function logoutUserSuspenseQueryOptions(options: LogoutUser['client']['parameters'] = {}) { - const queryKey = logoutUserSuspenseQueryKey() - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/user/logout', - ...options, - }) - return res.data - }, - }) +export const logoutUserSuspenseQueryKey = () => ["v5", { url: "/user/logout" }] as const; +export type LogoutUserSuspenseQueryKey = ReturnType; +export function logoutUserSuspenseQueryOptions(options: LogoutUser["client"]["parameters"] = {}) { + const queryKey = logoutUserSuspenseQueryKey(); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/user/logout`, + ...options + }); + return res.data; + }, + }); } /** * @summary Logs out current logged in user session * @link /user/logout */ -export function useLogoutUserHookSuspense( - options: { - query?: Partial> - client?: LogoutUser['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useLogoutUserHookSuspense(options: { + query?: Partial>; + client?: LogoutUser["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? logoutUserSuspenseQueryKey() - const query = useSuspenseQuery({ - ...(logoutUserSuspenseQueryOptions(clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? logoutUserSuspenseQueryKey(); + const query = useSuspenseQuery({ + ...logoutUserSuspenseQueryOptions(clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/usePlaceOrderHook.ts b/examples/react-query-v5/src/gen/hooks/usePlaceOrderHook.ts index d0860e613..72264f567 100644 --- a/examples/react-query-v5/src/gen/hooks/usePlaceOrderHook.ts +++ b/examples/react-query-v5/src/gen/hooks/usePlaceOrderHook.ts @@ -1,50 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationResponse } from '../models/PlaceOrder' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from "../models/PlaceOrder"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type PlaceOrderClient = typeof client + type PlaceOrderClient = typeof client; type PlaceOrder = { - data: PlaceOrderMutationResponse - error: PlaceOrder405 - request: PlaceOrderMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: PlaceOrderMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: PlaceOrderMutationResponse; + error: PlaceOrder405; + request: PlaceOrderMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: PlaceOrderMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Place a new order in the store * @summary Place an order for a pet * @link /store/order */ -export function usePlaceOrderHook( - options: { - mutation?: UseMutationOptions - client?: PlaceOrder['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('usePlaceOrderHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/store/order', - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function usePlaceOrderHook(options: { + mutation?: UseMutationOptions; + client?: PlaceOrder["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("usePlaceOrderHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/store/order`, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/usePlaceOrderPatchHook.ts b/examples/react-query-v5/src/gen/hooks/usePlaceOrderPatchHook.ts index e4b99aee1..b9435de7c 100644 --- a/examples/react-query-v5/src/gen/hooks/usePlaceOrderPatchHook.ts +++ b/examples/react-query-v5/src/gen/hooks/usePlaceOrderPatchHook.ts @@ -1,50 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { PlaceOrderPatch405, PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse } from '../models/PlaceOrderPatch' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from "../models/PlaceOrderPatch"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type PlaceOrderPatchClient = typeof client + type PlaceOrderPatchClient = typeof client; type PlaceOrderPatch = { - data: PlaceOrderPatchMutationResponse - error: PlaceOrderPatch405 - request: PlaceOrderPatchMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: PlaceOrderPatchMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: PlaceOrderPatchMutationResponse; + error: PlaceOrderPatch405; + request: PlaceOrderPatchMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: PlaceOrderPatchMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Place a new order in the store with patch * @summary Place an order for a pet with patch * @link /store/order */ -export function usePlaceOrderPatchHook( - options: { - mutation?: UseMutationOptions - client?: PlaceOrderPatch['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('usePlaceOrderPatchHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'patch', - url: '/store/order', - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function usePlaceOrderPatchHook(options: { + mutation?: UseMutationOptions; + client?: PlaceOrderPatch["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("usePlaceOrderPatchHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "patch", + url: `/store/order`, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useUpdatePetHook.ts b/examples/react-query-v5/src/gen/hooks/useUpdatePetHook.ts index 7803c3462..9875427c2 100644 --- a/examples/react-query-v5/src/gen/hooks/useUpdatePetHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useUpdatePetHook.ts @@ -1,50 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest, UpdatePetMutationResponse } from '../models/UpdatePet' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from "../models/UpdatePet"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type UpdatePetClient = typeof client + type UpdatePetClient = typeof client; type UpdatePet = { - data: UpdatePetMutationResponse - error: UpdatePet400 | UpdatePet404 | UpdatePet405 - request: UpdatePetMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: UpdatePetMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: UpdatePetMutationResponse; + error: UpdatePet400 | UpdatePet404 | UpdatePet405; + request: UpdatePetMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: UpdatePetMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Update an existing pet by Id * @summary Update an existing pet * @link /pet */ -export function useUpdatePetHook( - options: { - mutation?: UseMutationOptions - client?: UpdatePet['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useUpdatePetHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'put', - url: '/pet', - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useUpdatePetHook(options: { + mutation?: UseMutationOptions; + client?: UpdatePet["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useUpdatePetHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "put", + url: `/pet`, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useUpdatePetWithFormHook.ts b/examples/react-query-v5/src/gen/hooks/useUpdatePetWithFormHook.ts index 4a390cd19..e337d668d 100644 --- a/examples/react-query-v5/src/gen/hooks/useUpdatePetWithFormHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useUpdatePetWithFormHook.ts @@ -1,124 +1,97 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' -import type { QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import type { - UpdatePetWithForm405, - UpdatePetWithFormMutationResponse, - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, -} from '../models/UpdatePetWithForm' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405 } from "../models/UpdatePetWithForm"; +import type { QueryObserverOptions, UseQueryResult, QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -type UpdatePetWithFormClient = typeof client + type UpdatePetWithFormClient = typeof client; type UpdatePetWithForm = { - data: UpdatePetWithFormMutationResponse - error: UpdatePetWithForm405 - request: never - pathParams: UpdatePetWithFormPathParams - queryParams: UpdatePetWithFormQueryParams - headerParams: never - response: UpdatePetWithFormMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithForm['queryParams']) => - [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : [])] as const -export type UpdatePetWithFormQueryKey = ReturnType -export function updatePetWithFormQueryOptions( - petId: UpdatePetWithFormPathParams['petId'], - params?: UpdatePetWithForm['queryParams'], - options: UpdatePetWithForm['client']['parameters'] = {}, -) { - const queryKey = updatePetWithFormQueryKey(petId, params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'post', - url: `/pet/${petId}`, - params, - ...options, - }) - return res.data - }, - }) + data: UpdatePetWithFormMutationResponse; + error: UpdatePetWithForm405; + request: never; + pathParams: UpdatePetWithFormPathParams; + queryParams: UpdatePetWithFormQueryParams; + headerParams: never; + response: UpdatePetWithFormMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithForm["queryParams"]) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : [])] as const; +export type UpdatePetWithFormQueryKey = ReturnType; +export function updatePetWithFormQueryOptions(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithForm["queryParams"], options: UpdatePetWithForm["client"]["parameters"] = {}) { + const queryKey = updatePetWithFormQueryKey(petId, params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "post", + url: `/pet/${petId}`, + params, + ...options + }); + return res.data; + }, + }); } /** * @summary Updates a pet in the store with form data * @link /pet/:petId */ -export function useUpdatePetWithFormHook< - TData = UpdatePetWithForm['response'], - TQueryData = UpdatePetWithForm['response'], - TQueryKey extends QueryKey = UpdatePetWithFormQueryKey, ->( - petId: UpdatePetWithFormPathParams['petId'], - params?: UpdatePetWithForm['queryParams'], - options: { - query?: Partial> - client?: UpdatePetWithForm['client']['parameters'] - } = {}, -): UseQueryResult & { - queryKey: TQueryKey +export function useUpdatePetWithFormHook(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithForm["queryParams"], options: { + query?: Partial>; + client?: UpdatePetWithForm["client"]["parameters"]; +} = {}): UseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, params) - const query = useQuery({ - ...(updatePetWithFormQueryOptions(petId, params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, params); + const query = useQuery({ + ...updatePetWithFormQueryOptions(petId, params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; } -export const updatePetWithFormSuspenseQueryKey = (petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithForm['queryParams']) => - [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : [])] as const -export type UpdatePetWithFormSuspenseQueryKey = ReturnType -export function updatePetWithFormSuspenseQueryOptions( - petId: UpdatePetWithFormPathParams['petId'], - params?: UpdatePetWithForm['queryParams'], - options: UpdatePetWithForm['client']['parameters'] = {}, -) { - const queryKey = updatePetWithFormSuspenseQueryKey(petId, params) - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'post', - url: `/pet/${petId}`, - params, - ...options, - }) - return res.data - }, - }) +export const updatePetWithFormSuspenseQueryKey = (petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithForm["queryParams"]) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : [])] as const; +export type UpdatePetWithFormSuspenseQueryKey = ReturnType; +export function updatePetWithFormSuspenseQueryOptions(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithForm["queryParams"], options: UpdatePetWithForm["client"]["parameters"] = {}) { + const queryKey = updatePetWithFormSuspenseQueryKey(petId, params); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "post", + url: `/pet/${petId}`, + params, + ...options + }); + return res.data; + }, + }); } /** * @summary Updates a pet in the store with form data * @link /pet/:petId */ -export function useUpdatePetWithFormHookSuspense( - petId: UpdatePetWithFormPathParams['petId'], - params?: UpdatePetWithForm['queryParams'], - options: { - query?: Partial> - client?: UpdatePetWithForm['client']['parameters'] - } = {}, -): UseSuspenseQueryResult & { - queryKey: TQueryKey +export function useUpdatePetWithFormHookSuspense(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithForm["queryParams"], options: { + query?: Partial>; + client?: UpdatePetWithForm["client"]["parameters"]; +} = {}): UseSuspenseQueryResult & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? updatePetWithFormSuspenseQueryKey(petId, params) - const query = useSuspenseQuery({ - ...(updatePetWithFormSuspenseQueryOptions(petId, params, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? updatePetWithFormSuspenseQueryKey(petId, params); + const query = useSuspenseQuery({ + ...updatePetWithFormSuspenseQueryOptions(petId, params, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts b/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts index dc3a620b1..91c01efce 100644 --- a/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useUpdateUserHook.ts @@ -1,51 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from "../models/UpdateUser"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type UpdateUserClient = typeof client + type UpdateUserClient = typeof client; type UpdateUser = { - data: UpdateUserMutationResponse - error: never - request: UpdateUserMutationRequest - pathParams: UpdateUserPathParams - queryParams: never - headerParams: never - response: UpdateUserMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: UpdateUserMutationResponse; + error: never; + request: UpdateUserMutationRequest; + pathParams: UpdateUserPathParams; + queryParams: never; + headerParams: never; + response: UpdateUserMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description This can only be done by the logged in user. * @summary Update user * @link /user/:username */ -export function useUpdateUserHook( - username: UpdateUserPathParams['username'], - options: { - mutation?: UseMutationOptions - client?: UpdateUser['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useUpdateUserHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'put', - url: `/user/${username}`, - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useUpdateUserHook(username: UpdateUserPathParams["username"], options: { + mutation?: UseMutationOptions; + client?: UpdateUser["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useUpdateUserHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "put", + url: `/user/${username}`, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/hooks/useUploadFileHook.ts b/examples/react-query-v5/src/gen/hooks/useUploadFileHook.ts index 1605fd593..c3bee7c2d 100644 --- a/examples/react-query-v5/src/gen/hooks/useUploadFileHook.ts +++ b/examples/react-query-v5/src/gen/hooks/useUploadFileHook.ts @@ -1,52 +1,50 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/react-query' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useInvalidationForMutation } from '../../useInvalidationForMutation' -import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/react-query"; +import { useInvalidationForMutation } from "../../useInvalidationForMutation"; +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from "../models/UploadFile"; +import type { UseMutationOptions } from "@tanstack/react-query"; -type UploadFileClient = typeof client + type UploadFileClient = typeof client; type UploadFile = { - data: UploadFileMutationResponse - error: never - request: UploadFileMutationRequest - pathParams: UploadFilePathParams - queryParams: UploadFileQueryParams - headerParams: never - response: UploadFileMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: UploadFileMutationResponse; + error: never; + request: UploadFileMutationRequest; + pathParams: UploadFilePathParams; + queryParams: UploadFileQueryParams; + headerParams: never; + response: UploadFileMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @summary uploads an image * @link /pet/:petId/uploadImage */ -export function useUploadFileHook( - petId: UploadFilePathParams['petId'], - params?: UploadFile['queryParams'], - options: { - mutation?: UseMutationOptions - client?: UploadFile['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - const invalidationOnSuccess = useInvalidationForMutation('useUploadFileHook') - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: `/pet/${petId}/uploadImage`, - params, - data, - ...clientOptions, - }) - return res.data - }, - onSuccess: (...args) => { - if (invalidationOnSuccess) invalidationOnSuccess(...args) - if (mutationOptions?.onSuccess) mutationOptions.onSuccess(...args) - }, - ...mutationOptions, - }) -} +export function useUploadFileHook(petId: UploadFilePathParams["petId"], params?: UploadFile["queryParams"], options: { + mutation?: UseMutationOptions; + client?: UploadFile["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + const invalidationOnSuccess = useInvalidationForMutation("useUploadFileHook"); + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/pet/${petId}/uploadImage`, + params, + data, + ...clientOptions + }); + return res.data; + }, + onSuccess: (...args) => { + if (invalidationOnSuccess) + invalidationOnSuccess(...args); + if (mutationOptions?.onSuccess) + mutationOptions.onSuccess(...args); + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/index.ts b/examples/react-query-v5/src/gen/index.ts index 6e6f12d44..91cd800f9 100644 --- a/examples/react-query-v5/src/gen/index.ts +++ b/examples/react-query-v5/src/gen/index.ts @@ -1,2 +1,2 @@ -export * from './models/index' -export * from './hooks/index' +export * from "./models/index"; +export * from "./hooks/index"; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/invalidations.ts b/examples/react-query-v5/src/gen/invalidations.ts index 5da5cafd2..cc7fdcf0c 100644 --- a/examples/react-query-v5/src/gen/invalidations.ts +++ b/examples/react-query-v5/src/gen/invalidations.ts @@ -1,54 +1,25 @@ -import type { UseMutationOptions } from '@tanstack/react-query' -import type { - AddPetMutationRequest, - AddPetMutationResponse, - CreateUserMutationRequest, - CreateUserMutationResponse, - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - DeleteOrderMutationResponse, - DeletePetMutationResponse, - DeleteUserMutationResponse, - FindPetsByStatusQueryResponse, - FindPetsByTagsQueryResponse, - GetInventoryQueryResponse, - GetOrderByIdQueryResponse, - GetPetByIdQueryResponse, - GetUserByNameQueryResponse, - LoginUserQueryResponse, - LogoutUserQueryResponse, - PlaceOrderMutationRequest, - PlaceOrderMutationResponse, - PlaceOrderPatchMutationRequest, - PlaceOrderPatchMutationResponse, - UpdatePetMutationRequest, - UpdatePetMutationResponse, - UpdatePetWithFormMutationResponse, - UpdateUserMutationRequest, - UpdateUserMutationResponse, - UploadFileMutationRequest, - UploadFileMutationResponse, -} from './index' +import type { UpdatePetMutationResponse, UpdatePetMutationRequest, AddPetMutationResponse, AddPetMutationRequest, FindPetsByStatusQueryResponse, FindPetsByTagsQueryResponse, GetPetByIdQueryResponse, UpdatePetWithFormMutationResponse, DeletePetMutationResponse, UploadFileMutationResponse, UploadFileMutationRequest, GetInventoryQueryResponse, PlaceOrderMutationResponse, PlaceOrderMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatchMutationRequest, GetOrderByIdQueryResponse, DeleteOrderMutationResponse, CreateUserMutationResponse, CreateUserMutationRequest, CreateUsersWithListInputMutationResponse, CreateUsersWithListInputMutationRequest, LoginUserQueryResponse, LogoutUserQueryResponse, GetUserByNameQueryResponse, UpdateUserMutationResponse, UpdateUserMutationRequest, DeleteUserMutationResponse } from "./index"; +import type { UseMutationOptions } from "@tanstack/react-query"; -export type Invalidations = { - useUpdatePetHook: UseMutationOptions['onSuccess'] - useAddPetHook: UseMutationOptions['onSuccess'] - useFindPetsByStatusHook: UseMutationOptions['onSuccess'] - useFindPetsByTagsHook: UseMutationOptions['onSuccess'] - useGetPetByIdHook: UseMutationOptions['onSuccess'] - useUpdatePetWithFormHook: UseMutationOptions['onSuccess'] - useDeletePetHook: UseMutationOptions['onSuccess'] - useUploadFileHook: UseMutationOptions['onSuccess'] - useGetInventoryHook: UseMutationOptions['onSuccess'] - usePlaceOrderHook: UseMutationOptions['onSuccess'] - usePlaceOrderPatchHook: UseMutationOptions['onSuccess'] - useGetOrderByIdHook: UseMutationOptions['onSuccess'] - useDeleteOrderHook: UseMutationOptions['onSuccess'] - useCreateUserHook: UseMutationOptions['onSuccess'] - useCreateUsersWithListInputHook: UseMutationOptions['onSuccess'] - useLoginUserHook: UseMutationOptions['onSuccess'] - useLogoutUserHook: UseMutationOptions['onSuccess'] - useGetUserByNameHook: UseMutationOptions['onSuccess'] - useUpdateUserHook: UseMutationOptions['onSuccess'] - useDeleteUserHook: UseMutationOptions['onSuccess'] -} + export type Invalidations = { + "useUpdatePetHook": UseMutationOptions["onSuccess"]; + "useAddPetHook": UseMutationOptions["onSuccess"]; + "useFindPetsByStatusHook": UseMutationOptions["onSuccess"]; + "useFindPetsByTagsHook": UseMutationOptions["onSuccess"]; + "useGetPetByIdHook": UseMutationOptions["onSuccess"]; + "useUpdatePetWithFormHook": UseMutationOptions["onSuccess"]; + "useDeletePetHook": UseMutationOptions["onSuccess"]; + "useUploadFileHook": UseMutationOptions["onSuccess"]; + "useGetInventoryHook": UseMutationOptions["onSuccess"]; + "usePlaceOrderHook": UseMutationOptions["onSuccess"]; + "usePlaceOrderPatchHook": UseMutationOptions["onSuccess"]; + "useGetOrderByIdHook": UseMutationOptions["onSuccess"]; + "useDeleteOrderHook": UseMutationOptions["onSuccess"]; + "useCreateUserHook": UseMutationOptions["onSuccess"]; + "useCreateUsersWithListInputHook": UseMutationOptions["onSuccess"]; + "useLoginUserHook": UseMutationOptions["onSuccess"]; + "useLogoutUserHook": UseMutationOptions["onSuccess"]; + "useGetUserByNameHook": UseMutationOptions["onSuccess"]; + "useUpdateUserHook": UseMutationOptions["onSuccess"]; + "useDeleteUserHook": UseMutationOptions["onSuccess"]; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/AddPet.ts b/examples/react-query-v5/src/gen/models/AddPet.ts index dfc60e285..cbb68cd1f 100644 --- a/examples/react-query-v5/src/gen/models/AddPet.ts +++ b/examples/react-query-v5/src/gen/models/AddPet.ts @@ -1,37 +1,37 @@ -import type { AddPetRequest } from './AddPetRequest' -import type { Pet } from './Pet' +import { AddPetRequest } from "./AddPetRequest"; +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type AddPet200 = Pet +*/ +export type AddPet200 = Pet; -/** + /** * @description Pet not found - */ +*/ export type AddPet405 = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + message?: string; +}; -/** + /** * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest +*/ +export type AddPetMutationRequest = AddPetRequest; -/** + /** * @description Successful operation - */ -export type AddPetMutationResponse = Pet +*/ +export type AddPetMutationResponse = Pet; -export type AddPetMutation = { - Response: AddPetMutationResponse - Request: AddPetMutationRequest - Errors: AddPet405 -} + export type AddPetMutation = { + Response: AddPetMutationResponse; + Request: AddPetMutationRequest; + Errors: AddPet405; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/AddPetRequest.ts b/examples/react-query-v5/src/gen/models/AddPetRequest.ts index 9c76717ea..b3868d2c7 100644 --- a/examples/react-query-v5/src/gen/models/AddPetRequest.ts +++ b/examples/react-query-v5/src/gen/models/AddPetRequest.ts @@ -1,33 +1,33 @@ -import type { Category } from './Category' -import type { Tag } from './Tag' +import type { Category } from "./Category"; +import type { Tag } from "./Tag"; -export const addPetRequestStatus = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const -export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] + export const addPetRequestStatus = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; +export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus]; export type AddPetRequest = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string - */ - name: string - category?: Category - /** - * @type array - */ - photoUrls: string[] - /** - * @type array | undefined - */ - tags?: Tag[] - /** - * @description pet status in the store - * @type string | undefined - */ - status?: AddPetRequestStatus -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string + */ + name: string; + category?: Category; + /** + * @type array + */ + photoUrls: string[]; + /** + * @type array | undefined + */ + tags?: Tag[]; + /** + * @description pet status in the store + * @type string | undefined + */ + status?: AddPetRequestStatus; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/Address.ts b/examples/react-query-v5/src/gen/models/Address.ts index eb578826d..4b61854c4 100644 --- a/examples/react-query-v5/src/gen/models/Address.ts +++ b/examples/react-query-v5/src/gen/models/Address.ts @@ -1,18 +1,18 @@ export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} + /** + * @type string | undefined + */ + street?: string; + /** + * @type string | undefined + */ + city?: string; + /** + * @type string | undefined + */ + state?: string; + /** + * @type string | undefined + */ + zip?: string; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/ApiResponse.ts b/examples/react-query-v5/src/gen/models/ApiResponse.ts index 499e9e9ca..2a8e81e25 100644 --- a/examples/react-query-v5/src/gen/models/ApiResponse.ts +++ b/examples/react-query-v5/src/gen/models/ApiResponse.ts @@ -1,14 +1,14 @@ export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + type?: string; + /** + * @type string | undefined + */ + message?: string; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/Category.ts b/examples/react-query-v5/src/gen/models/Category.ts index 24b90a71a..49380ed19 100644 --- a/examples/react-query-v5/src/gen/models/Category.ts +++ b/examples/react-query-v5/src/gen/models/Category.ts @@ -1,10 +1,10 @@ export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/CreateUser.ts b/examples/react-query-v5/src/gen/models/CreateUser.ts index ada359de3..048dec373 100644 --- a/examples/react-query-v5/src/gen/models/CreateUser.ts +++ b/examples/react-query-v5/src/gen/models/CreateUser.ts @@ -1,18 +1,18 @@ -import type { User } from './User' +import type { User } from "./User"; -/** + /** * @description successful operation - */ -export type CreateUserError = User +*/ +export type CreateUserError = User; -/** + /** * @description Created user object - */ -export type CreateUserMutationRequest = User +*/ +export type CreateUserMutationRequest = User; -export type CreateUserMutationResponse = any + export type CreateUserMutationResponse = any; -export type CreateUserMutation = { - Response: CreateUserMutationResponse - Request: CreateUserMutationRequest -} + export type CreateUserMutation = { + Response: CreateUserMutationResponse; + Request: CreateUserMutationRequest; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts b/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts index eb718eb51..daeaa03e6 100644 --- a/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/react-query-v5/src/gen/models/CreateUsersWithListInput.ts @@ -1,23 +1,23 @@ -import type { User } from './User' +import type { User } from "./User"; -/** + /** * @description Successful operation - */ -export type CreateUsersWithListInput200 = User +*/ +export type CreateUsersWithListInput200 = User; -/** + /** * @description successful operation - */ -export type CreateUsersWithListInputError = any +*/ +export type CreateUsersWithListInputError = any; -export type CreateUsersWithListInputMutationRequest = User[] + export type CreateUsersWithListInputMutationRequest = User[]; -/** + /** * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User +*/ +export type CreateUsersWithListInputMutationResponse = User; -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} + export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse; + Request: CreateUsersWithListInputMutationRequest; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/Customer.ts b/examples/react-query-v5/src/gen/models/Customer.ts index 5a6d435a3..3cfe5b151 100644 --- a/examples/react-query-v5/src/gen/models/Customer.ts +++ b/examples/react-query-v5/src/gen/models/Customer.ts @@ -1,16 +1,16 @@ -import type { Address } from './Address' +import { Address } from "./Address"; -export type Customer = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] -} + export type Customer = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type array | undefined + */ + address?: Address[]; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/DeleteOrder.ts b/examples/react-query-v5/src/gen/models/DeleteOrder.ts index d160f7c4e..fc5f0ae6f 100644 --- a/examples/react-query-v5/src/gen/models/DeleteOrder.ts +++ b/examples/react-query-v5/src/gen/models/DeleteOrder.ts @@ -1,25 +1,25 @@ export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} + /** + * @description ID of the order that needs to be deleted + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description Invalid ID supplied - */ -export type DeleteOrder400 = any +*/ +export type DeleteOrder400 = any; -/** + /** * @description Order not found - */ -export type DeleteOrder404 = any +*/ +export type DeleteOrder404 = any; -export type DeleteOrderMutationResponse = any + export type DeleteOrderMutationResponse = any; -export type DeleteOrderMutation = { - Response: DeleteOrderMutationResponse - PathParams: DeleteOrderPathParams - Errors: DeleteOrder400 | DeleteOrder404 -} + export type DeleteOrderMutation = { + Response: DeleteOrderMutationResponse; + PathParams: DeleteOrderPathParams; + Errors: DeleteOrder400 | DeleteOrder404; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/DeletePet.ts b/examples/react-query-v5/src/gen/models/DeletePet.ts index 6bb98c261..89c7db814 100644 --- a/examples/react-query-v5/src/gen/models/DeletePet.ts +++ b/examples/react-query-v5/src/gen/models/DeletePet.ts @@ -1,28 +1,28 @@ export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} + /** + * @description Pet id to delete + * @type integer, int64 + */ + petId: number; +}; -export type DeletePetHeaderParams = { - /** - * @type string | undefined - */ - api_key?: string -} + export type DeletePetHeaderParams = { + /** + * @type string | undefined + */ + api_key?: string; +}; -/** + /** * @description Invalid pet value - */ -export type DeletePet400 = any +*/ +export type DeletePet400 = any; -export type DeletePetMutationResponse = any + export type DeletePetMutationResponse = any; -export type DeletePetMutation = { - Response: DeletePetMutationResponse - PathParams: DeletePetPathParams - HeaderParams: DeletePetHeaderParams - Errors: DeletePet400 -} + export type DeletePetMutation = { + Response: DeletePetMutationResponse; + PathParams: DeletePetPathParams; + HeaderParams: DeletePetHeaderParams; + Errors: DeletePet400; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/DeleteUser.ts b/examples/react-query-v5/src/gen/models/DeleteUser.ts index 63010e04f..16327e3b1 100644 --- a/examples/react-query-v5/src/gen/models/DeleteUser.ts +++ b/examples/react-query-v5/src/gen/models/DeleteUser.ts @@ -1,25 +1,25 @@ export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} + /** + * @description The name that needs to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description Invalid username supplied - */ -export type DeleteUser400 = any +*/ +export type DeleteUser400 = any; -/** + /** * @description User not found - */ -export type DeleteUser404 = any +*/ +export type DeleteUser404 = any; -export type DeleteUserMutationResponse = any + export type DeleteUserMutationResponse = any; -export type DeleteUserMutation = { - Response: DeleteUserMutationResponse - PathParams: DeleteUserPathParams - Errors: DeleteUser400 | DeleteUser404 -} + export type DeleteUserMutation = { + Response: DeleteUserMutationResponse; + PathParams: DeleteUserPathParams; + Errors: DeleteUser400 | DeleteUser404; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts b/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts index 504347081..0e9680607 100644 --- a/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts +++ b/examples/react-query-v5/src/gen/models/FindPetsByStatus.ts @@ -1,37 +1,37 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export const findPetsByStatusQueryParamsStatus = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const -export type FindPetsByStatusQueryParamsStatus = (typeof findPetsByStatusQueryParamsStatus)[keyof typeof findPetsByStatusQueryParamsStatus] + export const findPetsByStatusQueryParamsStatus = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; +export type FindPetsByStatusQueryParamsStatus = (typeof findPetsByStatusQueryParamsStatus)[keyof typeof findPetsByStatusQueryParamsStatus]; export type FindPetsByStatusQueryParams = { - /** - * @description Status values that need to be considered for filter - * @default "available" - * @type string | undefined - */ - status?: FindPetsByStatusQueryParamsStatus -} + /** + * @description Status values that need to be considered for filter + * @default "available" + * @type string | undefined + */ + status?: FindPetsByStatusQueryParamsStatus; +}; -/** + /** * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] +*/ +export type FindPetsByStatus200 = Pet[]; -/** + /** * @description Invalid status value - */ -export type FindPetsByStatus400 = any +*/ +export type FindPetsByStatus400 = any; -/** + /** * @description successful operation - */ -export type FindPetsByStatusQueryResponse = Pet[] +*/ +export type FindPetsByStatusQueryResponse = Pet[]; -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} + export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse; + QueryParams: FindPetsByStatusQueryParams; + Errors: FindPetsByStatus400; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/FindPetsByTags.ts b/examples/react-query-v5/src/gen/models/FindPetsByTags.ts index 1869b345a..6f8c1b7e6 100644 --- a/examples/react-query-v5/src/gen/models/FindPetsByTags.ts +++ b/examples/react-query-v5/src/gen/models/FindPetsByTags.ts @@ -1,40 +1,40 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export type FindPetsByTagsQueryParams = { - /** - * @description Tags to filter by - * @type array | undefined - */ - tags?: string[] - /** - * @description to request with required page number or pagination - * @type string | undefined - */ - page?: string - /** - * @description to request with required page size - * @type string | undefined - */ - pageSize?: string -} + export type FindPetsByTagsQueryParams = { + /** + * @description Tags to filter by + * @type array | undefined + */ + tags?: string[]; + /** + * @description to request with required page number or pagination + * @type string | undefined + */ + page?: string; + /** + * @description to request with required page size + * @type string | undefined + */ + pageSize?: string; +}; -/** + /** * @description successful operation - */ -export type FindPetsByTags200 = Pet[] +*/ +export type FindPetsByTags200 = Pet[]; -/** + /** * @description Invalid tag value - */ -export type FindPetsByTags400 = any +*/ +export type FindPetsByTags400 = any; -/** + /** * @description successful operation - */ -export type FindPetsByTagsQueryResponse = Pet[] +*/ +export type FindPetsByTagsQueryResponse = Pet[]; -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} + export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse; + QueryParams: FindPetsByTagsQueryParams; + Errors: FindPetsByTags400; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/GetInventory.ts b/examples/react-query-v5/src/gen/models/GetInventory.ts index ec0602416..23861c1bf 100644 --- a/examples/react-query-v5/src/gen/models/GetInventory.ts +++ b/examples/react-query-v5/src/gen/models/GetInventory.ts @@ -1,17 +1,17 @@ /** * @description successful operation - */ +*/ export type GetInventory200 = { - [key: string]: number -} + [key: string]: number; +}; -/** + /** * @description successful operation - */ +*/ export type GetInventoryQueryResponse = { - [key: string]: number -} + [key: string]: number; +}; -export type GetInventoryQuery = { - Response: GetInventoryQueryResponse -} + export type GetInventoryQuery = { + Response: GetInventoryQueryResponse; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/GetOrderById.ts b/examples/react-query-v5/src/gen/models/GetOrderById.ts index 0d25b0ee9..65103cc48 100644 --- a/examples/react-query-v5/src/gen/models/GetOrderById.ts +++ b/examples/react-query-v5/src/gen/models/GetOrderById.ts @@ -1,35 +1,35 @@ -import type { Order } from './Order' +import type { Order } from "./Order"; -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} + export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description successful operation - */ -export type GetOrderById200 = Order +*/ +export type GetOrderById200 = Order; -/** + /** * @description Invalid ID supplied - */ -export type GetOrderById400 = any +*/ +export type GetOrderById400 = any; -/** + /** * @description Order not found - */ -export type GetOrderById404 = any +*/ +export type GetOrderById404 = any; -/** + /** * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order +*/ +export type GetOrderByIdQueryResponse = Order; -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} + export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse; + PathParams: GetOrderByIdPathParams; + Errors: GetOrderById400 | GetOrderById404; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/GetPetById.ts b/examples/react-query-v5/src/gen/models/GetPetById.ts index 437d1a7ef..9920318ac 100644 --- a/examples/react-query-v5/src/gen/models/GetPetById.ts +++ b/examples/react-query-v5/src/gen/models/GetPetById.ts @@ -1,35 +1,35 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} + export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer, int64 + */ + petId: number; +}; -/** + /** * @description successful operation - */ -export type GetPetById200 = Pet +*/ +export type GetPetById200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type GetPetById400 = any +*/ +export type GetPetById400 = any; -/** + /** * @description Pet not found - */ -export type GetPetById404 = any +*/ +export type GetPetById404 = any; -/** + /** * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet +*/ +export type GetPetByIdQueryResponse = Pet; -export type GetPetByIdQuery = { - Response: GetPetByIdQueryResponse - PathParams: GetPetByIdPathParams - Errors: GetPetById400 | GetPetById404 -} + export type GetPetByIdQuery = { + Response: GetPetByIdQueryResponse; + PathParams: GetPetByIdPathParams; + Errors: GetPetById400 | GetPetById404; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/GetUserByName.ts b/examples/react-query-v5/src/gen/models/GetUserByName.ts index c2c975229..3a27c559c 100644 --- a/examples/react-query-v5/src/gen/models/GetUserByName.ts +++ b/examples/react-query-v5/src/gen/models/GetUserByName.ts @@ -1,35 +1,35 @@ -import type { User } from './User' +import type { User } from "./User"; -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} + export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type GetUserByName200 = User +*/ +export type GetUserByName200 = User; -/** + /** * @description Invalid username supplied - */ -export type GetUserByName400 = any +*/ +export type GetUserByName400 = any; -/** + /** * @description User not found - */ -export type GetUserByName404 = any +*/ +export type GetUserByName404 = any; -/** + /** * @description successful operation - */ -export type GetUserByNameQueryResponse = User +*/ +export type GetUserByNameQueryResponse = User; -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} + export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse; + PathParams: GetUserByNamePathParams; + Errors: GetUserByName400 | GetUserByName404; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/LoginUser.ts b/examples/react-query-v5/src/gen/models/LoginUser.ts index 64e5db7b6..6658166a8 100644 --- a/examples/react-query-v5/src/gen/models/LoginUser.ts +++ b/examples/react-query-v5/src/gen/models/LoginUser.ts @@ -1,33 +1,33 @@ export type LoginUserQueryParams = { - /** - * @description The user name for login - * @type string | undefined - */ - username?: string - /** - * @description The password for login in clear text - * @type string | undefined - */ - password?: string -} + /** + * @description The user name for login + * @type string | undefined + */ + username?: string; + /** + * @description The password for login in clear text + * @type string | undefined + */ + password?: string; +}; -/** + /** * @description successful operation - */ -export type LoginUser200 = string +*/ +export type LoginUser200 = string; -/** + /** * @description Invalid username/password supplied - */ -export type LoginUser400 = any +*/ +export type LoginUser400 = any; -/** + /** * @description successful operation - */ -export type LoginUserQueryResponse = string +*/ +export type LoginUserQueryResponse = string; -export type LoginUserQuery = { - Response: LoginUserQueryResponse - QueryParams: LoginUserQueryParams - Errors: LoginUser400 -} + export type LoginUserQuery = { + Response: LoginUserQueryResponse; + QueryParams: LoginUserQueryParams; + Errors: LoginUser400; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/LogoutUser.ts b/examples/react-query-v5/src/gen/models/LogoutUser.ts index 521837490..a685be5fa 100644 --- a/examples/react-query-v5/src/gen/models/LogoutUser.ts +++ b/examples/react-query-v5/src/gen/models/LogoutUser.ts @@ -1,10 +1,10 @@ /** * @description successful operation - */ -export type LogoutUserError = any +*/ +export type LogoutUserError = any; -export type LogoutUserQueryResponse = any + export type LogoutUserQueryResponse = any; -export type LogoutUserQuery = { - Response: LogoutUserQueryResponse -} + export type LogoutUserQuery = { + Response: LogoutUserQueryResponse; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/Order.ts b/examples/react-query-v5/src/gen/models/Order.ts index 878fe6ba2..2fca69707 100644 --- a/examples/react-query-v5/src/gen/models/Order.ts +++ b/examples/react-query-v5/src/gen/models/Order.ts @@ -1,44 +1,44 @@ export const orderStatus = { - placed: 'placed', - approved: 'approved', - delivered: 'delivered', -} as const -export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus] + "placed": "placed", + "approved": "approved", + "delivered": "delivered" +} as const; +export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus]; export const orderHttpStatus = { - '200': 200, - '400': 400, - '500': 500, -} as const -export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] + "200": 200, + "400": 400, + "500": 500 +} as const; +export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus]; export type Order = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type integer | undefined int64 - */ - petId?: number - /** - * @type integer | undefined int32 - */ - quantity?: number - /** - * @type string | undefined date-time - */ - shipDate?: string - /** - * @description Order Status - * @type string | undefined - */ - status?: OrderStatus - /** - * @description HTTP Status - * @type number | undefined - */ - http_status?: OrderHttpStatus - /** - * @type boolean | undefined - */ - complete?: boolean -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type integer | undefined, int64 + */ + petId?: number; + /** + * @type integer | undefined, int32 + */ + quantity?: number; + /** + * @type string | undefined, date-time + */ + shipDate?: string; + /** + * @description Order Status + * @type string | undefined + */ + status?: OrderStatus; + /** + * @description HTTP Status + * @type number | undefined + */ + http_status?: OrderHttpStatus; + /** + * @type boolean | undefined + */ + complete?: boolean; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/Pet.ts b/examples/react-query-v5/src/gen/models/Pet.ts index 4eaf45ee1..325bcb152 100644 --- a/examples/react-query-v5/src/gen/models/Pet.ts +++ b/examples/react-query-v5/src/gen/models/Pet.ts @@ -1,33 +1,33 @@ -import type { Category } from './Category' -import type { Tag } from './Tag' +import { Category } from "./Category"; +import { Tag } from "./Tag"; -export const petStatus = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const -export type PetStatus = (typeof petStatus)[keyof typeof petStatus] + export const petStatus = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; +export type PetStatus = (typeof petStatus)[keyof typeof petStatus]; export type Pet = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string - */ - name: string - category?: Category - /** - * @type array - */ - photoUrls: string[] - /** - * @type array | undefined - */ - tags?: Tag[] - /** - * @description pet status in the store - * @type string | undefined - */ - status?: PetStatus -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string + */ + name: string; + category?: Category; + /** + * @type array + */ + photoUrls: string[]; + /** + * @type array | undefined + */ + tags?: Tag[]; + /** + * @description pet status in the store + * @type string | undefined + */ + status?: PetStatus; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/PetNotFound.ts b/examples/react-query-v5/src/gen/models/PetNotFound.ts index 676a15893..ba3c67312 100644 --- a/examples/react-query-v5/src/gen/models/PetNotFound.ts +++ b/examples/react-query-v5/src/gen/models/PetNotFound.ts @@ -1,10 +1,10 @@ export type PetNotFound = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + message?: string; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/PlaceOrder.ts b/examples/react-query-v5/src/gen/models/PlaceOrder.ts index 20aa2ff08..fd29e6525 100644 --- a/examples/react-query-v5/src/gen/models/PlaceOrder.ts +++ b/examples/react-query-v5/src/gen/models/PlaceOrder.ts @@ -1,24 +1,24 @@ -import type { Order } from './Order' +import type { Order } from "./Order"; -/** + /** * @description successful operation - */ -export type PlaceOrder200 = Order +*/ +export type PlaceOrder200 = Order; -/** + /** * @description Invalid input - */ -export type PlaceOrder405 = any +*/ +export type PlaceOrder405 = any; -export type PlaceOrderMutationRequest = Order + export type PlaceOrderMutationRequest = Order; -/** + /** * @description successful operation - */ -export type PlaceOrderMutationResponse = Order +*/ +export type PlaceOrderMutationResponse = Order; -export type PlaceOrderMutation = { - Response: PlaceOrderMutationResponse - Request: PlaceOrderMutationRequest - Errors: PlaceOrder405 -} + export type PlaceOrderMutation = { + Response: PlaceOrderMutationResponse; + Request: PlaceOrderMutationRequest; + Errors: PlaceOrder405; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts b/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts index bca3cfaad..b5f2613b8 100644 --- a/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts +++ b/examples/react-query-v5/src/gen/models/PlaceOrderPatch.ts @@ -1,24 +1,24 @@ -import type { Order } from './Order' +import type { Order } from "./Order"; -/** + /** * @description successful operation - */ -export type PlaceOrderPatch200 = Order +*/ +export type PlaceOrderPatch200 = Order; -/** + /** * @description Invalid input - */ -export type PlaceOrderPatch405 = any +*/ +export type PlaceOrderPatch405 = any; -export type PlaceOrderPatchMutationRequest = Order + export type PlaceOrderPatchMutationRequest = Order; -/** + /** * @description successful operation - */ -export type PlaceOrderPatchMutationResponse = Order +*/ +export type PlaceOrderPatchMutationResponse = Order; -export type PlaceOrderPatchMutation = { - Response: PlaceOrderPatchMutationResponse - Request: PlaceOrderPatchMutationRequest - Errors: PlaceOrderPatch405 -} + export type PlaceOrderPatchMutation = { + Response: PlaceOrderPatchMutationResponse; + Request: PlaceOrderPatchMutationRequest; + Errors: PlaceOrderPatch405; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/Tag.ts b/examples/react-query-v5/src/gen/models/Tag.ts index 5145ac12c..3ae285108 100644 --- a/examples/react-query-v5/src/gen/models/Tag.ts +++ b/examples/react-query-v5/src/gen/models/Tag.ts @@ -1,10 +1,10 @@ export type Tag = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/UpdatePet.ts b/examples/react-query-v5/src/gen/models/UpdatePet.ts index c8d59265f..d55cd8eeb 100644 --- a/examples/react-query-v5/src/gen/models/UpdatePet.ts +++ b/examples/react-query-v5/src/gen/models/UpdatePet.ts @@ -1,37 +1,37 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type UpdatePet200 = Pet +*/ +export type UpdatePet200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type UpdatePet400 = any +*/ +export type UpdatePet400 = any; -/** + /** * @description Pet not found - */ -export type UpdatePet404 = any +*/ +export type UpdatePet404 = any; -/** + /** * @description Validation exception - */ -export type UpdatePet405 = any +*/ +export type UpdatePet405 = any; -/** + /** * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet +*/ +export type UpdatePetMutationRequest = Pet; -/** + /** * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet +*/ +export type UpdatePetMutationResponse = Pet; -export type UpdatePetMutation = { - Response: UpdatePetMutationResponse - Request: UpdatePetMutationRequest - Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 -} + export type UpdatePetMutation = { + Response: UpdatePetMutationResponse; + Request: UpdatePetMutationRequest; + Errors: UpdatePet400 | UpdatePet404 | UpdatePet405; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts b/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..77cbc4bb8 100644 --- a/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts +++ b/examples/react-query-v5/src/gen/models/UpdatePetWithForm.ts @@ -1,34 +1,34 @@ export type UpdatePetWithFormPathParams = { - /** - * @description ID of pet that needs to be updated - * @type integer int64 - */ - petId: number -} + /** + * @description ID of pet that needs to be updated + * @type integer, int64 + */ + petId: number; +}; -export type UpdatePetWithFormQueryParams = { - /** - * @description Name of pet that needs to be updated - * @type string | undefined - */ - name?: string - /** - * @description Status of pet that needs to be updated - * @type string | undefined - */ - status?: string -} + export type UpdatePetWithFormQueryParams = { + /** + * @description Name of pet that needs to be updated + * @type string | undefined + */ + name?: string; + /** + * @description Status of pet that needs to be updated + * @type string | undefined + */ + status?: string; +}; -/** + /** * @description Invalid input - */ -export type UpdatePetWithForm405 = any +*/ +export type UpdatePetWithForm405 = any; -export type UpdatePetWithFormMutationResponse = any + export type UpdatePetWithFormMutationResponse = any; -export type UpdatePetWithFormMutation = { - Response: UpdatePetWithFormMutationResponse - PathParams: UpdatePetWithFormPathParams - QueryParams: UpdatePetWithFormQueryParams - Errors: UpdatePetWithForm405 -} + export type UpdatePetWithFormMutation = { + Response: UpdatePetWithFormMutationResponse; + PathParams: UpdatePetWithFormPathParams; + QueryParams: UpdatePetWithFormQueryParams; + Errors: UpdatePetWithForm405; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/UpdateUser.ts b/examples/react-query-v5/src/gen/models/UpdateUser.ts index d636efeb0..9a44548d7 100644 --- a/examples/react-query-v5/src/gen/models/UpdateUser.ts +++ b/examples/react-query-v5/src/gen/models/UpdateUser.ts @@ -1,27 +1,27 @@ -import type { User } from './User' +import { User } from "./User"; -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} + export type UpdateUserPathParams = { + /** + * @description name that need to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type UpdateUserError = any +*/ +export type UpdateUserError = any; -/** + /** * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User +*/ +export type UpdateUserMutationRequest = User; -export type UpdateUserMutationResponse = any + export type UpdateUserMutationResponse = any; -export type UpdateUserMutation = { - Response: UpdateUserMutationResponse - Request: UpdateUserMutationRequest - PathParams: UpdateUserPathParams -} + export type UpdateUserMutation = { + Response: UpdateUserMutationResponse; + Request: UpdateUserMutationRequest; + PathParams: UpdateUserPathParams; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/UploadFile.ts b/examples/react-query-v5/src/gen/models/UploadFile.ts index 0c0956bea..3f272bd5d 100644 --- a/examples/react-query-v5/src/gen/models/UploadFile.ts +++ b/examples/react-query-v5/src/gen/models/UploadFile.ts @@ -1,36 +1,36 @@ -import type { ApiResponse } from './ApiResponse' +import type { ApiResponse } from "./ApiResponse"; -export type UploadFilePathParams = { - /** - * @description ID of pet to update - * @type integer int64 - */ - petId: number -} + export type UploadFilePathParams = { + /** + * @description ID of pet to update + * @type integer, int64 + */ + petId: number; +}; -export type UploadFileQueryParams = { - /** - * @description Additional Metadata - * @type string | undefined - */ - additionalMetadata?: string -} + export type UploadFileQueryParams = { + /** + * @description Additional Metadata + * @type string | undefined + */ + additionalMetadata?: string; +}; -/** + /** * @description successful operation - */ -export type UploadFile200 = ApiResponse +*/ +export type UploadFile200 = ApiResponse; -export type UploadFileMutationRequest = string + export type UploadFileMutationRequest = string; -/** + /** * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse +*/ +export type UploadFileMutationResponse = ApiResponse; -export type UploadFileMutation = { - Response: UploadFileMutationResponse - Request: UploadFileMutationRequest - PathParams: UploadFilePathParams - QueryParams: UploadFileQueryParams -} + export type UploadFileMutation = { + Response: UploadFileMutationResponse; + Request: UploadFileMutationRequest; + PathParams: UploadFilePathParams; + QueryParams: UploadFileQueryParams; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/User.ts b/examples/react-query-v5/src/gen/models/User.ts index fd722d07d..9e8b913d4 100644 --- a/examples/react-query-v5/src/gen/models/User.ts +++ b/examples/react-query-v5/src/gen/models/User.ts @@ -1,35 +1,35 @@ export type User = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type string | undefined - */ - firstName?: string - /** - * @type string | undefined - */ - lastName?: string - /** - * @type string | undefined - */ - email?: string - /** - * @type string | undefined - */ - password?: string - /** - * @type string | undefined - */ - phone?: string - /** - * @description User Status - * @type integer | undefined int32 - */ - userStatus?: number -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type string | undefined + */ + firstName?: string; + /** + * @type string | undefined + */ + lastName?: string; + /** + * @type string | undefined + */ + email?: string; + /** + * @type string | undefined + */ + password?: string; + /** + * @type string | undefined + */ + phone?: string; + /** + * @description User Status + * @type integer | undefined, int32 + */ + userStatus?: number; +}; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/UserArray.ts b/examples/react-query-v5/src/gen/models/UserArray.ts index effb23af2..21e14e46a 100644 --- a/examples/react-query-v5/src/gen/models/UserArray.ts +++ b/examples/react-query-v5/src/gen/models/UserArray.ts @@ -1,3 +1,3 @@ -import type { User } from './User' +import { User } from "./User"; -export type UserArray = User[] + export type UserArray = User[]; \ No newline at end of file diff --git a/examples/react-query-v5/src/gen/models/index.ts b/examples/react-query-v5/src/gen/models/index.ts index dbeb82e28..6f9cc329b 100644 --- a/examples/react-query-v5/src/gen/models/index.ts +++ b/examples/react-query-v5/src/gen/models/index.ts @@ -1,31 +1,31 @@ -export * from './AddPet' -export * from './AddPetRequest' -export * from './Address' -export * from './ApiResponse' -export * from './Category' -export * from './CreateUser' -export * from './CreateUsersWithListInput' -export * from './Customer' -export * from './DeleteOrder' -export * from './DeletePet' -export * from './DeleteUser' -export * from './FindPetsByStatus' -export * from './FindPetsByTags' -export * from './GetInventory' -export * from './GetOrderById' -export * from './GetPetById' -export * from './GetUserByName' -export * from './LoginUser' -export * from './LogoutUser' -export * from './Order' -export * from './Pet' -export * from './PetNotFound' -export * from './PlaceOrder' -export * from './PlaceOrderPatch' -export * from './Tag' -export * from './UpdatePet' -export * from './UpdatePetWithForm' -export * from './UpdateUser' -export * from './UploadFile' -export * from './User' -export * from './UserArray' +export * from "./AddPet"; +export * from "./AddPetRequest"; +export * from "./Address"; +export * from "./ApiResponse"; +export * from "./Category"; +export * from "./CreateUser"; +export * from "./CreateUsersWithListInput"; +export * from "./Customer"; +export * from "./DeleteOrder"; +export * from "./DeletePet"; +export * from "./DeleteUser"; +export * from "./FindPetsByStatus"; +export * from "./FindPetsByTags"; +export * from "./GetInventory"; +export * from "./GetOrderById"; +export * from "./GetPetById"; +export * from "./GetUserByName"; +export * from "./LoginUser"; +export * from "./LogoutUser"; +export * from "./Order"; +export * from "./Pet"; +export * from "./PetNotFound"; +export * from "./PlaceOrder"; +export * from "./PlaceOrderPatch"; +export * from "./Tag"; +export * from "./UpdatePet"; +export * from "./UpdatePetWithForm"; +export * from "./UpdateUser"; +export * from "./UploadFile"; +export * from "./User"; +export * from "./UserArray"; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/AddPet.ts b/examples/react-query/src/gen/models/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/react-query/src/gen/models/AddPet.ts +++ b/examples/react-query/src/gen/models/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/react-query/src/gen/models/AddPetRequest.ts b/examples/react-query/src/gen/models/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/react-query/src/gen/models/AddPetRequest.ts +++ b/examples/react-query/src/gen/models/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/react-query/src/gen/models/ApiResponse.ts b/examples/react-query/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/react-query/src/gen/models/ApiResponse.ts +++ b/examples/react-query/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/react-query/src/gen/models/Category.ts b/examples/react-query/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/react-query/src/gen/models/Category.ts +++ b/examples/react-query/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/react-query/src/gen/models/Customer.ts b/examples/react-query/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/react-query/src/gen/models/Customer.ts +++ b/examples/react-query/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/react-query/src/gen/models/DeleteOrder.ts b/examples/react-query/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/react-query/src/gen/models/DeleteOrder.ts +++ b/examples/react-query/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/react-query/src/gen/models/DeletePet.ts b/examples/react-query/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/react-query/src/gen/models/DeletePet.ts +++ b/examples/react-query/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/react-query/src/gen/models/GetOrderById.ts b/examples/react-query/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/react-query/src/gen/models/GetOrderById.ts +++ b/examples/react-query/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/react-query/src/gen/models/GetPetById.ts b/examples/react-query/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/react-query/src/gen/models/GetPetById.ts +++ b/examples/react-query/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/react-query/src/gen/models/Order.ts b/examples/react-query/src/gen/models/Order.ts index 878fe6ba2..869963878 100644 --- a/examples/react-query/src/gen/models/Order.ts +++ b/examples/react-query/src/gen/models/Order.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/react-query/src/gen/models/Pet.ts b/examples/react-query/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/react-query/src/gen/models/Pet.ts +++ b/examples/react-query/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/react-query/src/gen/models/PetNotFound.ts b/examples/react-query/src/gen/models/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/react-query/src/gen/models/PetNotFound.ts +++ b/examples/react-query/src/gen/models/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/react-query/src/gen/models/Tag.ts b/examples/react-query/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/react-query/src/gen/models/Tag.ts +++ b/examples/react-query/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/react-query/src/gen/models/UpdatePetWithForm.ts b/examples/react-query/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/react-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/react-query/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/react-query/src/gen/models/UploadFile.ts b/examples/react-query/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/react-query/src/gen/models/UploadFile.ts +++ b/examples/react-query/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/react-query/src/gen/models/User.ts b/examples/react-query/src/gen/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/react-query/src/gen/models/User.ts +++ b/examples/react-query/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/simple-single/src/gen/models.ts b/examples/simple-single/src/gen/models.ts index 4b1500a5d..4b160a308 100644 --- a/examples/simple-single/src/gen/models.ts +++ b/examples/simple-single/src/gen/models.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** @@ -45,7 +45,7 @@ export type Order = { export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -79,7 +79,7 @@ export type Address = { export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -90,7 +90,7 @@ export type Category = { export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -119,14 +119,14 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -143,7 +143,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -174,7 +174,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -199,7 +199,7 @@ export type AddPetRequest = { export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -214,7 +214,7 @@ export type ApiResponse = { export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -271,7 +271,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -374,7 +374,7 @@ export type FindPetsByTagsQuery = { export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -408,7 +408,7 @@ export type GetPetByIdQuery = { export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -443,7 +443,7 @@ export type UpdatePetWithFormMutation = { export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -472,7 +472,7 @@ export type DeletePetMutation = { export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -571,7 +571,7 @@ export type PlaceOrderPatchMutation = { export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } @@ -605,7 +605,7 @@ export type GetOrderByIdQuery = { export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/solid-query/src/gen/models/AddPet.ts b/examples/solid-query/src/gen/models/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/solid-query/src/gen/models/AddPet.ts +++ b/examples/solid-query/src/gen/models/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/solid-query/src/gen/models/AddPetRequest.ts b/examples/solid-query/src/gen/models/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/solid-query/src/gen/models/AddPetRequest.ts +++ b/examples/solid-query/src/gen/models/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/solid-query/src/gen/models/ApiResponse.ts b/examples/solid-query/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/solid-query/src/gen/models/ApiResponse.ts +++ b/examples/solid-query/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/solid-query/src/gen/models/Category.ts b/examples/solid-query/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/solid-query/src/gen/models/Category.ts +++ b/examples/solid-query/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/solid-query/src/gen/models/Customer.ts b/examples/solid-query/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/solid-query/src/gen/models/Customer.ts +++ b/examples/solid-query/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/solid-query/src/gen/models/DeleteOrder.ts b/examples/solid-query/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/solid-query/src/gen/models/DeleteOrder.ts +++ b/examples/solid-query/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/solid-query/src/gen/models/DeletePet.ts b/examples/solid-query/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/solid-query/src/gen/models/DeletePet.ts +++ b/examples/solid-query/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/solid-query/src/gen/models/GetOrderById.ts b/examples/solid-query/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/solid-query/src/gen/models/GetOrderById.ts +++ b/examples/solid-query/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/solid-query/src/gen/models/GetPetById.ts b/examples/solid-query/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/solid-query/src/gen/models/GetPetById.ts +++ b/examples/solid-query/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/solid-query/src/gen/models/Order.ts b/examples/solid-query/src/gen/models/Order.ts index 878fe6ba2..869963878 100644 --- a/examples/solid-query/src/gen/models/Order.ts +++ b/examples/solid-query/src/gen/models/Order.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/solid-query/src/gen/models/Pet.ts b/examples/solid-query/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/solid-query/src/gen/models/Pet.ts +++ b/examples/solid-query/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/solid-query/src/gen/models/PetNotFound.ts b/examples/solid-query/src/gen/models/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/solid-query/src/gen/models/PetNotFound.ts +++ b/examples/solid-query/src/gen/models/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/solid-query/src/gen/models/Tag.ts b/examples/solid-query/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/solid-query/src/gen/models/Tag.ts +++ b/examples/solid-query/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/solid-query/src/gen/models/UpdatePetWithForm.ts b/examples/solid-query/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/solid-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/solid-query/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/solid-query/src/gen/models/UploadFile.ts b/examples/solid-query/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/solid-query/src/gen/models/UploadFile.ts +++ b/examples/solid-query/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/solid-query/src/gen/models/User.ts b/examples/solid-query/src/gen/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/solid-query/src/gen/models/User.ts +++ b/examples/solid-query/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/svelte-query/src/gen/models/AddPet.ts b/examples/svelte-query/src/gen/models/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/svelte-query/src/gen/models/AddPet.ts +++ b/examples/svelte-query/src/gen/models/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/svelte-query/src/gen/models/AddPetRequest.ts b/examples/svelte-query/src/gen/models/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/svelte-query/src/gen/models/AddPetRequest.ts +++ b/examples/svelte-query/src/gen/models/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/svelte-query/src/gen/models/ApiResponse.ts b/examples/svelte-query/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/svelte-query/src/gen/models/ApiResponse.ts +++ b/examples/svelte-query/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/svelte-query/src/gen/models/Category.ts b/examples/svelte-query/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/svelte-query/src/gen/models/Category.ts +++ b/examples/svelte-query/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/svelte-query/src/gen/models/Customer.ts b/examples/svelte-query/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/svelte-query/src/gen/models/Customer.ts +++ b/examples/svelte-query/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/svelte-query/src/gen/models/DeleteOrder.ts b/examples/svelte-query/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/svelte-query/src/gen/models/DeleteOrder.ts +++ b/examples/svelte-query/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/svelte-query/src/gen/models/DeletePet.ts b/examples/svelte-query/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/svelte-query/src/gen/models/DeletePet.ts +++ b/examples/svelte-query/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/svelte-query/src/gen/models/GetOrderById.ts b/examples/svelte-query/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/svelte-query/src/gen/models/GetOrderById.ts +++ b/examples/svelte-query/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/svelte-query/src/gen/models/GetPetById.ts b/examples/svelte-query/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/svelte-query/src/gen/models/GetPetById.ts +++ b/examples/svelte-query/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/svelte-query/src/gen/models/Order.ts b/examples/svelte-query/src/gen/models/Order.ts index 878fe6ba2..869963878 100644 --- a/examples/svelte-query/src/gen/models/Order.ts +++ b/examples/svelte-query/src/gen/models/Order.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/svelte-query/src/gen/models/Pet.ts b/examples/svelte-query/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/svelte-query/src/gen/models/Pet.ts +++ b/examples/svelte-query/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/svelte-query/src/gen/models/PetNotFound.ts b/examples/svelte-query/src/gen/models/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/svelte-query/src/gen/models/PetNotFound.ts +++ b/examples/svelte-query/src/gen/models/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/svelte-query/src/gen/models/Tag.ts b/examples/svelte-query/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/svelte-query/src/gen/models/Tag.ts +++ b/examples/svelte-query/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts b/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/svelte-query/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/svelte-query/src/gen/models/UploadFile.ts b/examples/svelte-query/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/svelte-query/src/gen/models/UploadFile.ts +++ b/examples/svelte-query/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/svelte-query/src/gen/models/User.ts b/examples/svelte-query/src/gen/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/svelte-query/src/gen/models/User.ts +++ b/examples/svelte-query/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/swr/src/gen/models/AddPet.ts b/examples/swr/src/gen/models/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/swr/src/gen/models/AddPet.ts +++ b/examples/swr/src/gen/models/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/swr/src/gen/models/AddPetRequest.ts b/examples/swr/src/gen/models/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/swr/src/gen/models/AddPetRequest.ts +++ b/examples/swr/src/gen/models/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/swr/src/gen/models/ApiResponse.ts b/examples/swr/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/swr/src/gen/models/ApiResponse.ts +++ b/examples/swr/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/swr/src/gen/models/Category.ts b/examples/swr/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/swr/src/gen/models/Category.ts +++ b/examples/swr/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/swr/src/gen/models/Customer.ts b/examples/swr/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/swr/src/gen/models/Customer.ts +++ b/examples/swr/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/swr/src/gen/models/DeleteOrder.ts b/examples/swr/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/swr/src/gen/models/DeleteOrder.ts +++ b/examples/swr/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/swr/src/gen/models/DeletePet.ts b/examples/swr/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/swr/src/gen/models/DeletePet.ts +++ b/examples/swr/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/swr/src/gen/models/GetOrderById.ts b/examples/swr/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/swr/src/gen/models/GetOrderById.ts +++ b/examples/swr/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/swr/src/gen/models/GetPetById.ts b/examples/swr/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/swr/src/gen/models/GetPetById.ts +++ b/examples/swr/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/swr/src/gen/models/Order.ts b/examples/swr/src/gen/models/Order.ts index 878fe6ba2..869963878 100644 --- a/examples/swr/src/gen/models/Order.ts +++ b/examples/swr/src/gen/models/Order.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/swr/src/gen/models/Pet.ts b/examples/swr/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/swr/src/gen/models/Pet.ts +++ b/examples/swr/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/swr/src/gen/models/PetNotFound.ts b/examples/swr/src/gen/models/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/swr/src/gen/models/PetNotFound.ts +++ b/examples/swr/src/gen/models/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/swr/src/gen/models/Tag.ts b/examples/swr/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/swr/src/gen/models/Tag.ts +++ b/examples/swr/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/swr/src/gen/models/UpdatePetWithForm.ts b/examples/swr/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/swr/src/gen/models/UpdatePetWithForm.ts +++ b/examples/swr/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/swr/src/gen/models/UploadFile.ts b/examples/swr/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/swr/src/gen/models/UploadFile.ts +++ b/examples/swr/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/swr/src/gen/models/User.ts b/examples/swr/src/gen/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/swr/src/gen/models/User.ts +++ b/examples/swr/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/typescript/src/gen/models.ts b/examples/typescript/src/gen/models.ts index ec815e2a5..d7ffa7ddc 100644 --- a/examples/typescript/src/gen/models.ts +++ b/examples/typescript/src/gen/models.ts @@ -10,19 +10,19 @@ export enum OrderHttpStatus { } export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** @@ -43,7 +43,7 @@ export type Order = { export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -77,7 +77,7 @@ export type Address = { export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -88,7 +88,7 @@ export type Category = { export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -117,14 +117,14 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -140,7 +140,7 @@ export enum PetStatus { } export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -170,7 +170,7 @@ export enum AddPetRequestStatus { } export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -195,7 +195,7 @@ export type AddPetRequest = { export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -210,7 +210,7 @@ export type ApiResponse = { export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -267,7 +267,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -369,7 +369,7 @@ export type FindPetsByTagsQuery = { export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -403,7 +403,7 @@ export type GetPetByIdQuery = { export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -438,7 +438,7 @@ export type UpdatePetWithFormMutation = { export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -467,7 +467,7 @@ export type DeletePetMutation = { export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -566,7 +566,7 @@ export type PlaceOrderPatchMutation = { export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } @@ -600,7 +600,7 @@ export type GetOrderByIdQuery = { export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/typescript/src/gen/modelsConst.ts b/examples/typescript/src/gen/modelsConst.ts index 128a7ab4b..a2bea45b3 100644 --- a/examples/typescript/src/gen/modelsConst.ts +++ b/examples/typescript/src/gen/modelsConst.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** @@ -45,7 +45,7 @@ export type Order = { export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -79,7 +79,7 @@ export type Address = { export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -90,7 +90,7 @@ export type Category = { export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -119,14 +119,14 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -143,7 +143,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -174,7 +174,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -199,7 +199,7 @@ export type AddPetRequest = { export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -214,7 +214,7 @@ export type ApiResponse = { export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -271,7 +271,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -374,7 +374,7 @@ export type FindPetsByTagsQuery = { export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -408,7 +408,7 @@ export type GetPetByIdQuery = { export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -443,7 +443,7 @@ export type UpdatePetWithFormMutation = { export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -472,7 +472,7 @@ export type DeletePetMutation = { export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -571,7 +571,7 @@ export type PlaceOrderPatchMutation = { export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } @@ -605,7 +605,7 @@ export type GetOrderByIdQuery = { export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/typescript/src/gen/modelsConstEnum.ts b/examples/typescript/src/gen/modelsConstEnum.ts index ec815e2a5..d7ffa7ddc 100644 --- a/examples/typescript/src/gen/modelsConstEnum.ts +++ b/examples/typescript/src/gen/modelsConstEnum.ts @@ -10,19 +10,19 @@ export enum OrderHttpStatus { } export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** @@ -43,7 +43,7 @@ export type Order = { export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -77,7 +77,7 @@ export type Address = { export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -88,7 +88,7 @@ export type Category = { export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -117,14 +117,14 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -140,7 +140,7 @@ export enum PetStatus { } export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -170,7 +170,7 @@ export enum AddPetRequestStatus { } export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -195,7 +195,7 @@ export type AddPetRequest = { export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -210,7 +210,7 @@ export type ApiResponse = { export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -267,7 +267,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -369,7 +369,7 @@ export type FindPetsByTagsQuery = { export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -403,7 +403,7 @@ export type GetPetByIdQuery = { export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -438,7 +438,7 @@ export type UpdatePetWithFormMutation = { export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -467,7 +467,7 @@ export type DeletePetMutation = { export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -566,7 +566,7 @@ export type PlaceOrderPatchMutation = { export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } @@ -600,7 +600,7 @@ export type GetOrderByIdQuery = { export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/typescript/src/gen/modelsLiteral.ts b/examples/typescript/src/gen/modelsLiteral.ts index 89bc2475b..d1730f4be 100644 --- a/examples/typescript/src/gen/modelsLiteral.ts +++ b/examples/typescript/src/gen/modelsLiteral.ts @@ -2,19 +2,19 @@ export type OrderStatus = 'placed' | 'approved' | 'delivered' export type OrderHttpStatus = 200 | 400 | 500 export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** @@ -35,7 +35,7 @@ export type Order = { export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -69,7 +69,7 @@ export type Address = { export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -80,7 +80,7 @@ export type Category = { export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -109,14 +109,14 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -128,7 +128,7 @@ export type Tag = { export type PetStatus = 'available' | 'pending' | 'sold' export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -154,7 +154,7 @@ export type Pet = { export type AddPetRequestStatus = 'available' | 'pending' | 'sold' export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -179,7 +179,7 @@ export type AddPetRequest = { export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -194,7 +194,7 @@ export type ApiResponse = { export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -251,7 +251,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -349,7 +349,7 @@ export type FindPetsByTagsQuery = { export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -383,7 +383,7 @@ export type GetPetByIdQuery = { export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -418,7 +418,7 @@ export type UpdatePetWithFormMutation = { export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -447,7 +447,7 @@ export type DeletePetMutation = { export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -546,7 +546,7 @@ export type PlaceOrderPatchMutation = { export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } @@ -580,7 +580,7 @@ export type GetOrderByIdQuery = { export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/typescript/src/gen/modelsPascalConst.ts b/examples/typescript/src/gen/modelsPascalConst.ts index d2a16c229..731717cc6 100644 --- a/examples/typescript/src/gen/modelsPascalConst.ts +++ b/examples/typescript/src/gen/modelsPascalConst.ts @@ -12,19 +12,19 @@ export const OrderHttpStatus = { export type OrderHttpStatus = (typeof OrderHttpStatus)[keyof typeof OrderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** @@ -45,7 +45,7 @@ export type Order = { export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -79,7 +79,7 @@ export type Address = { export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -90,7 +90,7 @@ export type Category = { export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -119,14 +119,14 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -143,7 +143,7 @@ export const PetStatus = { export type PetStatus = (typeof PetStatus)[keyof typeof PetStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -174,7 +174,7 @@ export const AddPetRequestStatus = { export type AddPetRequestStatus = (typeof AddPetRequestStatus)[keyof typeof AddPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -199,7 +199,7 @@ export type AddPetRequest = { export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -214,7 +214,7 @@ export type ApiResponse = { export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -271,7 +271,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** @@ -374,7 +374,7 @@ export type FindPetsByTagsQuery = { export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -408,7 +408,7 @@ export type GetPetByIdQuery = { export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -443,7 +443,7 @@ export type UpdatePetWithFormMutation = { export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -472,7 +472,7 @@ export type DeletePetMutation = { export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } @@ -571,7 +571,7 @@ export type PlaceOrderPatchMutation = { export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } @@ -605,7 +605,7 @@ export type GetOrderByIdQuery = { export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/typescript/src/gen/ts/models/AddPet.ts b/examples/typescript/src/gen/ts/models/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/typescript/src/gen/ts/models/AddPet.ts +++ b/examples/typescript/src/gen/ts/models/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/typescript/src/gen/ts/models/AddPetRequest.ts b/examples/typescript/src/gen/ts/models/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/typescript/src/gen/ts/models/AddPetRequest.ts +++ b/examples/typescript/src/gen/ts/models/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/typescript/src/gen/ts/models/ApiResponse.ts b/examples/typescript/src/gen/ts/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/typescript/src/gen/ts/models/ApiResponse.ts +++ b/examples/typescript/src/gen/ts/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/typescript/src/gen/ts/models/Category.ts b/examples/typescript/src/gen/ts/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/typescript/src/gen/ts/models/Category.ts +++ b/examples/typescript/src/gen/ts/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/typescript/src/gen/ts/models/Customer.ts b/examples/typescript/src/gen/ts/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/typescript/src/gen/ts/models/Customer.ts +++ b/examples/typescript/src/gen/ts/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/typescript/src/gen/ts/models/DeleteOrder.ts b/examples/typescript/src/gen/ts/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/typescript/src/gen/ts/models/DeleteOrder.ts +++ b/examples/typescript/src/gen/ts/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/typescript/src/gen/ts/models/DeletePet.ts b/examples/typescript/src/gen/ts/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/typescript/src/gen/ts/models/DeletePet.ts +++ b/examples/typescript/src/gen/ts/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/typescript/src/gen/ts/models/GetOrderById.ts b/examples/typescript/src/gen/ts/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/typescript/src/gen/ts/models/GetOrderById.ts +++ b/examples/typescript/src/gen/ts/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/typescript/src/gen/ts/models/GetPetById.ts b/examples/typescript/src/gen/ts/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/typescript/src/gen/ts/models/GetPetById.ts +++ b/examples/typescript/src/gen/ts/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/typescript/src/gen/ts/models/Order.ts b/examples/typescript/src/gen/ts/models/Order.ts index 878fe6ba2..869963878 100644 --- a/examples/typescript/src/gen/ts/models/Order.ts +++ b/examples/typescript/src/gen/ts/models/Order.ts @@ -12,19 +12,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/typescript/src/gen/ts/models/Pet.ts b/examples/typescript/src/gen/ts/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/typescript/src/gen/ts/models/Pet.ts +++ b/examples/typescript/src/gen/ts/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/typescript/src/gen/ts/models/PetNotFound.ts b/examples/typescript/src/gen/ts/models/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/typescript/src/gen/ts/models/PetNotFound.ts +++ b/examples/typescript/src/gen/ts/models/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/typescript/src/gen/ts/models/Tag.ts b/examples/typescript/src/gen/ts/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/typescript/src/gen/ts/models/Tag.ts +++ b/examples/typescript/src/gen/ts/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts b/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts +++ b/examples/typescript/src/gen/ts/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/typescript/src/gen/ts/models/UploadFile.ts b/examples/typescript/src/gen/ts/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/typescript/src/gen/ts/models/UploadFile.ts +++ b/examples/typescript/src/gen/ts/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/typescript/src/gen/ts/models/User.ts b/examples/typescript/src/gen/ts/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/typescript/src/gen/ts/models/User.ts +++ b/examples/typescript/src/gen/ts/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/vue-query-v5/src/gen/hooks/index.ts b/examples/vue-query-v5/src/gen/hooks/index.ts index 17d307880..2770566c1 100644 --- a/examples/vue-query-v5/src/gen/hooks/index.ts +++ b/examples/vue-query-v5/src/gen/hooks/index.ts @@ -1,19 +1,19 @@ -export * from './useAddPet' -export * from './useCreateUser' -export * from './useCreateUsersWithListInput' -export * from './useDeleteOrder' -export * from './useDeletePet' -export * from './useDeleteUser' -export * from './useFindPetsByStatus' -export * from './useFindPetsByTags' -export * from './useGetInventory' -export * from './useGetOrderById' -export * from './useGetPetById' -export * from './useGetUserByName' -export * from './useLoginUser' -export * from './useLogoutUser' -export * from './usePlaceOrder' -export * from './useUpdatePet' -export * from './useUpdatePetWithForm' -export * from './useUpdateUser' -export * from './useUploadFile' +export * from "./useAddPet"; +export * from "./useCreateUser"; +export * from "./useCreateUsersWithListInput"; +export * from "./useDeleteOrder"; +export * from "./useDeletePet"; +export * from "./useDeleteUser"; +export * from "./useFindPetsByStatus"; +export * from "./useFindPetsByTags"; +export * from "./useGetInventory"; +export * from "./useGetOrderById"; +export * from "./useGetPetById"; +export * from "./useGetUserByName"; +export * from "./useLoginUser"; +export * from "./useLogoutUser"; +export * from "./usePlaceOrder"; +export * from "./useUpdatePet"; +export * from "./useUpdatePetWithForm"; +export * from "./useUpdateUser"; +export * from "./useUploadFile"; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useAddPet.ts b/examples/vue-query-v5/src/gen/hooks/useAddPet.ts index dde9979fc..1b78e7562 100644 --- a/examples/vue-query-v5/src/gen/hooks/useAddPet.ts +++ b/examples/vue-query-v5/src/gen/hooks/useAddPet.ts @@ -1,44 +1,42 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import type { AddPet405, AddPetMutationRequest, AddPetMutationResponse } from '../models/AddPet' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from "../models/AddPet"; +import type { UseMutationOptions } from "@tanstack/vue-query"; -type AddPetClient = typeof client + type AddPetClient = typeof client; type AddPet = { - data: AddPetMutationResponse - error: AddPet405 - request: AddPetMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: AddPetMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: AddPetMutationResponse; + error: AddPet405; + request: AddPetMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: AddPetMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Add a new pet to the store * @summary Add a new pet to the store * @link /pet */ -export function useAddPet( - options: { - mutation?: UseMutationOptions - client?: AddPet['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/pet', - data, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useAddPet(options: { + mutation?: UseMutationOptions; + client?: AddPet["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/pet`, + data, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts b/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts index c8d1efd86..9d16fab34 100644 --- a/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useCreateUser.ts @@ -1,44 +1,42 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import type { CreateUserMutationRequest, CreateUserMutationResponse } from "../models/CreateUser"; +import type { UseMutationOptions } from "@tanstack/vue-query"; -type CreateUserClient = typeof client + type CreateUserClient = typeof client; type CreateUser = { - data: CreateUserMutationResponse - error: never - request: CreateUserMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: CreateUserMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: CreateUserMutationResponse; + error: never; + request: CreateUserMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: CreateUserMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description This can only be done by the logged in user. * @summary Create user * @link /user */ -export function useCreateUser( - options: { - mutation?: UseMutationOptions - client?: CreateUser['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/user', - data, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useCreateUser(options: { + mutation?: UseMutationOptions; + client?: CreateUser["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/user`, + data, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts index 3edc4a624..7191323ae 100644 --- a/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query-v5/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,44 +1,42 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from "../models/CreateUsersWithListInput"; +import type { UseMutationOptions } from "@tanstack/vue-query"; -type CreateUsersWithListInputClient = typeof client + type CreateUsersWithListInputClient = typeof client; type CreateUsersWithListInput = { - data: CreateUsersWithListInputMutationResponse - error: never - request: CreateUsersWithListInputMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: CreateUsersWithListInputMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: CreateUsersWithListInputMutationResponse; + error: never; + request: CreateUsersWithListInputMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: CreateUsersWithListInputMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Creates list of users with given input array * @summary Creates list of users with given input array * @link /user/createWithList */ -export function useCreateUsersWithListInput( - options: { - mutation?: UseMutationOptions - client?: CreateUsersWithListInput['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/user/createWithList', - data, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useCreateUsersWithListInput(options: { + mutation?: UseMutationOptions; + client?: CreateUsersWithListInput["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/user/createWithList`, + data, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useDeleteOrder.ts b/examples/vue-query-v5/src/gen/hooks/useDeleteOrder.ts index 28560b38e..5ba392b05 100644 --- a/examples/vue-query-v5/src/gen/hooks/useDeleteOrder.ts +++ b/examples/vue-query-v5/src/gen/hooks/useDeleteOrder.ts @@ -1,47 +1,44 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, DeleteOrderPathParams } from '../models/DeleteOrder' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from "../models/DeleteOrder"; +import type { UseMutationOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type DeleteOrderClient = typeof client + type DeleteOrderClient = typeof client; type DeleteOrder = { - data: DeleteOrderMutationResponse - error: DeleteOrder400 | DeleteOrder404 - request: never - pathParams: DeleteOrderPathParams - queryParams: never - headerParams: never - response: DeleteOrderMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: DeleteOrderMutationResponse; + error: DeleteOrder400 | DeleteOrder404; + request: never; + pathParams: DeleteOrderPathParams; + queryParams: never; + headerParams: never; + response: DeleteOrderMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * @link /store/order/:orderId */ -export function useDeleteOrder( - refOrderId: MaybeRef, - options: { - mutation?: UseMutationOptions - client?: DeleteOrder['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const orderId = unref(refOrderId) - const res = await client({ - method: 'delete', - url: `/store/order/${orderId}`, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useDeleteOrder(refOrderId: MaybeRef, options: { + mutation?: UseMutationOptions; + client?: DeleteOrder["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const orderId = unref(refOrderId); + const res = await client({ + method: "delete", + url: `/store/order/${orderId}`, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useDeletePet.ts b/examples/vue-query-v5/src/gen/hooks/useDeletePet.ts index 17795c800..1ad8fac29 100644 --- a/examples/vue-query-v5/src/gen/hooks/useDeletePet.ts +++ b/examples/vue-query-v5/src/gen/hooks/useDeletePet.ts @@ -1,50 +1,46 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { DeletePet400, DeletePetHeaderParams, DeletePetMutationResponse, DeletePetPathParams } from '../models/DeletePet' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from "../models/DeletePet"; +import type { UseMutationOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type DeletePetClient = typeof client + type DeletePetClient = typeof client; type DeletePet = { - data: DeletePetMutationResponse - error: DeletePet400 - request: never - pathParams: DeletePetPathParams - queryParams: never - headerParams: DeletePetHeaderParams - response: DeletePetMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: DeletePetMutationResponse; + error: DeletePet400; + request: never; + pathParams: DeletePetPathParams; + queryParams: never; + headerParams: DeletePetHeaderParams; + response: DeletePetMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description delete a pet * @summary Deletes a pet * @link /pet/:petId */ -export function useDeletePet( - refPetId: MaybeRef, - refHeaders?: MaybeRef, - options: { - mutation?: UseMutationOptions - client?: DeletePet['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const petId = unref(refPetId) - const headers = unref(refHeaders) - const res = await client({ - method: 'delete', - url: `/pet/${petId}`, - headers: { ...headers, ...clientOptions.headers }, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useDeletePet(refPetId: MaybeRef, refHeaders?: MaybeRef, options: { + mutation?: UseMutationOptions; + client?: DeletePet["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const petId = unref(refPetId); + const headers = unref(refHeaders); + const res = await client({ + method: "delete", + url: `/pet/${petId}`, + headers: { ...headers, ...clientOptions.headers }, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useDeleteUser.ts b/examples/vue-query-v5/src/gen/hooks/useDeleteUser.ts index 44c32968d..a873e08c6 100644 --- a/examples/vue-query-v5/src/gen/hooks/useDeleteUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useDeleteUser.ts @@ -1,47 +1,44 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUserPathParams } from '../models/DeleteUser' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from "../models/DeleteUser"; +import type { UseMutationOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type DeleteUserClient = typeof client + type DeleteUserClient = typeof client; type DeleteUser = { - data: DeleteUserMutationResponse - error: DeleteUser400 | DeleteUser404 - request: never - pathParams: DeleteUserPathParams - queryParams: never - headerParams: never - response: DeleteUserMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: DeleteUserMutationResponse; + error: DeleteUser400 | DeleteUser404; + request: never; + pathParams: DeleteUserPathParams; + queryParams: never; + headerParams: never; + response: DeleteUserMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description This can only be done by the logged in user. * @summary Delete user * @link /user/:username */ -export function useDeleteUser( - refUsername: MaybeRef, - options: { - mutation?: UseMutationOptions - client?: DeleteUser['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const username = unref(refUsername) - const res = await client({ - method: 'delete', - url: `/user/${username}`, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useDeleteUser(refUsername: MaybeRef, options: { + mutation?: UseMutationOptions; + client?: DeleteUser["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const username = unref(refUsername); + const res = await client({ + method: "delete", + url: `/user/${username}`, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts b/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts index de1a58816..ec56dab4d 100644 --- a/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/vue-query-v5/src/gen/hooks/useFindPetsByStatus.ts @@ -1,70 +1,62 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { FindPetsByStatus400, FindPetsByStatusQueryParams, FindPetsByStatusQueryResponse } from '../models/FindPetsByStatus' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from "../models/FindPetsByStatus"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type FindPetsByStatusClient = typeof client + type FindPetsByStatusClient = typeof client; type FindPetsByStatus = { - data: FindPetsByStatusQueryResponse - error: FindPetsByStatus400 - request: never - pathParams: never - queryParams: FindPetsByStatusQueryParams - headerParams: never - response: FindPetsByStatusQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const findPetsByStatusQueryKey = (params?: MaybeRef) => - [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const -export type FindPetsByStatusQueryKey = ReturnType -export function findPetsByStatusQueryOptions(refParams?: MaybeRef, options: FindPetsByStatus['client']['parameters'] = {}) { - const queryKey = findPetsByStatusQueryKey(refParams) - return queryOptions({ - queryKey, - queryFn: async () => { - const params = unref(refParams) - const res = await client({ - method: 'get', - url: '/pet/findByStatus', - params, - ...options, - }) - return res.data - }, - }) + data: FindPetsByStatusQueryResponse; + error: FindPetsByStatus400; + request: never; + pathParams: never; + queryParams: FindPetsByStatusQueryParams; + headerParams: never; + response: FindPetsByStatusQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const findPetsByStatusQueryKey = (params?: MaybeRef) => [{ url: "/pet/findByStatus" }, ...(params ? [params] : [])] as const; +export type FindPetsByStatusQueryKey = ReturnType; +export function findPetsByStatusQueryOptions(refParams?: MaybeRef, options: FindPetsByStatus["client"]["parameters"] = {}) { + const queryKey = findPetsByStatusQueryKey(refParams); + return queryOptions({ + queryKey, + queryFn: async () => { + const params = unref(refParams); + const res = await client({ + method: "get", + url: `/pet/findByStatus`, + params, + ...options + }); + return res.data; + }, + }); } /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * @link /pet/findByStatus */ -export function useFindPetsByStatus< - TData = FindPetsByStatus['response'], - TQueryData = FindPetsByStatus['response'], - TQueryKey extends QueryKey = FindPetsByStatusQueryKey, ->( - refParams?: MaybeRef, - options: { - query?: Partial> - client?: FindPetsByStatus['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useFindPetsByStatus(refParams?: MaybeRef, options: { + query?: Partial>; + client?: FindPetsByStatus["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(refParams) - const query = useQuery({ - ...(findPetsByStatusQueryOptions(refParams, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(refParams); + const query = useQuery({ + ...findPetsByStatusQueryOptions(refParams, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts b/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts index ea3fd6e9a..8946c44fc 100644 --- a/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/vue-query-v5/src/gen/hooks/useFindPetsByTags.ts @@ -1,69 +1,62 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { FindPetsByTags400, FindPetsByTagsQueryParams, FindPetsByTagsQueryResponse } from '../models/FindPetsByTags' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from "../models/FindPetsByTags"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type FindPetsByTagsClient = typeof client + type FindPetsByTagsClient = typeof client; type FindPetsByTags = { - data: FindPetsByTagsQueryResponse - error: FindPetsByTags400 - request: never - pathParams: never - queryParams: FindPetsByTagsQueryParams - headerParams: never - response: FindPetsByTagsQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const findPetsByTagsQueryKey = (params?: MaybeRef) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const -export type FindPetsByTagsQueryKey = ReturnType -export function findPetsByTagsQueryOptions(refParams?: MaybeRef, options: FindPetsByTags['client']['parameters'] = {}) { - const queryKey = findPetsByTagsQueryKey(refParams) - return queryOptions({ - queryKey, - queryFn: async () => { - const params = unref(refParams) - const res = await client({ - method: 'get', - url: '/pet/findByTags', - params, - ...options, - }) - return res.data - }, - }) + data: FindPetsByTagsQueryResponse; + error: FindPetsByTags400; + request: never; + pathParams: never; + queryParams: FindPetsByTagsQueryParams; + headerParams: never; + response: FindPetsByTagsQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const findPetsByTagsQueryKey = (params?: MaybeRef) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; +export type FindPetsByTagsQueryKey = ReturnType; +export function findPetsByTagsQueryOptions(refParams?: MaybeRef, options: FindPetsByTags["client"]["parameters"] = {}) { + const queryKey = findPetsByTagsQueryKey(refParams); + return queryOptions({ + queryKey, + queryFn: async () => { + const params = unref(refParams); + const res = await client({ + method: "get", + url: `/pet/findByTags`, + params, + ...options + }); + return res.data; + }, + }); } /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTags< - TData = FindPetsByTags['response'], - TQueryData = FindPetsByTags['response'], - TQueryKey extends QueryKey = FindPetsByTagsQueryKey, ->( - refParams?: MaybeRef, - options: { - query?: Partial> - client?: FindPetsByTags['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useFindPetsByTags(refParams?: MaybeRef, options: { + query?: Partial>; + client?: FindPetsByTags["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(refParams) - const query = useQuery({ - ...(findPetsByTagsQueryOptions(refParams, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(refParams); + const query = useQuery({ + ...findPetsByTagsQueryOptions(refParams, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts b/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts index 863cd476a..86f76df5a 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetInventory.ts @@ -1,60 +1,58 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { GetInventoryQueryResponse } from '../models/GetInventory' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import type { GetInventoryQueryResponse } from "../models/GetInventory"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; -type GetInventoryClient = typeof client + type GetInventoryClient = typeof client; type GetInventory = { - data: GetInventoryQueryResponse - error: never - request: never - pathParams: never - queryParams: never - headerParams: never - response: GetInventoryQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getInventoryQueryKey = () => [{ url: '/store/inventory' }] as const -export type GetInventoryQueryKey = ReturnType -export function getInventoryQueryOptions(options: GetInventory['client']['parameters'] = {}) { - const queryKey = getInventoryQueryKey() - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/store/inventory', - ...options, - }) - return res.data - }, - }) + data: GetInventoryQueryResponse; + error: never; + request: never; + pathParams: never; + queryParams: never; + headerParams: never; + response: GetInventoryQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getInventoryQueryKey = () => [{ url: "/store/inventory" }] as const; +export type GetInventoryQueryKey = ReturnType; +export function getInventoryQueryOptions(options: GetInventory["client"]["parameters"] = {}) { + const queryKey = getInventoryQueryKey(); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/store/inventory`, + ...options + }); + return res.data; + }, + }); } /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * @link /store/inventory */ -export function useGetInventory( - options: { - query?: Partial> - client?: GetInventory['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useGetInventory(options: { + query?: Partial>; + client?: GetInventory["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey() - const query = useQuery({ - ...(getInventoryQueryOptions(clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey(); + const query = useQuery({ + ...getInventoryQueryOptions(clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts b/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts index 75811effb..e79c4afef 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetOrderById.ts @@ -1,65 +1,61 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { GetOrderById400, GetOrderById404, GetOrderByIdPathParams, GetOrderByIdQueryResponse } from '../models/GetOrderById' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from "../models/GetOrderById"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type GetOrderByIdClient = typeof client + type GetOrderByIdClient = typeof client; type GetOrderById = { - data: GetOrderByIdQueryResponse - error: GetOrderById400 | GetOrderById404 - request: never - pathParams: GetOrderByIdPathParams - queryParams: never - headerParams: never - response: GetOrderByIdQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getOrderByIdQueryKey = (orderId: MaybeRef) => - [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const -export type GetOrderByIdQueryKey = ReturnType -export function getOrderByIdQueryOptions(refOrderId: MaybeRef, options: GetOrderById['client']['parameters'] = {}) { - const queryKey = getOrderByIdQueryKey(refOrderId) - return queryOptions({ - queryKey, - queryFn: async () => { - const orderId = unref(refOrderId) - const res = await client({ - method: 'get', - url: `/store/order/${orderId}`, - ...options, - }) - return res.data - }, - }) + data: GetOrderByIdQueryResponse; + error: GetOrderById400 | GetOrderById404; + request: never; + pathParams: GetOrderByIdPathParams; + queryParams: never; + headerParams: never; + response: GetOrderByIdQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getOrderByIdQueryKey = (orderId: MaybeRef) => [{ url: "/store/order/:orderId", params: { orderId: orderId } }] as const; +export type GetOrderByIdQueryKey = ReturnType; +export function getOrderByIdQueryOptions(refOrderId: MaybeRef, options: GetOrderById["client"]["parameters"] = {}) { + const queryKey = getOrderByIdQueryKey(refOrderId); + return queryOptions({ + queryKey, + queryFn: async () => { + const orderId = unref(refOrderId); + const res = await client({ + method: "get", + url: `/store/order/${orderId}`, + ...options + }); + return res.data; + }, + }); } /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * @link /store/order/:orderId */ -export function useGetOrderById( - refOrderId: GetOrderByIdPathParams['orderId'], - options: { - query?: Partial> - client?: GetOrderById['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useGetOrderById(refOrderId: GetOrderByIdPathParams["orderId"], options: { + query?: Partial>; + client?: GetOrderById["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey(refOrderId) - const query = useQuery({ - ...(getOrderByIdQueryOptions(refOrderId, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey(refOrderId); + const query = useQuery({ + ...getOrderByIdQueryOptions(refOrderId, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts b/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts index 3f1bc40d3..73a626043 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetPetById.ts @@ -1,64 +1,61 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { GetPetById400, GetPetById404, GetPetByIdPathParams, GetPetByIdQueryResponse } from '../models/GetPetById' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from "../models/GetPetById"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type GetPetByIdClient = typeof client + type GetPetByIdClient = typeof client; type GetPetById = { - data: GetPetByIdQueryResponse - error: GetPetById400 | GetPetById404 - request: never - pathParams: GetPetByIdPathParams - queryParams: never - headerParams: never - response: GetPetByIdQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getPetByIdQueryKey = (petId: MaybeRef) => [{ url: '/pet/:petId', params: { petId: petId } }] as const -export type GetPetByIdQueryKey = ReturnType -export function getPetByIdQueryOptions(refPetId: MaybeRef, options: GetPetById['client']['parameters'] = {}) { - const queryKey = getPetByIdQueryKey(refPetId) - return queryOptions({ - queryKey, - queryFn: async () => { - const petId = unref(refPetId) - const res = await client({ - method: 'get', - url: `/pet/${petId}`, - ...options, - }) - return res.data - }, - }) + data: GetPetByIdQueryResponse; + error: GetPetById400 | GetPetById404; + request: never; + pathParams: GetPetByIdPathParams; + queryParams: never; + headerParams: never; + response: GetPetByIdQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getPetByIdQueryKey = (petId: MaybeRef) => [{ url: "/pet/:petId", params: { petId: petId } }] as const; +export type GetPetByIdQueryKey = ReturnType; +export function getPetByIdQueryOptions(refPetId: MaybeRef, options: GetPetById["client"]["parameters"] = {}) { + const queryKey = getPetByIdQueryKey(refPetId); + return queryOptions({ + queryKey, + queryFn: async () => { + const petId = unref(refPetId); + const res = await client({ + method: "get", + url: `/pet/${petId}`, + ...options + }); + return res.data; + }, + }); } /** * @description Returns a single pet * @summary Find pet by ID * @link /pet/:petId */ -export function useGetPetById( - refPetId: GetPetByIdPathParams['petId'], - options: { - query?: Partial> - client?: GetPetById['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useGetPetById(refPetId: GetPetByIdPathParams["petId"], options: { + query?: Partial>; + client?: GetPetById["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(refPetId) - const query = useQuery({ - ...(getPetByIdQueryOptions(refPetId, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(refPetId); + const query = useQuery({ + ...getPetByIdQueryOptions(refPetId, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts b/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts index 5da551859..66241b03e 100644 --- a/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts +++ b/examples/vue-query-v5/src/gen/hooks/useGetUserByName.ts @@ -1,64 +1,60 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { GetUserByName400, GetUserByName404, GetUserByNamePathParams, GetUserByNameQueryResponse } from '../models/GetUserByName' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from "../models/GetUserByName"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type GetUserByNameClient = typeof client + type GetUserByNameClient = typeof client; type GetUserByName = { - data: GetUserByNameQueryResponse - error: GetUserByName400 | GetUserByName404 - request: never - pathParams: GetUserByNamePathParams - queryParams: never - headerParams: never - response: GetUserByNameQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const getUserByNameQueryKey = (username: MaybeRef) => - [{ url: '/user/:username', params: { username: username } }] as const -export type GetUserByNameQueryKey = ReturnType -export function getUserByNameQueryOptions(refUsername: MaybeRef, options: GetUserByName['client']['parameters'] = {}) { - const queryKey = getUserByNameQueryKey(refUsername) - return queryOptions({ - queryKey, - queryFn: async () => { - const username = unref(refUsername) - const res = await client({ - method: 'get', - url: `/user/${username}`, - ...options, - }) - return res.data - }, - }) + data: GetUserByNameQueryResponse; + error: GetUserByName400 | GetUserByName404; + request: never; + pathParams: GetUserByNamePathParams; + queryParams: never; + headerParams: never; + response: GetUserByNameQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const getUserByNameQueryKey = (username: MaybeRef) => [{ url: "/user/:username", params: { username: username } }] as const; +export type GetUserByNameQueryKey = ReturnType; +export function getUserByNameQueryOptions(refUsername: MaybeRef, options: GetUserByName["client"]["parameters"] = {}) { + const queryKey = getUserByNameQueryKey(refUsername); + return queryOptions({ + queryKey, + queryFn: async () => { + const username = unref(refUsername); + const res = await client({ + method: "get", + url: `/user/${username}`, + ...options + }); + return res.data; + }, + }); } /** * @summary Get user by user name * @link /user/:username */ -export function useGetUserByName( - refUsername: GetUserByNamePathParams['username'], - options: { - query?: Partial> - client?: GetUserByName['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useGetUserByName(refUsername: GetUserByNamePathParams["username"], options: { + query?: Partial>; + client?: GetUserByName["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(refUsername) - const query = useQuery({ - ...(getUserByNameQueryOptions(refUsername, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(refUsername); + const query = useQuery({ + ...getUserByNameQueryOptions(refUsername, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts b/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts index 458e22ed3..171d540bf 100644 --- a/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useLoginUser.ts @@ -1,64 +1,61 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { LoginUser400, LoginUserQueryParams, LoginUserQueryResponse } from '../models/LoginUser' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from "../models/LoginUser"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type LoginUserClient = typeof client + type LoginUserClient = typeof client; type LoginUser = { - data: LoginUserQueryResponse - error: LoginUser400 - request: never - pathParams: never - queryParams: LoginUserQueryParams - headerParams: never - response: LoginUserQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const loginUserQueryKey = (params?: MaybeRef) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const -export type LoginUserQueryKey = ReturnType -export function loginUserQueryOptions(refParams?: MaybeRef, options: LoginUser['client']['parameters'] = {}) { - const queryKey = loginUserQueryKey(refParams) - return queryOptions({ - queryKey, - queryFn: async () => { - const params = unref(refParams) - const res = await client({ - method: 'get', - url: '/user/login', - params, - ...options, - }) - return res.data - }, - }) + data: LoginUserQueryResponse; + error: LoginUser400; + request: never; + pathParams: never; + queryParams: LoginUserQueryParams; + headerParams: never; + response: LoginUserQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const loginUserQueryKey = (params?: MaybeRef) => [{ url: "/user/login" }, ...(params ? [params] : [])] as const; +export type LoginUserQueryKey = ReturnType; +export function loginUserQueryOptions(refParams?: MaybeRef, options: LoginUser["client"]["parameters"] = {}) { + const queryKey = loginUserQueryKey(refParams); + return queryOptions({ + queryKey, + queryFn: async () => { + const params = unref(refParams); + const res = await client({ + method: "get", + url: `/user/login`, + params, + ...options + }); + return res.data; + }, + }); } /** * @summary Logs user into the system * @link /user/login */ -export function useLoginUser( - refParams?: MaybeRef, - options: { - query?: Partial> - client?: LoginUser['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useLoginUser(refParams?: MaybeRef, options: { + query?: Partial>; + client?: LoginUser["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(refParams) - const query = useQuery({ - ...(loginUserQueryOptions(refParams, clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(refParams); + const query = useQuery({ + ...loginUserQueryOptions(refParams, clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts b/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts index 59817e400..f4bd24473 100644 --- a/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useLogoutUser.ts @@ -1,59 +1,57 @@ -import client from '@kubb/swagger-client/client' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { LogoutUserQueryResponse } from '../models/LogoutUser' +import client from "@kubb/swagger-client/client"; +import { useQuery, queryOptions } from "@tanstack/vue-query"; +import type { LogoutUserQueryResponse } from "../models/LogoutUser"; +import type { QueryObserverOptions, UseQueryReturnType, QueryKey } from "@tanstack/vue-query"; -type LogoutUserClient = typeof client + type LogoutUserClient = typeof client; type LogoutUser = { - data: LogoutUserQueryResponse - error: never - request: never - pathParams: never - queryParams: never - headerParams: never - response: LogoutUserQueryResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} -export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const -export type LogoutUserQueryKey = ReturnType -export function logoutUserQueryOptions(options: LogoutUser['client']['parameters'] = {}) { - const queryKey = logoutUserQueryKey() - return queryOptions({ - queryKey, - queryFn: async () => { - const res = await client({ - method: 'get', - url: '/user/logout', - ...options, - }) - return res.data - }, - }) + data: LogoutUserQueryResponse; + error: never; + request: never; + pathParams: never; + queryParams: never; + headerParams: never; + response: LogoutUserQueryResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; +export const logoutUserQueryKey = () => [{ url: "/user/logout" }] as const; +export type LogoutUserQueryKey = ReturnType; +export function logoutUserQueryOptions(options: LogoutUser["client"]["parameters"] = {}) { + const queryKey = logoutUserQueryKey(); + return queryOptions({ + queryKey, + queryFn: async () => { + const res = await client({ + method: "get", + url: `/user/logout`, + ...options + }); + return res.data; + }, + }); } /** * @summary Logs out current logged in user session * @link /user/logout */ -export function useLogoutUser( - options: { - query?: Partial> - client?: LogoutUser['client']['parameters'] - } = {}, -): UseQueryReturnType & { - queryKey: TQueryKey +export function useLogoutUser(options: { + query?: Partial>; + client?: LogoutUser["client"]["parameters"]; +} = {}): UseQueryReturnType & { + queryKey: TQueryKey; } { - const { query: queryOptions, client: clientOptions = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey() - const query = useQuery({ - ...(logoutUserQueryOptions(clientOptions) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} + const { query: queryOptions, client: clientOptions = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey(); + const query = useQuery({ + ...logoutUserQueryOptions(clientOptions) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/usePlaceOrder.ts b/examples/vue-query-v5/src/gen/hooks/usePlaceOrder.ts index 64b05076d..6f969df2b 100644 --- a/examples/vue-query-v5/src/gen/hooks/usePlaceOrder.ts +++ b/examples/vue-query-v5/src/gen/hooks/usePlaceOrder.ts @@ -1,44 +1,42 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import type { PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationResponse } from '../models/PlaceOrder' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from "../models/PlaceOrder"; +import type { UseMutationOptions } from "@tanstack/vue-query"; -type PlaceOrderClient = typeof client + type PlaceOrderClient = typeof client; type PlaceOrder = { - data: PlaceOrderMutationResponse - error: PlaceOrder405 - request: PlaceOrderMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: PlaceOrderMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: PlaceOrderMutationResponse; + error: PlaceOrder405; + request: PlaceOrderMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: PlaceOrderMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Place a new order in the store * @summary Place an order for a pet * @link /store/order */ -export function usePlaceOrder( - options: { - mutation?: UseMutationOptions - client?: PlaceOrder['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'post', - url: '/store/order', - data, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function usePlaceOrder(options: { + mutation?: UseMutationOptions; + client?: PlaceOrder["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "post", + url: `/store/order`, + data, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useUpdatePet.ts b/examples/vue-query-v5/src/gen/hooks/useUpdatePet.ts index ecfade8fb..c15a804d3 100644 --- a/examples/vue-query-v5/src/gen/hooks/useUpdatePet.ts +++ b/examples/vue-query-v5/src/gen/hooks/useUpdatePet.ts @@ -1,44 +1,42 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import type { UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest, UpdatePetMutationResponse } from '../models/UpdatePet' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from "../models/UpdatePet"; +import type { UseMutationOptions } from "@tanstack/vue-query"; -type UpdatePetClient = typeof client + type UpdatePetClient = typeof client; type UpdatePet = { - data: UpdatePetMutationResponse - error: UpdatePet400 | UpdatePet404 | UpdatePet405 - request: UpdatePetMutationRequest - pathParams: never - queryParams: never - headerParams: never - response: UpdatePetMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: UpdatePetMutationResponse; + error: UpdatePet400 | UpdatePet404 | UpdatePet405; + request: UpdatePetMutationRequest; + pathParams: never; + queryParams: never; + headerParams: never; + response: UpdatePetMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description Update an existing pet by Id * @summary Update an existing pet * @link /pet */ -export function useUpdatePet( - options: { - mutation?: UseMutationOptions - client?: UpdatePet['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const res = await client({ - method: 'put', - url: '/pet', - data, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useUpdatePet(options: { + mutation?: UseMutationOptions; + client?: UpdatePet["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const res = await client({ + method: "put", + url: `/pet`, + data, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useUpdatePetWithForm.ts b/examples/vue-query-v5/src/gen/hooks/useUpdatePetWithForm.ts index 692188c1c..d12c0710b 100644 --- a/examples/vue-query-v5/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/vue-query-v5/src/gen/hooks/useUpdatePetWithForm.ts @@ -1,54 +1,45 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { - UpdatePetWithForm405, - UpdatePetWithFormMutationResponse, - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, -} from '../models/UpdatePetWithForm' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405 } from "../models/UpdatePetWithForm"; +import type { UseMutationOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type UpdatePetWithFormClient = typeof client + type UpdatePetWithFormClient = typeof client; type UpdatePetWithForm = { - data: UpdatePetWithFormMutationResponse - error: UpdatePetWithForm405 - request: never - pathParams: UpdatePetWithFormPathParams - queryParams: UpdatePetWithFormQueryParams - headerParams: never - response: UpdatePetWithFormMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: UpdatePetWithFormMutationResponse; + error: UpdatePetWithForm405; + request: never; + pathParams: UpdatePetWithFormPathParams; + queryParams: UpdatePetWithFormQueryParams; + headerParams: never; + response: UpdatePetWithFormMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @summary Updates a pet in the store with form data * @link /pet/:petId */ -export function useUpdatePetWithForm( - refPetId: MaybeRef, - refParams?: MaybeRef, - options: { - mutation?: UseMutationOptions - client?: UpdatePetWithForm['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const petId = unref(refPetId) - const params = unref(refParams) - const res = await client({ - method: 'post', - url: `/pet/${petId}`, - params, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useUpdatePetWithForm(refPetId: MaybeRef, refParams?: MaybeRef, options: { + mutation?: UseMutationOptions; + client?: UpdatePetWithForm["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const petId = unref(refPetId); + const params = unref(refParams); + const res = await client({ + method: "post", + url: `/pet/${petId}`, + params, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts b/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts index 768a8c18d..e35d5cce1 100644 --- a/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query-v5/src/gen/hooks/useUpdateUser.ts @@ -1,48 +1,45 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from "../models/UpdateUser"; +import type { UseMutationOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type UpdateUserClient = typeof client + type UpdateUserClient = typeof client; type UpdateUser = { - data: UpdateUserMutationResponse - error: never - request: UpdateUserMutationRequest - pathParams: UpdateUserPathParams - queryParams: never - headerParams: never - response: UpdateUserMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: UpdateUserMutationResponse; + error: never; + request: UpdateUserMutationRequest; + pathParams: UpdateUserPathParams; + queryParams: never; + headerParams: never; + response: UpdateUserMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @description This can only be done by the logged in user. * @summary Update user * @link /user/:username */ -export function useUpdateUser( - refUsername: MaybeRef, - options: { - mutation?: UseMutationOptions - client?: UpdateUser['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const username = unref(refUsername) - const res = await client({ - method: 'put', - url: `/user/${username}`, - data, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useUpdateUser(refUsername: MaybeRef, options: { + mutation?: UseMutationOptions; + client?: UpdateUser["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const username = unref(refUsername); + const res = await client({ + method: "put", + url: `/user/${username}`, + data, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/hooks/useUploadFile.ts b/examples/vue-query-v5/src/gen/hooks/useUploadFile.ts index e5b4f137a..7a5a37d75 100644 --- a/examples/vue-query-v5/src/gen/hooks/useUploadFile.ts +++ b/examples/vue-query-v5/src/gen/hooks/useUploadFile.ts @@ -1,50 +1,46 @@ -import client from '@kubb/swagger-client/client' -import { useMutation } from '@tanstack/vue-query' -import type { UseMutationOptions } from '@tanstack/vue-query' -import { unref } from 'vue' -import type { MaybeRef } from 'vue' -import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile' +import client from "@kubb/swagger-client/client"; +import { useMutation } from "@tanstack/vue-query"; +import { unref } from "vue"; +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from "../models/UploadFile"; +import type { UseMutationOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; -type UploadFileClient = typeof client + type UploadFileClient = typeof client; type UploadFile = { - data: UploadFileMutationResponse - error: never - request: UploadFileMutationRequest - pathParams: UploadFilePathParams - queryParams: UploadFileQueryParams - headerParams: never - response: UploadFileMutationResponse - client: { - parameters: Partial[0]> - return: Awaited> - } -} + data: UploadFileMutationResponse; + error: never; + request: UploadFileMutationRequest; + pathParams: UploadFilePathParams; + queryParams: UploadFileQueryParams; + headerParams: never; + response: UploadFileMutationResponse; + client: { + parameters: Partial[0]>; + return: Awaited>; + }; +}; /** * @summary uploads an image * @link /pet/:petId/uploadImage */ -export function useUploadFile( - refPetId: MaybeRef, - refParams?: MaybeRef, - options: { - mutation?: UseMutationOptions - client?: UploadFile['client']['parameters'] - } = {}, -) { - const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {} - return useMutation({ - mutationFn: async (data) => { - const petId = unref(refPetId) - const params = unref(refParams) - const res = await client({ - method: 'post', - url: `/pet/${petId}/uploadImage`, - params, - data, - ...clientOptions, - }) - return res.data - }, - ...mutationOptions, - }) -} +export function useUploadFile(refPetId: MaybeRef, refParams?: MaybeRef, options: { + mutation?: UseMutationOptions; + client?: UploadFile["client"]["parameters"]; +} = {}) { + const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}; + return useMutation({ + mutationFn: async (data) => { + const petId = unref(refPetId); + const params = unref(refParams); + const res = await client({ + method: "post", + url: `/pet/${petId}/uploadImage`, + params, + data, + ...clientOptions + }); + return res.data; + }, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/index.ts b/examples/vue-query-v5/src/gen/index.ts index 6e6f12d44..91cd800f9 100644 --- a/examples/vue-query-v5/src/gen/index.ts +++ b/examples/vue-query-v5/src/gen/index.ts @@ -1,2 +1,2 @@ -export * from './models/index' -export * from './hooks/index' +export * from "./models/index"; +export * from "./hooks/index"; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/AddPet.ts b/examples/vue-query-v5/src/gen/models/AddPet.ts index 27d8963df..a748a6e58 100644 --- a/examples/vue-query-v5/src/gen/models/AddPet.ts +++ b/examples/vue-query-v5/src/gen/models/AddPet.ts @@ -1,27 +1,27 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type AddPet200 = Pet +*/ +export type AddPet200 = Pet; -/** + /** * @description Invalid input - */ -export type AddPet405 = any +*/ +export type AddPet405 = any; -/** + /** * @description Create a new pet in the store - */ -export type AddPetMutationRequest = Pet +*/ +export type AddPetMutationRequest = Pet; -/** + /** * @description Successful operation - */ -export type AddPetMutationResponse = Pet +*/ +export type AddPetMutationResponse = Pet; -export type AddPetMutation = { - Response: AddPetMutationResponse - Request: AddPetMutationRequest - Errors: AddPet405 -} + export type AddPetMutation = { + Response: AddPetMutationResponse; + Request: AddPetMutationRequest; + Errors: AddPet405; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/Address.ts b/examples/vue-query-v5/src/gen/models/Address.ts index 6e6411f01..c6c00f000 100644 --- a/examples/vue-query-v5/src/gen/models/Address.ts +++ b/examples/vue-query-v5/src/gen/models/Address.ts @@ -1,26 +1,33 @@ export const addressIdentifier = { - NW: 'NW', - NE: 'NE', - SW: 'SW', - SE: 'SE', -} as const -export type AddressIdentifier = (typeof addressIdentifier)[keyof typeof addressIdentifier] + "NW": "NW", + "NE": "NE", + "SW": "SW", + "SE": "SE" +} as const; +export type AddressIdentifier = (typeof addressIdentifier)[keyof typeof addressIdentifier]; export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string - identifier?: [number, string, AddressIdentifier] -} + /** + * @type string | undefined + */ + street?: string; + /** + * @type string | undefined + */ + city?: string; + /** + * @type string | undefined + */ + state?: string; + /** + * @type string | undefined + */ + zip?: string; + /** + * @type array | undefined + */ + identifier?: [ + number, + string, + AddressIdentifier + ]; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/ApiResponse.ts b/examples/vue-query-v5/src/gen/models/ApiResponse.ts index 499e9e9ca..2a8e81e25 100644 --- a/examples/vue-query-v5/src/gen/models/ApiResponse.ts +++ b/examples/vue-query-v5/src/gen/models/ApiResponse.ts @@ -1,14 +1,14 @@ export type ApiResponse = { - /** - * @type integer | undefined int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + type?: string; + /** + * @type string | undefined + */ + message?: string; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/Category.ts b/examples/vue-query-v5/src/gen/models/Category.ts index 24b90a71a..49380ed19 100644 --- a/examples/vue-query-v5/src/gen/models/Category.ts +++ b/examples/vue-query-v5/src/gen/models/Category.ts @@ -1,10 +1,10 @@ export type Category = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/CreateUser.ts b/examples/vue-query-v5/src/gen/models/CreateUser.ts index ada359de3..048dec373 100644 --- a/examples/vue-query-v5/src/gen/models/CreateUser.ts +++ b/examples/vue-query-v5/src/gen/models/CreateUser.ts @@ -1,18 +1,18 @@ -import type { User } from './User' +import type { User } from "./User"; -/** + /** * @description successful operation - */ -export type CreateUserError = User +*/ +export type CreateUserError = User; -/** + /** * @description Created user object - */ -export type CreateUserMutationRequest = User +*/ +export type CreateUserMutationRequest = User; -export type CreateUserMutationResponse = any + export type CreateUserMutationResponse = any; -export type CreateUserMutation = { - Response: CreateUserMutationResponse - Request: CreateUserMutationRequest -} + export type CreateUserMutation = { + Response: CreateUserMutationResponse; + Request: CreateUserMutationRequest; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts index eb718eb51..daeaa03e6 100644 --- a/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/vue-query-v5/src/gen/models/CreateUsersWithListInput.ts @@ -1,23 +1,23 @@ -import type { User } from './User' +import type { User } from "./User"; -/** + /** * @description Successful operation - */ -export type CreateUsersWithListInput200 = User +*/ +export type CreateUsersWithListInput200 = User; -/** + /** * @description successful operation - */ -export type CreateUsersWithListInputError = any +*/ +export type CreateUsersWithListInputError = any; -export type CreateUsersWithListInputMutationRequest = User[] + export type CreateUsersWithListInputMutationRequest = User[]; -/** + /** * @description Successful operation - */ -export type CreateUsersWithListInputMutationResponse = User +*/ +export type CreateUsersWithListInputMutationResponse = User; -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse - Request: CreateUsersWithListInputMutationRequest -} + export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse; + Request: CreateUsersWithListInputMutationRequest; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/Customer.ts b/examples/vue-query-v5/src/gen/models/Customer.ts index 5a6d435a3..3cfe5b151 100644 --- a/examples/vue-query-v5/src/gen/models/Customer.ts +++ b/examples/vue-query-v5/src/gen/models/Customer.ts @@ -1,16 +1,16 @@ -import type { Address } from './Address' +import { Address } from "./Address"; -export type Customer = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] -} + export type Customer = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type array | undefined + */ + address?: Address[]; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/DeleteOrder.ts b/examples/vue-query-v5/src/gen/models/DeleteOrder.ts index d160f7c4e..fc5f0ae6f 100644 --- a/examples/vue-query-v5/src/gen/models/DeleteOrder.ts +++ b/examples/vue-query-v5/src/gen/models/DeleteOrder.ts @@ -1,25 +1,25 @@ export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer int64 - */ - orderId: number -} + /** + * @description ID of the order that needs to be deleted + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description Invalid ID supplied - */ -export type DeleteOrder400 = any +*/ +export type DeleteOrder400 = any; -/** + /** * @description Order not found - */ -export type DeleteOrder404 = any +*/ +export type DeleteOrder404 = any; -export type DeleteOrderMutationResponse = any + export type DeleteOrderMutationResponse = any; -export type DeleteOrderMutation = { - Response: DeleteOrderMutationResponse - PathParams: DeleteOrderPathParams - Errors: DeleteOrder400 | DeleteOrder404 -} + export type DeleteOrderMutation = { + Response: DeleteOrderMutationResponse; + PathParams: DeleteOrderPathParams; + Errors: DeleteOrder400 | DeleteOrder404; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/DeletePet.ts b/examples/vue-query-v5/src/gen/models/DeletePet.ts index 6bb98c261..89c7db814 100644 --- a/examples/vue-query-v5/src/gen/models/DeletePet.ts +++ b/examples/vue-query-v5/src/gen/models/DeletePet.ts @@ -1,28 +1,28 @@ export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer int64 - */ - petId: number -} + /** + * @description Pet id to delete + * @type integer, int64 + */ + petId: number; +}; -export type DeletePetHeaderParams = { - /** - * @type string | undefined - */ - api_key?: string -} + export type DeletePetHeaderParams = { + /** + * @type string | undefined + */ + api_key?: string; +}; -/** + /** * @description Invalid pet value - */ -export type DeletePet400 = any +*/ +export type DeletePet400 = any; -export type DeletePetMutationResponse = any + export type DeletePetMutationResponse = any; -export type DeletePetMutation = { - Response: DeletePetMutationResponse - PathParams: DeletePetPathParams - HeaderParams: DeletePetHeaderParams - Errors: DeletePet400 -} + export type DeletePetMutation = { + Response: DeletePetMutationResponse; + PathParams: DeletePetPathParams; + HeaderParams: DeletePetHeaderParams; + Errors: DeletePet400; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/DeleteUser.ts b/examples/vue-query-v5/src/gen/models/DeleteUser.ts index 63010e04f..16327e3b1 100644 --- a/examples/vue-query-v5/src/gen/models/DeleteUser.ts +++ b/examples/vue-query-v5/src/gen/models/DeleteUser.ts @@ -1,25 +1,25 @@ export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} + /** + * @description The name that needs to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description Invalid username supplied - */ -export type DeleteUser400 = any +*/ +export type DeleteUser400 = any; -/** + /** * @description User not found - */ -export type DeleteUser404 = any +*/ +export type DeleteUser404 = any; -export type DeleteUserMutationResponse = any + export type DeleteUserMutationResponse = any; -export type DeleteUserMutation = { - Response: DeleteUserMutationResponse - PathParams: DeleteUserPathParams - Errors: DeleteUser400 | DeleteUser404 -} + export type DeleteUserMutation = { + Response: DeleteUserMutationResponse; + PathParams: DeleteUserPathParams; + Errors: DeleteUser400 | DeleteUser404; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts b/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts index 504347081..0e9680607 100644 --- a/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts +++ b/examples/vue-query-v5/src/gen/models/FindPetsByStatus.ts @@ -1,37 +1,37 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export const findPetsByStatusQueryParamsStatus = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const -export type FindPetsByStatusQueryParamsStatus = (typeof findPetsByStatusQueryParamsStatus)[keyof typeof findPetsByStatusQueryParamsStatus] + export const findPetsByStatusQueryParamsStatus = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; +export type FindPetsByStatusQueryParamsStatus = (typeof findPetsByStatusQueryParamsStatus)[keyof typeof findPetsByStatusQueryParamsStatus]; export type FindPetsByStatusQueryParams = { - /** - * @description Status values that need to be considered for filter - * @default "available" - * @type string | undefined - */ - status?: FindPetsByStatusQueryParamsStatus -} + /** + * @description Status values that need to be considered for filter + * @default "available" + * @type string | undefined + */ + status?: FindPetsByStatusQueryParamsStatus; +}; -/** + /** * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] +*/ +export type FindPetsByStatus200 = Pet[]; -/** + /** * @description Invalid status value - */ -export type FindPetsByStatus400 = any +*/ +export type FindPetsByStatus400 = any; -/** + /** * @description successful operation - */ -export type FindPetsByStatusQueryResponse = Pet[] +*/ +export type FindPetsByStatusQueryResponse = Pet[]; -export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} + export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse; + QueryParams: FindPetsByStatusQueryParams; + Errors: FindPetsByStatus400; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts b/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts index 1e0e76271..b7918500b 100644 --- a/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts +++ b/examples/vue-query-v5/src/gen/models/FindPetsByTags.ts @@ -1,30 +1,30 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export type FindPetsByTagsQueryParams = { - /** - * @description Tags to filter by - * @type array | undefined - */ - tags?: string[] -} + export type FindPetsByTagsQueryParams = { + /** + * @description Tags to filter by + * @type array | undefined + */ + tags?: string[]; +}; -/** + /** * @description successful operation - */ -export type FindPetsByTags200 = Pet[] +*/ +export type FindPetsByTags200 = Pet[]; -/** + /** * @description Invalid tag value - */ -export type FindPetsByTags400 = any +*/ +export type FindPetsByTags400 = any; -/** + /** * @description successful operation - */ -export type FindPetsByTagsQueryResponse = Pet[] +*/ +export type FindPetsByTagsQueryResponse = Pet[]; -export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} + export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse; + QueryParams: FindPetsByTagsQueryParams; + Errors: FindPetsByTags400; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/GetInventory.ts b/examples/vue-query-v5/src/gen/models/GetInventory.ts index ec0602416..23861c1bf 100644 --- a/examples/vue-query-v5/src/gen/models/GetInventory.ts +++ b/examples/vue-query-v5/src/gen/models/GetInventory.ts @@ -1,17 +1,17 @@ /** * @description successful operation - */ +*/ export type GetInventory200 = { - [key: string]: number -} + [key: string]: number; +}; -/** + /** * @description successful operation - */ +*/ export type GetInventoryQueryResponse = { - [key: string]: number -} + [key: string]: number; +}; -export type GetInventoryQuery = { - Response: GetInventoryQueryResponse -} + export type GetInventoryQuery = { + Response: GetInventoryQueryResponse; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/GetOrderById.ts b/examples/vue-query-v5/src/gen/models/GetOrderById.ts index 0d25b0ee9..65103cc48 100644 --- a/examples/vue-query-v5/src/gen/models/GetOrderById.ts +++ b/examples/vue-query-v5/src/gen/models/GetOrderById.ts @@ -1,35 +1,35 @@ -import type { Order } from './Order' +import type { Order } from "./Order"; -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer int64 - */ - orderId: number -} + export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description successful operation - */ -export type GetOrderById200 = Order +*/ +export type GetOrderById200 = Order; -/** + /** * @description Invalid ID supplied - */ -export type GetOrderById400 = any +*/ +export type GetOrderById400 = any; -/** + /** * @description Order not found - */ -export type GetOrderById404 = any +*/ +export type GetOrderById404 = any; -/** + /** * @description successful operation - */ -export type GetOrderByIdQueryResponse = Order +*/ +export type GetOrderByIdQueryResponse = Order; -export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} + export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse; + PathParams: GetOrderByIdPathParams; + Errors: GetOrderById400 | GetOrderById404; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/GetPetById.ts b/examples/vue-query-v5/src/gen/models/GetPetById.ts index 437d1a7ef..9920318ac 100644 --- a/examples/vue-query-v5/src/gen/models/GetPetById.ts +++ b/examples/vue-query-v5/src/gen/models/GetPetById.ts @@ -1,35 +1,35 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer int64 - */ - petId: number -} + export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer, int64 + */ + petId: number; +}; -/** + /** * @description successful operation - */ -export type GetPetById200 = Pet +*/ +export type GetPetById200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type GetPetById400 = any +*/ +export type GetPetById400 = any; -/** + /** * @description Pet not found - */ -export type GetPetById404 = any +*/ +export type GetPetById404 = any; -/** + /** * @description successful operation - */ -export type GetPetByIdQueryResponse = Pet +*/ +export type GetPetByIdQueryResponse = Pet; -export type GetPetByIdQuery = { - Response: GetPetByIdQueryResponse - PathParams: GetPetByIdPathParams - Errors: GetPetById400 | GetPetById404 -} + export type GetPetByIdQuery = { + Response: GetPetByIdQueryResponse; + PathParams: GetPetByIdPathParams; + Errors: GetPetById400 | GetPetById404; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/GetUserByName.ts b/examples/vue-query-v5/src/gen/models/GetUserByName.ts index c2c975229..3a27c559c 100644 --- a/examples/vue-query-v5/src/gen/models/GetUserByName.ts +++ b/examples/vue-query-v5/src/gen/models/GetUserByName.ts @@ -1,35 +1,35 @@ -import type { User } from './User' +import type { User } from "./User"; -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} + export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type GetUserByName200 = User +*/ +export type GetUserByName200 = User; -/** + /** * @description Invalid username supplied - */ -export type GetUserByName400 = any +*/ +export type GetUserByName400 = any; -/** + /** * @description User not found - */ -export type GetUserByName404 = any +*/ +export type GetUserByName404 = any; -/** + /** * @description successful operation - */ -export type GetUserByNameQueryResponse = User +*/ +export type GetUserByNameQueryResponse = User; -export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} + export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse; + PathParams: GetUserByNamePathParams; + Errors: GetUserByName400 | GetUserByName404; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/LoginUser.ts b/examples/vue-query-v5/src/gen/models/LoginUser.ts index 64e5db7b6..6658166a8 100644 --- a/examples/vue-query-v5/src/gen/models/LoginUser.ts +++ b/examples/vue-query-v5/src/gen/models/LoginUser.ts @@ -1,33 +1,33 @@ export type LoginUserQueryParams = { - /** - * @description The user name for login - * @type string | undefined - */ - username?: string - /** - * @description The password for login in clear text - * @type string | undefined - */ - password?: string -} + /** + * @description The user name for login + * @type string | undefined + */ + username?: string; + /** + * @description The password for login in clear text + * @type string | undefined + */ + password?: string; +}; -/** + /** * @description successful operation - */ -export type LoginUser200 = string +*/ +export type LoginUser200 = string; -/** + /** * @description Invalid username/password supplied - */ -export type LoginUser400 = any +*/ +export type LoginUser400 = any; -/** + /** * @description successful operation - */ -export type LoginUserQueryResponse = string +*/ +export type LoginUserQueryResponse = string; -export type LoginUserQuery = { - Response: LoginUserQueryResponse - QueryParams: LoginUserQueryParams - Errors: LoginUser400 -} + export type LoginUserQuery = { + Response: LoginUserQueryResponse; + QueryParams: LoginUserQueryParams; + Errors: LoginUser400; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/LogoutUser.ts b/examples/vue-query-v5/src/gen/models/LogoutUser.ts index 521837490..a685be5fa 100644 --- a/examples/vue-query-v5/src/gen/models/LogoutUser.ts +++ b/examples/vue-query-v5/src/gen/models/LogoutUser.ts @@ -1,10 +1,10 @@ /** * @description successful operation - */ -export type LogoutUserError = any +*/ +export type LogoutUserError = any; -export type LogoutUserQueryResponse = any + export type LogoutUserQueryResponse = any; -export type LogoutUserQuery = { - Response: LogoutUserQueryResponse -} + export type LogoutUserQuery = { + Response: LogoutUserQueryResponse; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/Order.ts b/examples/vue-query-v5/src/gen/models/Order.ts index 09cb16946..c1b466aa1 100644 --- a/examples/vue-query-v5/src/gen/models/Order.ts +++ b/examples/vue-query-v5/src/gen/models/Order.ts @@ -1,33 +1,33 @@ export const orderStatus = { - placed: 'placed', - approved: 'approved', - delivered: 'delivered', -} as const -export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus] + "placed": "placed", + "approved": "approved", + "delivered": "delivered" +} as const; +export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus]; export type Order = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type integer | undefined int64 - */ - petId?: number - /** - * @type integer | undefined int32 - */ - quantity?: number - /** - * @type string | undefined date-time - */ - shipDate?: string - /** - * @description Order Status - * @type string | undefined - */ - status?: OrderStatus - /** - * @type boolean | undefined - */ - complete?: boolean -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type integer | undefined, int64 + */ + petId?: number; + /** + * @type integer | undefined, int32 + */ + quantity?: number; + /** + * @type string | undefined, date-time + */ + shipDate?: string; + /** + * @description Order Status + * @type string | undefined + */ + status?: OrderStatus; + /** + * @type boolean | undefined + */ + complete?: boolean; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/Pet.ts b/examples/vue-query-v5/src/gen/models/Pet.ts index 4eaf45ee1..325bcb152 100644 --- a/examples/vue-query-v5/src/gen/models/Pet.ts +++ b/examples/vue-query-v5/src/gen/models/Pet.ts @@ -1,33 +1,33 @@ -import type { Category } from './Category' -import type { Tag } from './Tag' +import { Category } from "./Category"; +import { Tag } from "./Tag"; -export const petStatus = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const -export type PetStatus = (typeof petStatus)[keyof typeof petStatus] + export const petStatus = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; +export type PetStatus = (typeof petStatus)[keyof typeof petStatus]; export type Pet = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string - */ - name: string - category?: Category - /** - * @type array - */ - photoUrls: string[] - /** - * @type array | undefined - */ - tags?: Tag[] - /** - * @description pet status in the store - * @type string | undefined - */ - status?: PetStatus -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string + */ + name: string; + category?: Category; + /** + * @type array + */ + photoUrls: string[]; + /** + * @type array | undefined + */ + tags?: Tag[]; + /** + * @description pet status in the store + * @type string | undefined + */ + status?: PetStatus; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/PlaceOrder.ts b/examples/vue-query-v5/src/gen/models/PlaceOrder.ts index 20aa2ff08..fd29e6525 100644 --- a/examples/vue-query-v5/src/gen/models/PlaceOrder.ts +++ b/examples/vue-query-v5/src/gen/models/PlaceOrder.ts @@ -1,24 +1,24 @@ -import type { Order } from './Order' +import type { Order } from "./Order"; -/** + /** * @description successful operation - */ -export type PlaceOrder200 = Order +*/ +export type PlaceOrder200 = Order; -/** + /** * @description Invalid input - */ -export type PlaceOrder405 = any +*/ +export type PlaceOrder405 = any; -export type PlaceOrderMutationRequest = Order + export type PlaceOrderMutationRequest = Order; -/** + /** * @description successful operation - */ -export type PlaceOrderMutationResponse = Order +*/ +export type PlaceOrderMutationResponse = Order; -export type PlaceOrderMutation = { - Response: PlaceOrderMutationResponse - Request: PlaceOrderMutationRequest - Errors: PlaceOrder405 -} + export type PlaceOrderMutation = { + Response: PlaceOrderMutationResponse; + Request: PlaceOrderMutationRequest; + Errors: PlaceOrder405; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/Tag.ts b/examples/vue-query-v5/src/gen/models/Tag.ts index 5145ac12c..3ae285108 100644 --- a/examples/vue-query-v5/src/gen/models/Tag.ts +++ b/examples/vue-query-v5/src/gen/models/Tag.ts @@ -1,10 +1,10 @@ export type Tag = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/UpdatePet.ts b/examples/vue-query-v5/src/gen/models/UpdatePet.ts index c8d59265f..d55cd8eeb 100644 --- a/examples/vue-query-v5/src/gen/models/UpdatePet.ts +++ b/examples/vue-query-v5/src/gen/models/UpdatePet.ts @@ -1,37 +1,37 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type UpdatePet200 = Pet +*/ +export type UpdatePet200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type UpdatePet400 = any +*/ +export type UpdatePet400 = any; -/** + /** * @description Pet not found - */ -export type UpdatePet404 = any +*/ +export type UpdatePet404 = any; -/** + /** * @description Validation exception - */ -export type UpdatePet405 = any +*/ +export type UpdatePet405 = any; -/** + /** * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet +*/ +export type UpdatePetMutationRequest = Pet; -/** + /** * @description Successful operation - */ -export type UpdatePetMutationResponse = Pet +*/ +export type UpdatePetMutationResponse = Pet; -export type UpdatePetMutation = { - Response: UpdatePetMutationResponse - Request: UpdatePetMutationRequest - Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 -} + export type UpdatePetMutation = { + Response: UpdatePetMutationResponse; + Request: UpdatePetMutationRequest; + Errors: UpdatePet400 | UpdatePet404 | UpdatePet405; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts b/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..77cbc4bb8 100644 --- a/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts +++ b/examples/vue-query-v5/src/gen/models/UpdatePetWithForm.ts @@ -1,34 +1,34 @@ export type UpdatePetWithFormPathParams = { - /** - * @description ID of pet that needs to be updated - * @type integer int64 - */ - petId: number -} + /** + * @description ID of pet that needs to be updated + * @type integer, int64 + */ + petId: number; +}; -export type UpdatePetWithFormQueryParams = { - /** - * @description Name of pet that needs to be updated - * @type string | undefined - */ - name?: string - /** - * @description Status of pet that needs to be updated - * @type string | undefined - */ - status?: string -} + export type UpdatePetWithFormQueryParams = { + /** + * @description Name of pet that needs to be updated + * @type string | undefined + */ + name?: string; + /** + * @description Status of pet that needs to be updated + * @type string | undefined + */ + status?: string; +}; -/** + /** * @description Invalid input - */ -export type UpdatePetWithForm405 = any +*/ +export type UpdatePetWithForm405 = any; -export type UpdatePetWithFormMutationResponse = any + export type UpdatePetWithFormMutationResponse = any; -export type UpdatePetWithFormMutation = { - Response: UpdatePetWithFormMutationResponse - PathParams: UpdatePetWithFormPathParams - QueryParams: UpdatePetWithFormQueryParams - Errors: UpdatePetWithForm405 -} + export type UpdatePetWithFormMutation = { + Response: UpdatePetWithFormMutationResponse; + PathParams: UpdatePetWithFormPathParams; + QueryParams: UpdatePetWithFormQueryParams; + Errors: UpdatePetWithForm405; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/UpdateUser.ts b/examples/vue-query-v5/src/gen/models/UpdateUser.ts index d636efeb0..9a44548d7 100644 --- a/examples/vue-query-v5/src/gen/models/UpdateUser.ts +++ b/examples/vue-query-v5/src/gen/models/UpdateUser.ts @@ -1,27 +1,27 @@ -import type { User } from './User' +import { User } from "./User"; -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} + export type UpdateUserPathParams = { + /** + * @description name that need to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type UpdateUserError = any +*/ +export type UpdateUserError = any; -/** + /** * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User +*/ +export type UpdateUserMutationRequest = User; -export type UpdateUserMutationResponse = any + export type UpdateUserMutationResponse = any; -export type UpdateUserMutation = { - Response: UpdateUserMutationResponse - Request: UpdateUserMutationRequest - PathParams: UpdateUserPathParams -} + export type UpdateUserMutation = { + Response: UpdateUserMutationResponse; + Request: UpdateUserMutationRequest; + PathParams: UpdateUserPathParams; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/UploadFile.ts b/examples/vue-query-v5/src/gen/models/UploadFile.ts index 0c0956bea..3f272bd5d 100644 --- a/examples/vue-query-v5/src/gen/models/UploadFile.ts +++ b/examples/vue-query-v5/src/gen/models/UploadFile.ts @@ -1,36 +1,36 @@ -import type { ApiResponse } from './ApiResponse' +import type { ApiResponse } from "./ApiResponse"; -export type UploadFilePathParams = { - /** - * @description ID of pet to update - * @type integer int64 - */ - petId: number -} + export type UploadFilePathParams = { + /** + * @description ID of pet to update + * @type integer, int64 + */ + petId: number; +}; -export type UploadFileQueryParams = { - /** - * @description Additional Metadata - * @type string | undefined - */ - additionalMetadata?: string -} + export type UploadFileQueryParams = { + /** + * @description Additional Metadata + * @type string | undefined + */ + additionalMetadata?: string; +}; -/** + /** * @description successful operation - */ -export type UploadFile200 = ApiResponse +*/ +export type UploadFile200 = ApiResponse; -export type UploadFileMutationRequest = string + export type UploadFileMutationRequest = string; -/** + /** * @description successful operation - */ -export type UploadFileMutationResponse = ApiResponse +*/ +export type UploadFileMutationResponse = ApiResponse; -export type UploadFileMutation = { - Response: UploadFileMutationResponse - Request: UploadFileMutationRequest - PathParams: UploadFilePathParams - QueryParams: UploadFileQueryParams -} + export type UploadFileMutation = { + Response: UploadFileMutationResponse; + Request: UploadFileMutationRequest; + PathParams: UploadFilePathParams; + QueryParams: UploadFileQueryParams; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/User.ts b/examples/vue-query-v5/src/gen/models/User.ts index fd722d07d..9e8b913d4 100644 --- a/examples/vue-query-v5/src/gen/models/User.ts +++ b/examples/vue-query-v5/src/gen/models/User.ts @@ -1,35 +1,35 @@ export type User = { - /** - * @type integer | undefined int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type string | undefined - */ - firstName?: string - /** - * @type string | undefined - */ - lastName?: string - /** - * @type string | undefined - */ - email?: string - /** - * @type string | undefined - */ - password?: string - /** - * @type string | undefined - */ - phone?: string - /** - * @description User Status - * @type integer | undefined int32 - */ - userStatus?: number -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type string | undefined + */ + firstName?: string; + /** + * @type string | undefined + */ + lastName?: string; + /** + * @type string | undefined + */ + email?: string; + /** + * @type string | undefined + */ + password?: string; + /** + * @type string | undefined + */ + phone?: string; + /** + * @description User Status + * @type integer | undefined, int32 + */ + userStatus?: number; +}; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/UserArray.ts b/examples/vue-query-v5/src/gen/models/UserArray.ts index effb23af2..21e14e46a 100644 --- a/examples/vue-query-v5/src/gen/models/UserArray.ts +++ b/examples/vue-query-v5/src/gen/models/UserArray.ts @@ -1,3 +1,3 @@ -import type { User } from './User' +import { User } from "./User"; -export type UserArray = User[] + export type UserArray = User[]; \ No newline at end of file diff --git a/examples/vue-query-v5/src/gen/models/index.ts b/examples/vue-query-v5/src/gen/models/index.ts index d3a6835ce..c6fbcf0bc 100644 --- a/examples/vue-query-v5/src/gen/models/index.ts +++ b/examples/vue-query-v5/src/gen/models/index.ts @@ -1,28 +1,28 @@ -export * from './AddPet' -export * from './Address' -export * from './ApiResponse' -export * from './Category' -export * from './CreateUser' -export * from './CreateUsersWithListInput' -export * from './Customer' -export * from './DeleteOrder' -export * from './DeletePet' -export * from './DeleteUser' -export * from './FindPetsByStatus' -export * from './FindPetsByTags' -export * from './GetInventory' -export * from './GetOrderById' -export * from './GetPetById' -export * from './GetUserByName' -export * from './LoginUser' -export * from './LogoutUser' -export * from './Order' -export * from './Pet' -export * from './PlaceOrder' -export * from './Tag' -export * from './UpdatePet' -export * from './UpdatePetWithForm' -export * from './UpdateUser' -export * from './UploadFile' -export * from './User' -export * from './UserArray' +export * from "./AddPet"; +export * from "./Address"; +export * from "./ApiResponse"; +export * from "./Category"; +export * from "./CreateUser"; +export * from "./CreateUsersWithListInput"; +export * from "./Customer"; +export * from "./DeleteOrder"; +export * from "./DeletePet"; +export * from "./DeleteUser"; +export * from "./FindPetsByStatus"; +export * from "./FindPetsByTags"; +export * from "./GetInventory"; +export * from "./GetOrderById"; +export * from "./GetPetById"; +export * from "./GetUserByName"; +export * from "./LoginUser"; +export * from "./LogoutUser"; +export * from "./Order"; +export * from "./Pet"; +export * from "./PlaceOrder"; +export * from "./Tag"; +export * from "./UpdatePet"; +export * from "./UpdatePetWithForm"; +export * from "./UpdateUser"; +export * from "./UploadFile"; +export * from "./User"; +export * from "./UserArray"; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/Address.ts b/examples/vue-query/src/gen/models/Address.ts index 6e6411f01..0dc7e4f8d 100644 --- a/examples/vue-query/src/gen/models/Address.ts +++ b/examples/vue-query/src/gen/models/Address.ts @@ -22,5 +22,8 @@ export type Address = { * @type string | undefined */ zip?: string + /** + * @type array | undefined + */ identifier?: [number, string, AddressIdentifier] } diff --git a/examples/vue-query/src/gen/models/ApiResponse.ts b/examples/vue-query/src/gen/models/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/vue-query/src/gen/models/ApiResponse.ts +++ b/examples/vue-query/src/gen/models/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/vue-query/src/gen/models/Category.ts b/examples/vue-query/src/gen/models/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/vue-query/src/gen/models/Category.ts +++ b/examples/vue-query/src/gen/models/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/vue-query/src/gen/models/Customer.ts b/examples/vue-query/src/gen/models/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/vue-query/src/gen/models/Customer.ts +++ b/examples/vue-query/src/gen/models/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/vue-query/src/gen/models/DeleteOrder.ts b/examples/vue-query/src/gen/models/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/vue-query/src/gen/models/DeleteOrder.ts +++ b/examples/vue-query/src/gen/models/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/vue-query/src/gen/models/DeletePet.ts b/examples/vue-query/src/gen/models/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/vue-query/src/gen/models/DeletePet.ts +++ b/examples/vue-query/src/gen/models/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/vue-query/src/gen/models/GetOrderById.ts b/examples/vue-query/src/gen/models/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/vue-query/src/gen/models/GetOrderById.ts +++ b/examples/vue-query/src/gen/models/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/vue-query/src/gen/models/GetPetById.ts b/examples/vue-query/src/gen/models/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/vue-query/src/gen/models/GetPetById.ts +++ b/examples/vue-query/src/gen/models/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/vue-query/src/gen/models/Order.ts b/examples/vue-query/src/gen/models/Order.ts index 09cb16946..0305ad4e4 100644 --- a/examples/vue-query/src/gen/models/Order.ts +++ b/examples/vue-query/src/gen/models/Order.ts @@ -6,19 +6,19 @@ export const orderStatus = { export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/vue-query/src/gen/models/Pet.ts b/examples/vue-query/src/gen/models/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/vue-query/src/gen/models/Pet.ts +++ b/examples/vue-query/src/gen/models/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/vue-query/src/gen/models/Tag.ts b/examples/vue-query/src/gen/models/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/vue-query/src/gen/models/Tag.ts +++ b/examples/vue-query/src/gen/models/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/vue-query/src/gen/models/UploadFile.ts b/examples/vue-query/src/gen/models/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/vue-query/src/gen/models/UploadFile.ts +++ b/examples/vue-query/src/gen/models/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/vue-query/src/gen/models/User.ts b/examples/vue-query/src/gen/models/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/vue-query/src/gen/models/User.ts +++ b/examples/vue-query/src/gen/models/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/examples/zod/src/gen/ts/AddPet.ts b/examples/zod/src/gen/ts/AddPet.ts index dfc60e285..c7cd7166c 100644 --- a/examples/zod/src/gen/ts/AddPet.ts +++ b/examples/zod/src/gen/ts/AddPet.ts @@ -11,7 +11,7 @@ export type AddPet200 = Pet */ export type AddPet405 = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/zod/src/gen/ts/AddPetRequest.ts b/examples/zod/src/gen/ts/AddPetRequest.ts index 9c76717ea..ff0086b3f 100644 --- a/examples/zod/src/gen/ts/AddPetRequest.ts +++ b/examples/zod/src/gen/ts/AddPetRequest.ts @@ -9,7 +9,7 @@ export const addPetRequestStatus = { export type AddPetRequestStatus = (typeof addPetRequestStatus)[keyof typeof addPetRequestStatus] export type AddPetRequest = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/zod/src/gen/ts/ApiResponse.ts b/examples/zod/src/gen/ts/ApiResponse.ts index 499e9e9ca..3a6dae779 100644 --- a/examples/zod/src/gen/ts/ApiResponse.ts +++ b/examples/zod/src/gen/ts/ApiResponse.ts @@ -1,6 +1,6 @@ export type ApiResponse = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/zod/src/gen/ts/Category.ts b/examples/zod/src/gen/ts/Category.ts index 24b90a71a..3b48c48f3 100644 --- a/examples/zod/src/gen/ts/Category.ts +++ b/examples/zod/src/gen/ts/Category.ts @@ -1,6 +1,6 @@ export type Category = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/zod/src/gen/ts/Customer.ts b/examples/zod/src/gen/ts/Customer.ts index 5a6d435a3..cfd611151 100644 --- a/examples/zod/src/gen/ts/Customer.ts +++ b/examples/zod/src/gen/ts/Customer.ts @@ -2,7 +2,7 @@ import type { Address } from './Address' export type Customer = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/zod/src/gen/ts/DeleteOrder.ts b/examples/zod/src/gen/ts/DeleteOrder.ts index d160f7c4e..ca0a4a26b 100644 --- a/examples/zod/src/gen/ts/DeleteOrder.ts +++ b/examples/zod/src/gen/ts/DeleteOrder.ts @@ -1,7 +1,7 @@ export type DeleteOrderPathParams = { /** * @description ID of the order that needs to be deleted - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/zod/src/gen/ts/DeletePet.ts b/examples/zod/src/gen/ts/DeletePet.ts index 6bb98c261..fc83516d0 100644 --- a/examples/zod/src/gen/ts/DeletePet.ts +++ b/examples/zod/src/gen/ts/DeletePet.ts @@ -1,7 +1,7 @@ export type DeletePetPathParams = { /** * @description Pet id to delete - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/zod/src/gen/ts/GetOrderById.ts b/examples/zod/src/gen/ts/GetOrderById.ts index 0d25b0ee9..1dc8edf30 100644 --- a/examples/zod/src/gen/ts/GetOrderById.ts +++ b/examples/zod/src/gen/ts/GetOrderById.ts @@ -3,7 +3,7 @@ import type { Order } from './Order' export type GetOrderByIdPathParams = { /** * @description ID of order that needs to be fetched - * @type integer int64 + * @type integer, int64 */ orderId: number } diff --git a/examples/zod/src/gen/ts/GetPetById.ts b/examples/zod/src/gen/ts/GetPetById.ts index 437d1a7ef..406271029 100644 --- a/examples/zod/src/gen/ts/GetPetById.ts +++ b/examples/zod/src/gen/ts/GetPetById.ts @@ -3,7 +3,7 @@ import type { Pet } from './Pet' export type GetPetByIdPathParams = { /** * @description ID of pet to return - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/zod/src/gen/ts/Order.ts b/examples/zod/src/gen/ts/Order.ts index a66d4f94b..2aa3915b1 100644 --- a/examples/zod/src/gen/ts/Order.ts +++ b/examples/zod/src/gen/ts/Order.ts @@ -11,19 +11,19 @@ export const orderHttpStatus = { export type OrderHttpStatus = (typeof orderHttpStatus)[keyof typeof orderHttpStatus] export type Order = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ petId?: number /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ quantity?: number /** - * @type string | undefined date-time + * @type string | undefined, date-time */ shipDate?: string /** diff --git a/examples/zod/src/gen/ts/Pet.ts b/examples/zod/src/gen/ts/Pet.ts index 4eaf45ee1..3152e9ac7 100644 --- a/examples/zod/src/gen/ts/Pet.ts +++ b/examples/zod/src/gen/ts/Pet.ts @@ -9,7 +9,7 @@ export const petStatus = { export type PetStatus = (typeof petStatus)[keyof typeof petStatus] export type Pet = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/zod/src/gen/ts/PetNotFound.ts b/examples/zod/src/gen/ts/PetNotFound.ts index 676a15893..adad1616d 100644 --- a/examples/zod/src/gen/ts/PetNotFound.ts +++ b/examples/zod/src/gen/ts/PetNotFound.ts @@ -1,6 +1,6 @@ export type PetNotFound = { /** - * @type integer | undefined int32 + * @type integer | undefined, int32 */ code?: number /** diff --git a/examples/zod/src/gen/ts/Tag.ts b/examples/zod/src/gen/ts/Tag.ts index 5145ac12c..d76160eae 100644 --- a/examples/zod/src/gen/ts/Tag.ts +++ b/examples/zod/src/gen/ts/Tag.ts @@ -1,6 +1,6 @@ export type Tag = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** diff --git a/examples/zod/src/gen/ts/UpdatePetWithForm.ts b/examples/zod/src/gen/ts/UpdatePetWithForm.ts index ada2c08ca..b547bc9a9 100644 --- a/examples/zod/src/gen/ts/UpdatePetWithForm.ts +++ b/examples/zod/src/gen/ts/UpdatePetWithForm.ts @@ -1,7 +1,7 @@ export type UpdatePetWithFormPathParams = { /** * @description ID of pet that needs to be updated - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/zod/src/gen/ts/UploadFile.ts b/examples/zod/src/gen/ts/UploadFile.ts index 0c0956bea..1dfb8d9d0 100644 --- a/examples/zod/src/gen/ts/UploadFile.ts +++ b/examples/zod/src/gen/ts/UploadFile.ts @@ -3,7 +3,7 @@ import type { ApiResponse } from './ApiResponse' export type UploadFilePathParams = { /** * @description ID of pet to update - * @type integer int64 + * @type integer, int64 */ petId: number } diff --git a/examples/zod/src/gen/ts/User.ts b/examples/zod/src/gen/ts/User.ts index fd722d07d..5fbab3d29 100644 --- a/examples/zod/src/gen/ts/User.ts +++ b/examples/zod/src/gen/ts/User.ts @@ -1,6 +1,6 @@ export type User = { /** - * @type integer | undefined int64 + * @type integer | undefined, int64 */ id?: number /** @@ -29,7 +29,7 @@ export type User = { phone?: string /** * @description User Status - * @type integer | undefined int32 + * @type integer | undefined, int32 */ userStatus?: number } diff --git a/packages/cli/package.json b/packages/cli/package.json index 37a89cba6..5a17151b9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -2,13 +2,7 @@ "name": "@kubb/cli", "version": "2.12.6", "description": "Generator cli", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen", - "cli" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen", "cli"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -32,13 +26,7 @@ "kubb": "bin/kubb.cjs", "bkubb": "bin/bkubb.cjs" }, - "files": [ - "src", - "dist", - "bin", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "bin", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/core/package.json b/packages/core/package.json index 49908569c..a55faef54 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,12 +2,7 @@ "name": "@kubb/core", "version": "2.12.6", "description": "Generator core", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -59,32 +54,14 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "utils": [ - "./dist/utils.d.ts" - ], - "transformers": [ - "./dist/transformers.d.ts" - ], - "logger": [ - "./dist/logger.d.ts" - ], - "fs": [ - "./dist/fs.d.ts" - ], - "mocks": [ - "./dist/mocks.d.ts" - ] + "utils": ["./dist/utils.d.ts"], + "transformers": ["./dist/transformers.d.ts"], + "logger": ["./dist/logger.d.ts"], + "fs": ["./dist/fs.d.ts"], + "mocks": ["./dist/mocks.d.ts"] } }, - "files": [ - "src", - "dist", - "*.d.ts", - "*.d.cts", - "schema.json", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "*.d.ts", "*.d.cts", "schema.json", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/kubb/package.json b/packages/kubb/package.json index abcfbeed2..9d9a1a19c 100644 --- a/packages/kubb/package.json +++ b/packages/kubb/package.json @@ -2,13 +2,7 @@ "name": "kubb", "version": "2.0.0-beta.2", "description": "OpenAPI to TypeScript, React-Query, Zod, Zodios, Faker.js, MSW and Axios.", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen", - "cli" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen", "cli"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -24,13 +18,7 @@ "bin": { "kubb": "bin/kubb.js" }, - "files": [ - "src", - "dist", - "bin", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "bin", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/parser/package.json b/packages/parser/package.json index fb1dd1ece..e9712bf23 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -2,12 +2,7 @@ "name": "@kubb/parser", "version": "2.12.6", "description": "Generator parser", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -36,17 +31,10 @@ "types": "./dist/index.d.cts", "typesVersions": { "*": { - "factory": [ - "./dist/factory.d.ts" - ] + "factory": ["./dist/factory.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/react/package.json b/packages/react/package.json index 81f00d7bc..75c65d982 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -2,12 +2,7 @@ "name": "@kubb/react", "version": "2.12.6", "description": "Generator react", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -51,22 +46,11 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "client": [ - "./dist/client.d.ts" - ], - "server": [ - "./dist/server.d.ts" - ] + "client": ["./dist/client.d.ts"], + "server": ["./dist/server.d.ts"] } }, - "files": [ - "src", - "dist", - "*.d.ts", - "*.d.cts", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "*.d.ts", "*.d.cts", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger-client/package.json b/packages/swagger-client/package.json index 2cd970242..f4896b551 100644 --- a/packages/swagger-client/package.json +++ b/packages/swagger-client/package.json @@ -2,15 +2,7 @@ "name": "@kubb/swagger-client", "version": "2.12.6", "description": "Generator swagger-client", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi", - "axios" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen", "swagger", "openapi", "axios"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -49,20 +41,10 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ] + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "client.ts", - "*.d.ts", - "*.d.cts", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "client.ts", "*.d.ts", "*.d.cts", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger-faker/package.json b/packages/swagger-faker/package.json index 77535c28d..557acea0b 100644 --- a/packages/swagger-faker/package.json +++ b/packages/swagger-faker/package.json @@ -2,17 +2,7 @@ "name": "@kubb/swagger-faker", "version": "2.12.6", "description": "Generator swagger-faker", - "keywords": [ - "faker", - "faker.js", - "mock", - "mocking", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi" - ], + "keywords": ["faker", "faker.js", "mock", "mocking", "plugins", "kubb", "codegen", "swagger", "openapi"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -41,17 +31,10 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ] + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger-msw/package.json b/packages/swagger-msw/package.json index 161a9c715..d62ed2264 100644 --- a/packages/swagger-msw/package.json +++ b/packages/swagger-msw/package.json @@ -2,18 +2,7 @@ "name": "@kubb/swagger-msw", "version": "2.12.6", "description": "Generator swagger-msw", - "keywords": [ - "faker", - "faker.js", - "msw", - "mock", - "mocking", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi" - ], + "keywords": ["faker", "faker.js", "msw", "mock", "mocking", "plugins", "kubb", "codegen", "swagger", "openapi"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -42,17 +31,10 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ] + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger-swr/package.json b/packages/swagger-swr/package.json index 43a22ac43..f39d54935 100644 --- a/packages/swagger-swr/package.json +++ b/packages/swagger-swr/package.json @@ -2,19 +2,7 @@ "name": "@kubb/swagger-swr", "version": "2.12.6", "description": "Generator swagger-swr", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi", - "swr", - "vercel", - "nextjs", - "next", - "axios" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen", "swagger", "openapi", "swr", "vercel", "nextjs", "next", "axios"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -43,17 +31,10 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ] + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "rimraf ./dist", diff --git a/packages/swagger-tanstack-query/CHANGELOG.md b/packages/swagger-tanstack-query/CHANGELOG.md index 9b05759f7..c896d8fcc 100644 --- a/packages/swagger-tanstack-query/CHANGELOG.md +++ b/packages/swagger-tanstack-query/CHANGELOG.md @@ -4,7 +4,7 @@ ### Patch Changes -- [`eb0c507`](https://github.com/kubb-project/kubb/commit/eb0c507380143f4e2634ed844580c3337cef33fd) Thanks [@stijnvanhulle](https://github.com/stijnvanhulle)! - Typescript noUnusedLocals with infinite queries +- [`eb0c507`](https://github.com/kubb-project/kubb/commit/eb0c507380143f4e2634ed844580c3337cef33fd) Thanks [@stijnvanhulle](https://github.com/stijnvanhulle)! - TypeScript noUnusedLocals with infinite queries - Updated dependencies [[`eb0c507`](https://github.com/kubb-project/kubb/commit/eb0c507380143f4e2634ed844580c3337cef33fd), [`e32b6bd`](https://github.com/kubb-project/kubb/commit/e32b6bda3d676b099dd28c6ab380cf22abb44895), [`e32b6bd`](https://github.com/kubb-project/kubb/commit/e32b6bda3d676b099dd28c6ab380cf22abb44895)]: - @kubb/swagger-zod@2.12.6 diff --git a/packages/swagger-tanstack-query/package.json b/packages/swagger-tanstack-query/package.json index d7970e11a..052f36fad 100644 --- a/packages/swagger-tanstack-query/package.json +++ b/packages/swagger-tanstack-query/package.json @@ -2,18 +2,7 @@ "name": "@kubb/swagger-tanstack-query", "version": "2.12.6", "description": "Generator swagger-tanstack-query", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi", - "tanstack", - "react-query", - "@tanstack", - "axios" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen", "swagger", "openapi", "tanstack", "react-query", "@tanstack", "axios"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -42,17 +31,10 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ] + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger-ts/package.json b/packages/swagger-ts/package.json index f487491e8..d7858fe75 100644 --- a/packages/swagger-ts/package.json +++ b/packages/swagger-ts/package.json @@ -2,14 +2,7 @@ "name": "@kubb/swagger-ts", "version": "2.12.6", "description": "Generator swagger-ts", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen", "swagger", "openapi"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -41,20 +34,11 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ], - "oas": [ - "./dist/oas.d.ts" - ] + "components": ["./dist/components.d.ts"], + "oas": ["./dist/oas.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap b/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap index 7a572a19d..dd376e2b9 100644 --- a/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap +++ b/packages/swagger-ts/src/__snapshots__/SchemaGenerator.test.tsx.snap @@ -4,7 +4,7 @@ exports[`SchemaGenerator discriminator > Cat.type defined as const 1`] = ` [ "export type Cat = { /** - * @type string uuid + * @type string, uuid */ id: string; type: "Cat"; @@ -21,7 +21,7 @@ exports[`SchemaGenerator discriminator > Dog.type defined as const 1`] = ` [ "export type Dog = { /** - * @type string uuid + * @type string, uuid */ id: string; /** @@ -278,7 +278,7 @@ exports[`TypeGenerator type assertions > generates Plain_File types correctly 1` exports[`TypeGenerator type assertions > generates Time type correctly 1`] = ` [ - "export type Plain_time = number; + "export type Plain_time = string; ", ] `; @@ -294,7 +294,7 @@ exports[`TypeGenerator type assertions > generates file property with \`File\` t [ "export type Body_upload_file_api_assets_post = { /** - * @type string binary + * @type string, binary */ file: string; }; @@ -306,7 +306,7 @@ exports[`TypeScript SchemaGenerator petStore > generate type for Pet with option [ "export type Pet = { /** - * @type integer int64 + * @type integer, int64 */ id: number; /** @@ -326,7 +326,7 @@ exports[`TypeScript SchemaGenerator petStore > generate type for Pet with option [ "export type Pet = { /** - * @type integer int64 + * @type integer, int64 */ id: number; /** @@ -346,7 +346,7 @@ exports[`TypeScript SchemaGenerator petStore > generate type for Pet with option [ "export type Pet = { /** - * @type integer int64 + * @type integer, int64 */ id: number; /** @@ -366,7 +366,7 @@ exports[`TypeScript SchemaGenerator petStore > generate type for Pets 1`] = ` [ "export type Pets = { /** - * @type integer int64 + * @type integer, int64 */ id: number; /** diff --git a/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap b/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap index 2dffbcd8e..6c2edb0fa 100644 --- a/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap +++ b/packages/swagger-ts/src/__snapshots__/typeParser.test.ts.snap @@ -134,7 +134,7 @@ exports[`parseTypeMeta > 'objectEnum' 1`] = ` "{ /** * @description Your address - * @type string string + * @type string, string */ version: Enum; } diff --git a/packages/swagger-ts/src/typeParser.ts b/packages/swagger-ts/src/typeParser.ts index eca5dc8b3..1cc077740 100644 --- a/packages/swagger-ts/src/typeParser.ts +++ b/packages/swagger-ts/src/typeParser.ts @@ -217,7 +217,7 @@ export function parseTypeMeta(parent: Schema | undefined, current: Schema, optio defaultSchema ? `@default ${defaultSchema.args}` : undefined, exampleSchema ? `@example ${exampleSchema.args}` : undefined, schemaSchema?.args?.type || schemaSchema?.args?.format - ? `@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'} ${schemaSchema?.args?.format || ''}` + ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ') : undefined, ].filter(Boolean), }) diff --git a/packages/swagger-zod/package.json b/packages/swagger-zod/package.json index ba67a49e8..afcc6d53f 100644 --- a/packages/swagger-zod/package.json +++ b/packages/swagger-zod/package.json @@ -2,14 +2,7 @@ "name": "@kubb/swagger-zod", "version": "2.12.6", "description": "Generator swagger-zod", - "keywords": [ - "zod", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi" - ], + "keywords": ["zod", "plugins", "kubb", "codegen", "swagger", "openapi"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -38,17 +31,10 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ] + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap b/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap index 127d7da74..eb2caae1b 100644 --- a/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap +++ b/packages/swagger-zod/src/__snapshots__/zodParser.test.ts.snap @@ -22,7 +22,7 @@ exports[`parseZodMeta > 'catchall' 1`] = `"z.object({}).catchall(z.lazy(() => Pe exports[`parseZodMeta > 'date' 1`] = `"z.date()"`; -exports[`parseZodMeta > 'datetime' 1`] = `".datetime()"`; +exports[`parseZodMeta > 'datetime' 1`] = `"z.string().datetime()"`; exports[`parseZodMeta > 'default' 1`] = `".default()"`; @@ -58,7 +58,7 @@ exports[`parseZodMeta > 'ref' 1`] = `"z.lazy(() => Pet).schema"`; exports[`parseZodMeta > 'string' 1`] = `"z.string()"`; -exports[`parseZodMeta > 'stringOffset' 1`] = `".datetime({ offset: true })"`; +exports[`parseZodMeta > 'stringOffset' 1`] = `"z.string().datetime({ offset: true })"`; exports[`parseZodMeta > 'tuple' 1`] = `"z.tuple([])"`; diff --git a/packages/swagger-zod/src/zodParser.tsx b/packages/swagger-zod/src/zodParser.tsx index 9207f9fcd..189a26bd9 100644 --- a/packages/swagger-zod/src/zodParser.tsx +++ b/packages/swagger-zod/src/zodParser.tsx @@ -30,7 +30,7 @@ export const zodKeywordMapper = { enum: (items: string[] = []) => `z.enum([${items?.join(', ')}])`, union: (items: string[] = []) => `z.union([${items?.join(', ')}])`, const: (value?: string | number) => `z.literal(${value ?? ''})`, - datetime: (offset = false) => (offset ? `.datetime({ offset: ${offset} })` : '.datetime()'), + datetime: (offset = false) => (offset ? `z.string().datetime({ offset: ${offset} })` : 'z.string().datetime()'), date: () => 'z.date()', uuid: () => '.uuid()', url: () => '.url()', diff --git a/packages/swagger-zodios/package.json b/packages/swagger-zodios/package.json index fd2aac980..d0ee52248 100644 --- a/packages/swagger-zodios/package.json +++ b/packages/swagger-zodios/package.json @@ -2,15 +2,7 @@ "name": "@kubb/swagger-zodios", "version": "2.12.6", "description": "Generator swagger-zodios", - "keywords": [ - "zod", - "zodios", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi" - ], + "keywords": ["zod", "zodios", "plugins", "kubb", "codegen", "swagger", "openapi"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -39,17 +31,10 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "components": [ - "./dist/components.d.ts" - ] + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger/package.json b/packages/swagger/package.json index ca137abec..54916718c 100644 --- a/packages/swagger/package.json +++ b/packages/swagger/package.json @@ -2,14 +2,7 @@ "name": "@kubb/swagger", "version": "2.12.6", "description": "Generator swagger", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen", - "swagger", - "openapi" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen", "swagger", "openapi"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -53,26 +46,13 @@ "types": "./dist/index.d.ts", "typesVersions": { "*": { - "utils": [ - "./dist/utils.d.ts" - ], - "hooks": [ - "./dist/hooks.d.ts" - ], - "oas": [ - "./dist/oas.d.ts" - ], - "components": [ - "./dist/components.d.ts" - ] + "utils": ["./dist/utils.d.ts"], + "hooks": ["./dist/hooks.d.ts"], + "oas": ["./dist/oas.d.ts"], + "components": ["./dist/components.d.ts"] } }, - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/swagger/src/SchemaGenerator.ts b/packages/swagger/src/SchemaGenerator.ts index 41edb393e..d9fbc6732 100644 --- a/packages/swagger/src/SchemaGenerator.ts +++ b/packages/swagger/src/SchemaGenerator.ts @@ -202,15 +202,16 @@ export abstract class SchemaGenerator< #getOptions(_schema: SchemaObject | undefined, baseName: string | undefined): Partial { const { override = [] } = this.context - return ( - override.find(({ pattern, type }) => { + return { + ...this.options, + ...(override.find(({ pattern, type }) => { if (baseName && type === 'schemaName') { return !!baseName.match(pattern) } return false - })?.options || this.options - ) + })?.options || {}), + } } #getUnknownReturn(schema: SchemaObject | undefined, baseName: string | undefined) { @@ -592,28 +593,6 @@ export abstract class SchemaGenerator< ] } - if ('items' in schema) { - const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined - const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined - const items = this.buildSchemas(schema.items as SchemaObject, baseName) - - return [ - { - keyword: schemaKeywords.array, - args: { - items, - min, - max, - }, - }, - ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max), - ] - } - - if (schema.properties || schema.additionalProperties) { - return [...this.#parseProperties(schema, baseName), ...baseItems] - } - if (version === '3.1' && 'const' in schema) { // const keyword takes precendence over the actual type. if (schema['const']) { @@ -652,15 +631,18 @@ export abstract class SchemaGenerator< if (options.dateType) { if (options.dateType === 'date') { baseItems.unshift({ keyword: schemaKeywords.date }) - break + + return baseItems } if (options.dateType === 'stringOffset') { baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } }) - break + return baseItems } baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } }) + + return baseItems } break case 'uuid': @@ -687,6 +669,29 @@ export abstract class SchemaGenerator< } } + // type based logic + if ('items' in schema) { + const min = schema.minimum ?? schema.minLength ?? schema.minItems ?? undefined + const max = schema.maximum ?? schema.maxLength ?? schema.maxItems ?? undefined + const items = this.buildSchemas(schema.items as SchemaObject, baseName) + + return [ + { + keyword: schemaKeywords.array, + args: { + items, + min, + max, + }, + }, + ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max), + ] + } + + if (schema.properties || schema.additionalProperties) { + return [...this.#parseProperties(schema, baseName), ...baseItems] + } + if (schema.type) { if (Array.isArray(schema.type)) { // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0 @@ -704,10 +709,8 @@ export abstract class SchemaGenerator< ].filter(Boolean) } - // string, boolean, null, number - if (schema.type in schemaKeywords) { - return [{ keyword: schema.type }, ...baseItems] - } + // 'string' | 'number' | 'integer' | 'boolean' + return [{ keyword: schema.type }, ...baseItems] } return [{ keyword: unknownReturn }] diff --git a/packages/types/package.json b/packages/types/package.json index 9b68d04a2..a8c7ebc80 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -2,12 +2,7 @@ "name": "@kubb/types", "version": "2.12.6", "description": "Generator types", - "keywords": [ - "typescript", - "plugins", - "kubb", - "codegen" - ], + "keywords": ["typescript", "plugins", "kubb", "codegen"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -29,14 +24,7 @@ "main": "dist/index.cjs", "module": "dist/index.js", "types": "./dist/index.d.ts", - "files": [ - "src", - "dist", - "*.d.ts", - "*.d.cts", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "*.d.ts", "*.d.cts", "!/**/**.test.**", "!/**/__tests__/**"], "scripts": { "build": "tsup", "clean": "npx rimraf ./dist", diff --git a/packages/unplugin/package.json b/packages/unplugin/package.json index aaf232ac3..0631bba28 100644 --- a/packages/unplugin/package.json +++ b/packages/unplugin/package.json @@ -2,20 +2,7 @@ "name": "unplugin-kubb", "version": "0.1.30", "description": "Unplugin for Kubb", - "keywords": [ - "unplugin", - "vite", - "webpack", - "rollup", - "transform", - "astro", - "kubb", - "swagger", - "OpenAPI", - "rspack", - "nuxt", - "esbuild" - ], + "keywords": ["unplugin", "vite", "webpack", "rollup", "transform", "astro", "kubb", "swagger", "OpenAPI", "rspack", "nuxt", "esbuild"], "repository": { "type": "git", "url": "git://github.com/kubb-project/kubb.git", @@ -77,18 +64,10 @@ "main": "dist/index.cjs", "module": "dist/index.js", "types": "dist/index.d.ts", - "files": [ - "src", - "dist", - "!/**/**.test.**", - "!/**/__tests__/**" - ], + "files": ["src", "dist", "!/**/**.test.**", "!/**/__tests__/**"], "typesVersions": { "*": { - "*": [ - "./dist/*", - "./*" - ] + "*": ["./dist/*", "./*"] } }, "scripts": { From 88799278cc1c2cebe756736880bb797f1b6d5ece Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Sat, 13 Apr 2024 17:05:18 +0200 Subject: [PATCH 3/4] chore: use of bun for e2e --- .github/workflows/e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 35cb35f4d..fca95d411 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -92,5 +92,5 @@ jobs: env: NODE_OPTIONS: "--max_old_space_size=4096" run: | - ${{ matrix.installer }} generate + ${{ matrix.installer }} generate --bun From 1cb2f41adaaa5d8a072af231cabecc204b0e8803 Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Sat, 13 Apr 2024 17:12:45 +0200 Subject: [PATCH 4/4] chore: filer regex out of enum type --- packages/swagger/src/SchemaGenerator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/swagger/src/SchemaGenerator.ts b/packages/swagger/src/SchemaGenerator.ts index d9fbc6732..d3fb19a3d 100644 --- a/packages/swagger/src/SchemaGenerator.ts +++ b/packages/swagger/src/SchemaGenerator.ts @@ -522,7 +522,9 @@ export abstract class SchemaGenerator< })), }, }, - ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max), + ...baseItems.filter( + (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches, + ), ] }) @@ -551,7 +553,7 @@ export abstract class SchemaGenerator< }), }, }, - ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max), + ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches), ] } @@ -573,7 +575,7 @@ export abstract class SchemaGenerator< })), }, }, - ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max), + ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches), ] }