diff --git a/packages/core/package.json b/packages/core/package.json index 1e1478947..5ecb6c9aa 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -45,8 +45,7 @@ "lodash.uniqby": "^4.7.0", "lodash.uniqwith": "^4.5.0", "micromatch": "^4.0.5", - "openapi-types": "^12.1.3", - "openapi3-ts": "^3.2.0", + "openapi3-ts": "4.2.1", "swagger2openapi": "^7.0.8" } } diff --git a/packages/core/src/generators/component-definition.ts b/packages/core/src/generators/component-definition.ts index a90f56ad6..66e6c6b1f 100644 --- a/packages/core/src/generators/component-definition.ts +++ b/packages/core/src/generators/component-definition.ts @@ -4,7 +4,7 @@ import { ReferenceObject, RequestBodyObject, ResponseObject, -} from 'openapi3-ts'; +} from 'openapi3-ts/oas30'; import { getResReqTypes } from '../getters'; import { ContextSpecs, GeneratorSchema } from '../types'; import { jsDoc, pascal, sanitize } from '../utils'; diff --git a/packages/core/src/generators/interface.ts b/packages/core/src/generators/interface.ts index 85ce17c9d..3a9c5fdde 100644 --- a/packages/core/src/generators/interface.ts +++ b/packages/core/src/generators/interface.ts @@ -1,4 +1,4 @@ -import { SchemaObject } from 'openapi3-ts'; +import { SchemaObject } from 'openapi3-ts/oas30'; import { generalJSTypesWithArray } from '../constants'; import { getScalar } from '../getters'; import { ContextSpecs } from '../types'; diff --git a/packages/core/src/generators/parameter-definition.ts b/packages/core/src/generators/parameter-definition.ts index 90163797f..6bb8edba4 100644 --- a/packages/core/src/generators/parameter-definition.ts +++ b/packages/core/src/generators/parameter-definition.ts @@ -1,4 +1,4 @@ -import { ComponentsObject, ParameterObject } from 'openapi3-ts'; +import { ComponentsObject, ParameterObject } from 'openapi3-ts/oas30'; import { resolveObject, resolveRef } from '../resolvers'; import { ContextSpecs, GeneratorSchema } from '../types'; import { jsDoc, pascal, sanitize } from '../utils'; diff --git a/packages/core/src/generators/schema-definition.ts b/packages/core/src/generators/schema-definition.ts index ab6d77512..1a4384ebf 100644 --- a/packages/core/src/generators/schema-definition.ts +++ b/packages/core/src/generators/schema-definition.ts @@ -1,5 +1,5 @@ import isEmpty from 'lodash.isempty'; -import { SchemaObject, SchemasObject } from 'openapi3-ts'; +import { SchemaObject, SchemasObject } from 'openapi3-ts/oas30'; import { getEnum, resolveDiscriminators } from '../getters'; import { resolveRef, resolveValue } from '../resolvers'; import { ContextSpecs, GeneratorSchema } from '../types'; diff --git a/packages/core/src/generators/verbs-options.ts b/packages/core/src/generators/verbs-options.ts index 0c4bc24ef..320009b72 100644 --- a/packages/core/src/generators/verbs-options.ts +++ b/packages/core/src/generators/verbs-options.ts @@ -4,7 +4,7 @@ import { ParameterObject, PathItemObject, ReferenceObject, -} from 'openapi3-ts'; +} from 'openapi3-ts/oas30'; import { getBody, getOperationId, diff --git a/packages/core/src/getters/array.ts b/packages/core/src/getters/array.ts index aba571e90..e7d576d2f 100644 --- a/packages/core/src/getters/array.ts +++ b/packages/core/src/getters/array.ts @@ -1,4 +1,5 @@ -import { SchemaObject } from 'openapi3-ts'; +import { SchemaObject } from 'openapi3-ts/oas30'; +import { SchemaObject as SchemaObject31 } from 'openapi3-ts/oas31'; import { ContextSpecs, ScalarValue } from '../types'; import { resolveObject } from '../resolvers/object'; import { resolveExampleRefs } from '../resolvers'; @@ -18,6 +19,13 @@ export const getArray = ({ context: ContextSpecs; }): ScalarValue => { if (schema.items) { + const schema31 = schema as SchemaObject31; + if (schema31.prefixItems) { + // TODO: https://github.com/anymaniax/orval/issues/890 + throw new Error( + `prefixItems is not supported (name=${name}, schema=${JSON.stringify(schema)})`, + ); + } const resolvedObject = resolveObject({ schema: schema.items, propName: name + context.output.override.components.schemas.itemSuffix, @@ -39,6 +47,8 @@ export const getArray = ({ examples: resolveExampleRefs(schema.examples, context), }; } else { - throw new Error('All arrays must have an `items` key define'); + throw new Error( + `All arrays must have an \`items\` key defined (name=${name}, schema=${JSON.stringify(schema)})`, + ); } }; diff --git a/packages/core/src/getters/body.ts b/packages/core/src/getters/body.ts index b25a77267..5a199f754 100644 --- a/packages/core/src/getters/body.ts +++ b/packages/core/src/getters/body.ts @@ -1,4 +1,4 @@ -import { ReferenceObject, RequestBodyObject } from 'openapi3-ts'; +import { ReferenceObject, RequestBodyObject } from 'openapi3-ts/oas30'; import { generalJSTypesWithArray } from '../constants'; import { ContextSpecs, GetterBody, OverrideOutputContentType } from '../types'; import { camel, sanitize } from '../utils'; diff --git a/packages/core/src/getters/combine.ts b/packages/core/src/getters/combine.ts index 414e74270..2a9dd03f2 100644 --- a/packages/core/src/getters/combine.ts +++ b/packages/core/src/getters/combine.ts @@ -1,5 +1,5 @@ import omit from 'lodash.omit'; -import { SchemaObject } from 'openapi3-ts'; +import { SchemaObject } from 'openapi3-ts/oas30'; import { resolveExampleRefs, resolveObject } from '../resolvers'; import { ContextSpecs, diff --git a/packages/core/src/getters/discriminators.ts b/packages/core/src/getters/discriminators.ts index 4360c10da..deb9a0abf 100644 --- a/packages/core/src/getters/discriminators.ts +++ b/packages/core/src/getters/discriminators.ts @@ -1,4 +1,4 @@ -import { SchemasObject } from 'openapi3-ts'; +import { SchemasObject } from 'openapi3-ts/oas30'; import { ContextSpecs } from '../types'; import { getRefInfo } from './ref'; import { pascal } from '../utils'; diff --git a/packages/core/src/getters/object.ts b/packages/core/src/getters/object.ts index bb4b9bdce..36b213867 100644 --- a/packages/core/src/getters/object.ts +++ b/packages/core/src/getters/object.ts @@ -1,4 +1,4 @@ -import { ReferenceObject, SchemaObject } from 'openapi3-ts'; +import { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30'; import { resolveExampleRefs, resolveObject, resolveValue } from '../resolvers'; import { ContextSpecs, ScalarValue, SchemaType } from '../types'; import { isBoolean, isReference, jsDoc, pascal } from '../utils'; diff --git a/packages/core/src/getters/operation.test.ts b/packages/core/src/getters/operation.test.ts index 181c8884a..4b701b014 100644 --- a/packages/core/src/getters/operation.test.ts +++ b/packages/core/src/getters/operation.test.ts @@ -1,4 +1,4 @@ -import { OperationObject } from 'openapi3-ts'; +import { OperationObject } from 'openapi3-ts/oas30'; import { getOperationId } from './operation'; describe('getOperationId getter', () => { diff --git a/packages/core/src/getters/operation.ts b/packages/core/src/getters/operation.ts index 9b0450c88..32402543f 100644 --- a/packages/core/src/getters/operation.ts +++ b/packages/core/src/getters/operation.ts @@ -1,4 +1,4 @@ -import { OperationObject } from 'openapi3-ts'; +import { OperationObject } from 'openapi3-ts/oas30'; import { Verbs } from '../types'; import { pascal, sanitize } from '../utils'; diff --git a/packages/core/src/getters/parameters.ts b/packages/core/src/getters/parameters.ts index dd0a6cbb2..253350314 100644 --- a/packages/core/src/getters/parameters.ts +++ b/packages/core/src/getters/parameters.ts @@ -1,4 +1,4 @@ -import { ParameterObject, ReferenceObject } from 'openapi3-ts'; +import { ParameterObject, ReferenceObject } from 'openapi3-ts/oas30'; import { resolveRef } from '../resolvers/ref'; import { ContextSpecs, GetterParameters } from '../types'; import { isReference } from '../utils'; diff --git a/packages/core/src/getters/query-params.test.ts b/packages/core/src/getters/query-params.test.ts index a8ee44f72..2277c9f02 100644 --- a/packages/core/src/getters/query-params.test.ts +++ b/packages/core/src/getters/query-params.test.ts @@ -1,4 +1,4 @@ -import { ParameterObject } from 'openapi3-ts'; +import { ParameterObject } from 'openapi3-ts/oas30'; import { describe, expect, it } from 'vitest'; import { ContextSpecs } from '../types'; import { getQueryParams } from './query-params'; diff --git a/packages/core/src/getters/query-params.ts b/packages/core/src/getters/query-params.ts index a0ceefa38..446a9f870 100644 --- a/packages/core/src/getters/query-params.ts +++ b/packages/core/src/getters/query-params.ts @@ -1,4 +1,4 @@ -import { ContentObject, SchemaObject } from 'openapi3-ts'; +import { ContentObject, SchemaObject } from 'openapi3-ts/oas30'; import { resolveValue } from '../resolvers'; import { ContextSpecs, diff --git a/packages/core/src/getters/ref.ts b/packages/core/src/getters/ref.ts index 96d674d6f..36a93c060 100644 --- a/packages/core/src/getters/ref.ts +++ b/packages/core/src/getters/ref.ts @@ -1,5 +1,5 @@ import get from 'lodash.get'; -import { ReferenceObject } from 'openapi3-ts'; +import { ReferenceObject } from 'openapi3-ts/oas30'; import { ContextSpecs } from '../types'; import { getFileInfo, isUrl, pascal, upath } from '../utils'; diff --git a/packages/core/src/getters/res-req-types.ts b/packages/core/src/getters/res-req-types.ts index f70f5353e..e5c7c9ac9 100644 --- a/packages/core/src/getters/res-req-types.ts +++ b/packages/core/src/getters/res-req-types.ts @@ -6,7 +6,7 @@ import { RequestBodyObject, ResponseObject, SchemaObject, -} from 'openapi3-ts'; +} from 'openapi3-ts/oas30'; import { resolveObject } from '../resolvers/object'; import { resolveExampleRefs, resolveRef } from '../resolvers/ref'; import { ContextSpecs, ResReqTypesValue } from '../types'; diff --git a/packages/core/src/getters/response.ts b/packages/core/src/getters/response.ts index 5b90ff9de..43bfc10b5 100644 --- a/packages/core/src/getters/response.ts +++ b/packages/core/src/getters/response.ts @@ -1,4 +1,4 @@ -import { ResponsesObject } from 'openapi3-ts'; +import { ResponsesObject } from 'openapi3-ts/oas30'; import { ContextSpecs, GetterResponse, diff --git a/packages/core/src/getters/scalar.ts b/packages/core/src/getters/scalar.ts index a82b49ed9..8fbdbdd74 100644 --- a/packages/core/src/getters/scalar.ts +++ b/packages/core/src/getters/scalar.ts @@ -1,4 +1,4 @@ -import { SchemaObject } from 'openapi3-ts'; +import { SchemaObject } from 'openapi3-ts/oas30'; import { ContextSpecs, ScalarValue } from '../types'; import { escape, isString } from '../utils'; import { getArray } from './array'; diff --git a/packages/core/src/resolvers/object.ts b/packages/core/src/resolvers/object.ts index a75e9bbcb..c82fb2aed 100644 --- a/packages/core/src/resolvers/object.ts +++ b/packages/core/src/resolvers/object.ts @@ -1,4 +1,4 @@ -import { ReferenceObject, SchemaObject } from 'openapi3-ts'; +import { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30'; import { getEnum } from '../getters/enum'; import { ContextSpecs, ResolverValue } from '../types'; import { jsDoc } from '../utils'; diff --git a/packages/core/src/resolvers/ref.ts b/packages/core/src/resolvers/ref.ts index e35857ffc..9f4d976c2 100644 --- a/packages/core/src/resolvers/ref.ts +++ b/packages/core/src/resolvers/ref.ts @@ -6,7 +6,7 @@ import { RequestBodyObject, ResponseObject, SchemaObject, -} from 'openapi3-ts'; +} from 'openapi3-ts/oas30'; import { RefInfo, getRefInfo } from '../getters/ref'; import { ContextSpecs, GeneratorImport } from '../types'; import { isReference } from '../utils'; diff --git a/packages/core/src/resolvers/value.ts b/packages/core/src/resolvers/value.ts index 81fc993d1..1a45e1afd 100644 --- a/packages/core/src/resolvers/value.ts +++ b/packages/core/src/resolvers/value.ts @@ -1,4 +1,4 @@ -import { ReferenceObject, SchemaObject } from 'openapi3-ts'; +import { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30'; import { getScalar } from '../getters'; import { ContextSpecs, ResolverValue, SchemaType } from '../types'; import { isReference } from '../utils'; diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index dfff569ff..a71c7bf66 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -8,7 +8,7 @@ import { RequestBodyObject, ResponsesObject, SchemaObject, -} from 'openapi3-ts'; +} from 'openapi3-ts/oas30'; // @ts-ignore // FIXME when running `yarn test` getting `orval:test: ../core/src/types.ts(12,34): error TS7016: Could not find a declaration file for module 'swagger2openapi'. '/home/maxim/orval/node_modules/swagger2openapi/index.js' implicitly has an 'any' type.` import swagger2openapi from 'swagger2openapi'; import type { allLocales } from '@faker-js/faker'; diff --git a/packages/core/src/utils/assertion.ts b/packages/core/src/utils/assertion.ts index 7b0feb7bc..61f390e7d 100644 --- a/packages/core/src/utils/assertion.ts +++ b/packages/core/src/utils/assertion.ts @@ -1,4 +1,4 @@ -import { ReferenceObject, SchemaObject } from 'openapi3-ts'; +import { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30'; import { SchemaType, Verbs } from '../types'; import { extname } from './path'; diff --git a/packages/core/src/utils/logger.ts b/packages/core/src/utils/logger.ts index 429c94a33..20b0e7545 100644 --- a/packages/core/src/utils/logger.ts +++ b/packages/core/src/utils/logger.ts @@ -22,7 +22,7 @@ export const logError = (err: unknown, tag?: string) => chalk.red( [ '🛑', - tag ? `${tag} - ` : undefined, + tag ? `${tag} -` : undefined, err instanceof Error ? err.stack : err, ] .filter(Boolean) diff --git a/packages/core/src/utils/open-api-converter.ts b/packages/core/src/utils/open-api-converter.ts index 4af82f289..f1646d3dd 100644 --- a/packages/core/src/utils/open-api-converter.ts +++ b/packages/core/src/utils/open-api-converter.ts @@ -1,5 +1,5 @@ import chalk from 'chalk'; -import { OpenAPIObject } from 'openapi3-ts'; +import { OpenAPIObject } from 'openapi3-ts/oas30'; import swagger2openapi from 'swagger2openapi'; import { log } from './logger'; diff --git a/packages/core/src/utils/validator.ts b/packages/core/src/utils/validator.ts index 706281615..b83c3ce57 100644 --- a/packages/core/src/utils/validator.ts +++ b/packages/core/src/utils/validator.ts @@ -1,4 +1,4 @@ -import { OpenAPIObject } from 'openapi3-ts'; +import { OpenAPIObject } from 'openapi3-ts/oas30'; import { ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, diff --git a/packages/mock/package.json b/packages/mock/package.json index 72f8742e9..d7441e847 100644 --- a/packages/mock/package.json +++ b/packages/mock/package.json @@ -16,6 +16,6 @@ "@orval/core": "6.23.0", "lodash.get": "^4.4.2", "lodash.omit": "^4.5.0", - "openapi3-ts": "^3.0.0" + "openapi3-ts": "^4.2.1" } } diff --git a/packages/mock/src/faker/constants.ts b/packages/mock/src/faker/constants.ts index b8e61f1a4..5b8a29284 100644 --- a/packages/mock/src/faker/constants.ts +++ b/packages/mock/src/faker/constants.ts @@ -1,4 +1,4 @@ -import { SchemaObject } from 'openapi3-ts'; +import { SchemaObject } from 'openapi3-ts/oas30'; export const DEFAULT_FORMAT_MOCK: Record< Required['format'], diff --git a/packages/mock/src/faker/getters/object.ts b/packages/mock/src/faker/getters/object.ts index d5f58317b..608d12db1 100644 --- a/packages/mock/src/faker/getters/object.ts +++ b/packages/mock/src/faker/getters/object.ts @@ -7,7 +7,7 @@ import { isReference, MockOptions, } from '@orval/core'; -import { ReferenceObject, SchemaObject } from 'openapi3-ts'; +import { ReferenceObject, SchemaObject } from 'openapi3-ts/oas30'; import { resolveMockValue } from '../resolvers/value'; import { MockDefinition, MockSchemaObject } from '../../types'; import { combineSchemasMock } from './combine'; diff --git a/packages/mock/src/faker/resolvers/value.ts b/packages/mock/src/faker/resolvers/value.ts index 812bf37a0..235a28761 100644 --- a/packages/mock/src/faker/resolvers/value.ts +++ b/packages/mock/src/faker/resolvers/value.ts @@ -6,7 +6,7 @@ import { MockOptions, } from '@orval/core'; import get from 'lodash.get'; -import { SchemaObject } from 'openapi3-ts'; +import { SchemaObject } from 'openapi3-ts/oas30'; import { getMockScalar } from '../getters/scalar'; import { MockDefinition, MockSchemaObject } from '../../types'; diff --git a/packages/mock/src/msw/mocks.ts b/packages/mock/src/msw/mocks.ts index 25206ab7e..96e2b469f 100644 --- a/packages/mock/src/msw/mocks.ts +++ b/packages/mock/src/msw/mocks.ts @@ -10,7 +10,7 @@ import { resolveRef, stringify, } from '@orval/core'; -import { OpenAPIObject, SchemaObject } from 'openapi3-ts'; +import { OpenAPIObject, SchemaObject } from 'openapi3-ts/oas30'; import { getMockScalar } from '../faker/getters'; const getMockPropertiesWithoutFunc = (properties: any, spec: OpenAPIObject) => diff --git a/packages/mock/src/types.ts b/packages/mock/src/types.ts index 58db4d31b..6573430cf 100644 --- a/packages/mock/src/types.ts +++ b/packages/mock/src/types.ts @@ -1,5 +1,5 @@ import { GeneratorImport } from '@orval/core'; -import { SchemaObject } from 'openapi3-ts'; +import { SchemaObject } from 'openapi3-ts/oas30'; export interface MockDefinition { value: string; diff --git a/packages/orval/package.json b/packages/orval/package.json index 89e61de9f..cb550572a 100644 --- a/packages/orval/package.json +++ b/packages/orval/package.json @@ -70,8 +70,7 @@ "find-up": "5.0.0", "fs-extra": "^11.2.0", "lodash.uniq": "^4.5.0", - "openapi-types": "^12.1.3", - "openapi3-ts": "^3.2.0", + "openapi3-ts": "4.2.1", "string-argv": "^0.3.2", "tsconfck": "^2.0.1" } diff --git a/packages/orval/src/api.ts b/packages/orval/src/api.ts index 2fd333a6f..22978ff5e 100644 --- a/packages/orval/src/api.ts +++ b/packages/orval/src/api.ts @@ -13,7 +13,7 @@ import { resolveRef, } from '@orval/core'; import { generateMockImports } from '@orval/mock'; -import { PathItemObject } from 'openapi3-ts'; +import { PathItemObject } from 'openapi3-ts/oas30'; import { generateClientFooter, generateClientHeader, diff --git a/packages/orval/src/import-open-api.ts b/packages/orval/src/import-open-api.ts index 536019eab..16d3d2736 100644 --- a/packages/orval/src/import-open-api.ts +++ b/packages/orval/src/import-open-api.ts @@ -18,7 +18,7 @@ import { WriteSpecsBuilder, } from '@orval/core'; import omit from 'lodash.omit'; -import { OpenAPIObject, SchemasObject } from 'openapi3-ts'; +import { OpenAPIObject, SchemasObject } from 'openapi3-ts/oas30'; import { getApiBuilder } from './api'; export const importOpenApi = async ({ diff --git a/packages/orval/src/utils/options.ts b/packages/orval/src/utils/options.ts index c37cfacfb..ee7eb8815 100644 --- a/packages/orval/src/utils/options.ts +++ b/packages/orval/src/utils/options.ts @@ -29,7 +29,7 @@ import { } from '@orval/core'; import { DEFAULT_MOCK_OPTIONS } from '@orval/mock'; import chalk from 'chalk'; -import { InfoObject } from 'openapi3-ts'; +import { InfoObject } from 'openapi3-ts/oas30'; import pkg from '../../package.json'; import { githubResolver } from './github'; import { loadPackageJson } from './package-json'; diff --git a/packages/orval/src/write-specs.ts b/packages/orval/src/write-specs.ts index 82679f8d2..2c41f272a 100644 --- a/packages/orval/src/write-specs.ts +++ b/packages/orval/src/write-specs.ts @@ -19,7 +19,7 @@ import chalk from 'chalk'; import execa from 'execa'; import fs from 'fs-extra'; import uniq from 'lodash.uniq'; -import { InfoObject } from 'openapi3-ts'; +import { InfoObject } from 'openapi3-ts/oas30'; import { executeHook } from './utils'; const getHeader = ( diff --git a/packages/zod/src/index.ts b/packages/zod/src/index.ts index 3456a5139..ffb112053 100644 --- a/packages/zod/src/index.ts +++ b/packages/zod/src/index.ts @@ -5,7 +5,7 @@ import { RequestBodyObject, ResponseObject, SchemaObject, -} from 'openapi3-ts'; +} from 'openapi3-ts/oas30'; import { camel, ClientBuilder, diff --git a/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts b/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts index b47ec2af0..a1f728426 100644 --- a/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts +++ b/samples/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts @@ -12,6 +12,7 @@ import { useSuspenseQuery, } from '@tanstack/react-query'; import type { + InfiniteData, MutationFunction, QueryFunction, QueryKey, @@ -86,16 +87,24 @@ export const getListPetsQueryKey = ( }; export const getListPetsInfiniteQueryOptions = < - TData = Awaited>, + TData = InfiniteData< + Awaited>, + ListPetsParams['limit'] + >, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: UseInfiniteQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + Awaited>, + QueryKey, + ListPetsParams['limit'] + > >; }, ) => { @@ -104,9 +113,12 @@ export const getListPetsInfiniteQueryOptions = < const queryKey = queryOptions?.queryKey ?? getListPetsQueryKey(params, version); - const queryFn: QueryFunction>> = ({ - pageParam, - }) => listPets({ ...params, limit: pageParam || params?.['limit'] }, version); + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ListPetsParams['limit'] + > = ({ pageParam }) => + listPets({ ...params, limit: pageParam || params?.['limit'] }, version); return { queryKey, @@ -116,7 +128,10 @@ export const getListPetsInfiniteQueryOptions = < } as UseInfiniteQueryOptions< Awaited>, TError, - TData + TData, + Awaited>, + QueryKey, + ListPetsParams['limit'] > & { queryKey: QueryKey }; }; @@ -129,16 +144,24 @@ export type ListPetsInfiniteQueryError = ErrorType; * @summary List all pets */ export const useListPetsInfinite = < - TData = Awaited>, + TData = InfiniteData< + Awaited>, + ListPetsParams['limit'] + >, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: UseInfiniteQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseInfiniteQueryOptions< + Awaited>, + TError, + TData, + Awaited>, + QueryKey, + ListPetsParams['limit'] + > >; }, ): UseInfiniteQueryResult & { queryKey: QueryKey } => { @@ -165,10 +188,8 @@ export const getListPetsQueryOptions = < params?: ListPetsParams, version: number = 1, options?: { - query?: UseQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseQueryOptions>, TError, TData> >; }, ) => { @@ -205,10 +226,8 @@ export const useListPets = < params?: ListPetsParams, version: number = 1, options?: { - query?: UseQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseQueryOptions>, TError, TData> >; }, ): UseQueryResult & { queryKey: QueryKey } => { @@ -230,10 +249,12 @@ export const getListPetsSuspenseQueryOptions = < params?: ListPetsParams, version: number = 1, options?: { - query?: UseSuspenseQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseSuspenseQueryOptions< + Awaited>, + TError, + TData + > >; }, ) => { @@ -272,10 +293,12 @@ export const useListPetsSuspense = < params?: ListPetsParams, version: number = 1, options?: { - query?: UseSuspenseQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseSuspenseQueryOptions< + Awaited>, + TError, + TData + > >; }, ): UseSuspenseQueryResult & { queryKey: QueryKey } => { @@ -296,16 +319,24 @@ export const useListPetsSuspense = < }; export const getListPetsSuspenseInfiniteQueryOptions = < - TData = Awaited>, + TData = InfiniteData< + Awaited>, + ListPetsParams['limit'] + >, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: UseSuspenseInfiniteQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseSuspenseInfiniteQueryOptions< + Awaited>, + TError, + TData, + Awaited>, + QueryKey, + ListPetsParams['limit'] + > >; }, ) => { @@ -314,9 +345,12 @@ export const getListPetsSuspenseInfiniteQueryOptions = < const queryKey = queryOptions?.queryKey ?? getListPetsQueryKey(params, version); - const queryFn: QueryFunction>> = ({ - pageParam, - }) => listPets({ ...params, limit: pageParam || params?.['limit'] }, version); + const queryFn: QueryFunction< + Awaited>, + QueryKey, + ListPetsParams['limit'] + > = ({ pageParam }) => + listPets({ ...params, limit: pageParam || params?.['limit'] }, version); return { queryKey, @@ -326,7 +360,10 @@ export const getListPetsSuspenseInfiniteQueryOptions = < } as UseSuspenseInfiniteQueryOptions< Awaited>, TError, - TData + TData, + Awaited>, + QueryKey, + ListPetsParams['limit'] > & { queryKey: QueryKey }; }; @@ -339,16 +376,24 @@ export type ListPetsSuspenseInfiniteQueryError = ErrorType; * @summary List all pets */ export const useListPetsSuspenseInfinite = < - TData = Awaited>, + TData = InfiniteData< + Awaited>, + ListPetsParams['limit'] + >, TError = ErrorType, >( params?: ListPetsParams, version: number = 1, options?: { - query?: UseSuspenseInfiniteQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseSuspenseInfiniteQueryOptions< + Awaited>, + TError, + TData, + Awaited>, + QueryKey, + ListPetsParams['limit'] + > >; }, ): UseSuspenseInfiniteQueryResult & { queryKey: QueryKey } => { @@ -530,10 +575,8 @@ export const getShowPetByIdQueryOptions = < petId: string, version: number = 1, options?: { - query?: UseQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseQueryOptions>, TError, TData> >; }, ) => { @@ -573,10 +616,8 @@ export const useShowPetById = < petId: string, version: number = 1, options?: { - query?: UseQueryOptions< - Awaited>, - TError, - TData + query?: Partial< + UseQueryOptions>, TError, TData> >; }, ): UseQueryResult & { queryKey: QueryKey } => { diff --git a/types/swagger2openapi.d.ts b/types/swagger2openapi.d.ts index d624fbfd4..8ddef1c5e 100644 --- a/types/swagger2openapi.d.ts +++ b/types/swagger2openapi.d.ts @@ -1,5 +1,5 @@ declare module 'swagger2openapi' { - import { OpenAPIObject } from 'openapi3-ts'; + import { OpenAPIObject } from 'openapi3-ts/oas30'; interface ConverObjCallbackData { openapi: OpenAPIObject; } diff --git a/yarn.lock b/yarn.lock index 6a9069aa3..aead41e99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4810,17 +4810,12 @@ open@9.1.0: is-inside-container "^1.0.0" is-wsl "^2.2.0" -openapi-types@^12.1.3: - version "12.1.3" - resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3" - integrity sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw== - -openapi3-ts@^3.0.0, openapi3-ts@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/openapi3-ts/-/openapi3-ts-3.2.0.tgz#7e30d33c480e938e67e809ab16f419bc9beae3f8" - integrity sha512-/ykNWRV5Qs0Nwq7Pc0nJ78fgILvOT/60OxEmB3v7yQ8a8Bwcm43D4diaYazG/KBn6czA+52XYy931WFLMCUeSg== +openapi3-ts@4.2.1, openapi3-ts@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/openapi3-ts/-/openapi3-ts-4.2.1.tgz#ee9b3cdeec12c21b8dcc9cd66d83f1e126dfecca" + integrity sha512-KL1mKwkZii5ce+tb24KCUmQHyWB/oanG5fzUY35UB+wenWJv4Kr/IWBntpn5R8ODiJcxx13ZDophcpHnLGeIOw== dependencies: - yaml "^2.2.1" + yaml "^2.3.4" optionator@^0.8.1: version "0.8.3" @@ -6859,7 +6854,7 @@ yaml@^1.10.0: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaml@^2.1.1, yaml@^2.2.1, yaml@^2.2.2, yaml@^2.3.4: +yaml@^2.1.1, yaml@^2.2.2, yaml@^2.3.4: version "2.3.4" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==