-
Notifications
You must be signed in to change notification settings - Fork 30
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
Singletons are not singletons in Typescript #1244
Comments
cc. @EricWittmann |
Thanks for bringing this up. It's most likely caused because the bundled application actually has two copies of the abstractions, and yes that's a pain. Hard to investigate for people new to kiota and/or to JavaScript. As part of making the clients truly portable, we're planning to build bundle packages which would do two things:
|
Haven't realized! Why?
Do you mean attaching the |
If you run
No I meant basically moving the code that's in the client now to register the providers to this new adapter's constructor. And change it a little bit so it'd:
I'm not sure I follow the question? |
In Apicurio Registry we are attempting to use the client SDK generated for Typescript ( link ).
More specifically, we are following the consolidated pattern of:
Although we started running into issues:
After much research and debugging we found out that
ParseNodeFactoryRegistry.defaultInstance
doesn't always refer to the same object, and, depending on: "from which module are you invoking it" you get a different instance of it ( there are multiple resources in SO that refer to this e.g. ).Workaround
Running
kiota generate --serializer none --deserializer none
and registering manually the serializers and deserializers in the end module, i.e.:Solution?
This bug is hard to discover and track down, and it easily compromises the "getting started" experience.
There are a few options on how to solve it, but I'm happy to listen to a proposal from someone more expert than me in TS.
The text was updated successfully, but these errors were encountered: