Closed jb-paul closed 5 years ago
Hi @jb-paul ,
I found the same issue on the latest version. I guess you can try to use yang-js@0.18.19, which should be the version that works right.
Cheers.
On the newer yang-js
releases, I've relaxed the property schema handling to allow assignment of non-schema defined properties. It would accept those new properties but would not enforce schema on them. And such properties only exist in the runtime space, they would not be serialized when converted toJSON
.
I can change it back to disallow non-schema defined property assignments but I figured the relaxed allowance didn't hurt anything. Let me know your thoughts.
Please let me know if the new behavior is undesirable. I'll update tutorial accordingly.
I found something strange while following below tutorial. https://github.com/corenova/yang-js/blob/master/TUTORIAL.md#schema-extension
The tutorial says that the last line of following code will return undefined, but it return 'hello' when I run this code. Is there anything I missed?
var schema = Yang.parse('container foo { leaf a; }'); var model = schema.eval({ foo: { a: 'bar' } }); // try assigning a new arbitrary property model.foo.b = 'hello'; console.log(model.foo.b); // returns: undefined (since not part of schema) --> returns 'hello'