corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

leafref does not support 'require-instance' statement #70

Closed quantang closed 6 years ago

quantang commented 6 years ago

Hi,

I found that yang-js cannot handle the {'require-instance': false} in leafref type, which should not throw an error even if it fails to find a matching instance based on the path.

I can try to propose a fix later if you don't mind. :P

sekur commented 6 years ago

Hey @quantang - there was a prior issue #65 which was addressed with a commit recently. It's in the master branch but I haven't published a new version of yang-js that captures the fix yet. See if you can reproduce it with a latest git pull of yang-js.

quantang commented 6 years ago

Hi @saintkepha - I saw your change on #65 which was addressing the 'require-instance' on 'instance-identifier', instead of the 'leafref' type. So they are different and I can repro it in the master branch.

Cheers.

sekur commented 6 years ago

Ah, you're right. Sorry I should've read your original post more carefully. Yes, I'd like to see your proposed fix, I think something similar to #65 should serve this case.

quantang commented 6 years ago

Yes, I take your code as an example, as I am new to CoffeeScript. Any feedback is welcome.

sekur commented 6 years ago

Thanks for adding a test case alongside the fix. That really helps!

quantang commented 6 years ago

It is my pleasure. :)