Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back V3 asynchronous API, or provide a trully synchronous API #852

Open
leandrogoe opened this issue Jun 6, 2023 · 0 comments
Open

Comments

@leandrogoe
Copy link

leandrogoe commented Jun 6, 2023

Is your feature request related to a problem? Please describe.
I was really excited to find this package and tried it in a few projects. We wanted to use it as a tool that would run as part of our unit tests, ensuring that all covered paths were compliant with open api specs. Unfortunately, after a while, I realized the asynchronous nature of the middleware load, which makes the test runs completely unreliable as some tests may run before the middleware has finished initializing.

Describe the solution you'd like
I feel that currently, we give the package users the impression that everything is synchronous when in fact it is not. This design is misleading and can lead to very hard-to-debug issues. I think we should either go back to the old v3 api, or provider a truly synchronous API that loads everything upfront.

By the way, I cannot use v3 because of other issues, that were fixed on latest versions, so that is not an option for us.

Describe alternatives you've considered
Either bring back V3 API or make the spec load REALLY synchronous.

Additional context
I was also facing some strange issues during jest tests, which may be tied to the way the specs are load. I still can not fully track them, but I know they are related to this package:

oundingcipherhealthcom-business_layer-1  | Debugger listening on ws://0.0.0.0:9233/255262af-f65c-4dac-a876-9a57d9331cd9
roundingcipherhealthcom-business_layer-1  | For help, see: https://nodejs.org/en/docs/inspector
roundingcipherhealthcom-business_layer-1  | PASS test/services/scriptCompletionCalculator.test.ts
roundingcipherhealthcom-business_layer-1  | TypeError: Cannot read properties of undefined (reading 'enter')
roundingcipherhealthcom-business_layer-1  |     at AsyncHook.before (node:domain:97:20)
roundingcipherhealthcom-business_layer-1  |     at emitHook (node:internal/async_hooks:235:38)
roundingcipherhealthcom-business_layer-1  |     at emitBeforeScript (node:internal/async_hooks:512:5)
roundingcipherhealthcom-business_layer-1  |     at promiseBeforeHook (node:internal/async_hooks:341:3)
roundingcipherhealthcom-business_layer-1  | TypeError: Cannot read properties of undefined (reading 'enter')
roundingcipherhealthcom-business_layer-1  |     at AsyncHook.before (node:domain:97:20)
roundingcipherhealthcom-business_layer-1  |     at emitHook (node:internal/async_hooks:235:38)
roundingcipherhealthcom-business_layer-1  |     at emitBeforeScript (node:internal/async_hooks:512:5)
roundingcipherhealthcom-business_layer-1  |     at promiseBeforeHook (node:internal/async_hooks:341:3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant