-
Notifications
You must be signed in to change notification settings - Fork 57
TS-78 NetworkHttp now uses NetworkRoutes - Generated open api lib #342
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
Conversation
Removed open api generated code. Added new generated lib dependency. Updated typescript compiler to fix a lib problem after a "npm install"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would want to discuss that one as it is:
-
- adding complexity that we removed 3 months ago (nem2-library).
-
- removes compatibility for browser builds (because yet another library must be made browser ready)
-
- is not addressing what it should address (“change network routes to use network type”)
—
-
The sub-library principle has been intensively discussed over the last two years, in fact nem2-library was our “generated code lib” but this is only making things much more complicated to maintain and doesn’t make sense if it is client dependent like the one introduced “node-client” openapi package. That one would be one more package that needs a browser build. (and makes it complicated to track and maintain nem2-sdk builds)
-
Browser/clients builds of the sdk are using polyfills for react, vuejs, etc. for the libraries that are node-dependent. This is an important knowledge that cannot be changed for now or that would make all clients incompatible again. With the newly introduced node-dependent openapi package, this will be more one more package for which to track more than one build.
-
Please rename the PR to what it actually does: Change the SDK to use a sub-library for handling all Api generated classes.
On another note, it was pointed out by the catapult-rest team that the While Note that |
Thanks for the comment. i) What was the library removed 3 months ago? This library is just an NPM package of the generated ts/js files from using swagger/open API cli. ii) How are these generated files made "browser ready"? are they manually modified? iii) Open API spec was changed for this, now the possible values are enum values, no free text. In order to complete the task, I needed to regenerate the code. I am not happy with pushing the generated code. So I included the technical improvement in this task. Many more open API changes are in the pipeline, having the nem2-open-api-generator will give us generated clients for free when we are working for example in another SDK like the java. The nem2-open-api-generator is generating libs for f2 based on the now split open API spec. This will be true if we need to generate clients for other languages like c#, python, etc. I have changed the PR title.
Note from rest: If the text is actually free text, the open API needs to be changed back to string and we would need to use another way of retrieving the network type. I would like to keep a one to one mapping between the repositories and routes. Network Repository should talk to the Network Route, Node Repository should be the one talking to the Node Route. NodeRepository should we the one returning the network type, Network Repository should return the name if it's free text. (This applies to Java too) |
Interesting @dgarcia360 thanks for pointing out ; @rg911 did the Network sdk repository implement this change :
That would keep the current structure and make /network good to retrieve the network identifier (which is still not the |
@fboucquez on point 3) it is not correct:
This is where /network reads the |
@fboucquez adding to point 2) Currently our client applications use the single NPM library that is available but for react-native for example, a polyfill is provided for http replacements like :
Now with what was introduced in
One note about this is that you have to name the sdk for the browser build .. Discussions can be held about this but the fact that client integrations don't each need to polyfill would be helpful, so the proposition would be to implement the same for the SDK, but extending the following line: https://github.com/nemfoundation/nem2-qr-library/blob/master/webpack.config.js#L46 to use pre-defined polyfills. That can always be changed by integrators of the SDK, by changing the My concern with re-introducing multiple packages from which to track several parts of the SDK is that the -- Introducing a This is definitely an issue with SDKs that has been attacked on Java but I am unsure whether it makes sense to define multiple packages for different http implementations. Ultimately, the http implementation should be pluggable and should not require any kind of dependency changes. |
…cript into TS-78-NetworkRoutes
Added NetworkInfo with the name and description.
…typescript-javascript into TS-78-NetworkRoutes
I've rolled back the network/node endpoint change. NetworkHttp uses the node route to get the network type. I've added NetworkInfo endpoint so the user can read the name and description from rest. |
Hi @evias, was your team able to try the new library? @dgarcia360 and I rolled back the enum to free text and we are using the node routes to get the network type. This pr should we merged for f2. The open api code should be handled by adding the library. Npm package for f2 is https://www.npmjs.com/package/nem2-sdk-openapi-typescript-node-client |
Removed open api generated code. Added new generated lib dependency.
Updated typescript compiler to fix a lib problem after a "npm install"
This PR uses the brand new open api client generator
https://github.com/NEMStudios/nem2-open-api-generator
and the generated library
https://www.npmjs.com/package/nem2-sdk-openapi-typescript-node-client