Closed quantang closed 5 years ago
Ah yes, I’ve internally changed feature binding capability in yang-js and haven’t carried it over to yang-express yet. Good to hear you guys are exploring the full suite of related modules! On Thu, Oct 11, 2018 at 3:24 PM Quan Tang notifications@github.com wrote:
Tried the lastest yang-js, it is awesome. However, the yang-express cannot work anymore, which fails to enable a feature. I guess it would be a bug in the latest yang-js, so I open the issue here.
Here is the error message:
2018-10-12 11:21:38+1300: Yang Express failed to start: PropertyError: [/yang-express] unable to enable unknown feature 'restjson' at Model.Property.error (/home/quant/Projects/vistamanager/node_modules/yang-js/lib/property.js:387:13) at Model.enable (/home/quant/Projects/vistamanager/node_modules/yang-js/lib/model.js:117:20) at Object.proto.(anonymous function) [as enable] (/home/quant/Projects/vistamanager/node_modules/delegates/index.js:40:31) at Object.run (/home/quant/Projects/vistamanager/node_modules/yang-express/lib/yang-express.js:35:14) at Method.do (/home/quant/Projects/vistamanager/node_modules/yang-js/lib/method.js:79:30) at YangService.startServer (/home/quant/Projects/vistamanager/dist/src_server/yang/yangService.ts:51:16) at YangService.
(/home/quant/Projects/vistamanager/dist/src_server/yang/yangConfig.ts:23:33) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/corenova/yang-js/issues/75, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6KbPOQ6nU9IDZ_aqYAe8aFPWBqvY9Eks5uj8UKgaJpZM4XYeRO .
-- Peter Lee Chief Executive Officer Corenova Technologies, Inc. +1-310-400-6450 linkedin.com/in/peter-k-lee
Hi @saintkepha
I am trying to upgrade the yang-express to make it work with the latest change on yang-js. However, I got confused about the 'feature' related changes.
My understanding is, 1) we removed the 'enable' function and 'instance', which used to play as an emitter. 2) we removed the construct function of 'feature', which was related to binding. I see you changed it into 'transform' and commented it out.
For the 1), I guess I can update it with 'root' element, which can provide emit and once function. For the 2), I found the bind function on 'feature' never be called even if I removed the comment, I am not sure how I can trigger the handler logic for a feature.
Please feel free to tell me what would be the right approach in your mind.
Cheers, Quan
The new "feature" methodology is to treat it as a bindable object. It can be a function or an object with functions. Instead of enabling or disabling, we bind it as needed to denote availability of a given feature.
In the case of yang-express, we would bind every feature into the yang-express module and then inside the rpc run binding function, use the feature based on the features enabled as part of the rpc input arguments.
I'll take a stab at this tomorrow.
Working on porting yang-express to ES6. Should have it ready in a couple of days.
Latest yang-express (after 0.6) is compatible with latest yang-js.
Tried the lastest yang-js, it is awesome. However, the yang-express cannot work anymore, which fails to enable a feature. I guess it would be a bug in the latest yang-js, so I open the issue here.
Here is the error message: