corenova / yang-js

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

Enable evaluated Model data source to be re-evaluated #27

Closed sekur closed 8 years ago

sekur commented 8 years ago

Currently, when Yang.eval is used on a given JS object instance, it internally modifies/changes the source data object tree, which enforces Yang expression schema directly inside the provided object.

When that same source data object is used again with Yang.eval, it will cause validation error for any auto-computed read-only state data since it will return the computed value when it should not be configurable from the schema perspective.

We will need to detect for such case at the entry point to the Yang.eval routine and unlink values for such data object nodes.

sekur commented 8 years ago

The fix entailed making a clone of the source data object tree during Yang.eval so that subsequent use of that source data object tree does not break Yang.eval.