From 115ce4c6bf8d0ab123ce2a372a608db6f2d2573c Mon Sep 17 00:00:00 2001 From: David Dobryakov <32088636+kantegory@users.noreply.github.com> Date: Sun, 16 Mar 2025 01:53:22 +0300 Subject: [PATCH] Change order of function calls in generateSpec.ts Fix bug for tsx runtime according to my comment on Issue: 114 (#issuecomment-2727038388) --- src/generateSpec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/generateSpec.ts b/src/generateSpec.ts index e74f9b9..df21549 100644 --- a/src/generateSpec.ts +++ b/src/generateSpec.ts @@ -363,6 +363,9 @@ function getParamSchema( ): oa.SchemaObject | oa.ReferenceObject { const { explicitType, index, object, method } = param + if (explicitType) { + return { $ref: '#/components/schemas/' + explicitType.name } + } const type: (() => unknown) | unknown = Reflect.getMetadata( 'design:paramtypes', object, @@ -374,9 +377,6 @@ function getParamSchema( : { type: 'object' as const } return { items, type: 'array' } } - if (explicitType) { - return { $ref: '#/components/schemas/' + explicitType.name } - } if (typeof type === 'function') { if ( type.prototype === String.prototype ||