You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
With this commit, there is one issue caused which is blocking us to use default exported functions in APIs
To Reproduce
Use any version > 4.13.2 - This bug got introduced in version 4.13.4
Create one HTTP API function, export it as default function, set it as operationId and set its path in x-eov-operation-handler
Try to invoke that API
Actual behavior
It gives error Route.get() requires a callback function but got a [object Object]
Stacktrace :
Route.get() requires a callback function but got a [object Object]\n at Route. [as get] (/Users/keshashah/work/api-framework/node_modules/express/lib/router/route.js:211:15)\n at Function.proto. [as get] (/Users/keshashah/work/api-framework/node_modules/express/lib/router/index.js:521:19)\n at OpenApiValidator.installOperationHandlers (/Users/keshashah/work/api-framework/node_modules/express-openapi-validator/src/openapi.validator.ts:314:37)\n at /Users/keshashah/work/api-framework/node_modules/express-openapi-validator/src/openapi.validator.ts:215:30\n at processTicksAndRejections (internal/process/task_queues.js:95:5)","timestamp":"2023-05-18T06:02:49.057Z","type":"app-log"}
Expected behavior
It should return JSON or any expected response.
here if tmpModules[modulePath][oId] does not exist then it should first check handler from tmpModules[modulePath].default[oId] if that does not exist then only return tmpModules[modulePath].default
Is there any specific reason for this? or should I create a PR for this.
Currently all our function with exports.default with operationId are not working with this upgrade.
The text was updated successfully, but these errors were encountered:
Describe the bug
With this commit, there is one issue caused which is blocking us to use default exported functions in APIs
To Reproduce
operationId
and set its path inx-eov-operation-handler
Actual behavior
It gives error
Route.get() requires a callback function but got a [object Object]
Stacktrace :
Expected behavior
It should return JSON or any expected response.
Examples and context
This bug got created because
express-openapi-validator/src/resolvers.ts
Line 38 in 01950b7
here if
tmpModules[modulePath][oId]
does not exist then it should first check handler fromtmpModules[modulePath].default[oId]
if that does not exist then only returntmpModules[modulePath].default
Is there any specific reason for this? or should I create a PR for this.
Currently all our function with
exports.default
with operationId are not working with this upgrade.The text was updated successfully, but these errors were encountered: