corenova / yang-js

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

yang extension field compilation error #118

Closed jcourington closed 4 years ago

jcourington commented 4 years ago

This compiles with other yang compilers. It seems that the parser doesn't set extension-name equal to config_lock and then throws an error during the compilation because it expects/needs the name.

sample model

module cl { prefix "cl";

extension config_locked { description "cannot be changed"; }

container default_config { cl:config_locked; ... } }

ExpressionError: [cl:config_locked] must contain argument 'extension-name' for expression 'cl:config_locked' at Function.Element.error (node_modules/yang-js/lib/element.js:60:15) at Function.Expression.error (node_modules/yang-js/lib/expression.js:191:40) at Function.Expression.compile (node_modules/yang-js/lib/expression.js:90:20) at node_modules/yang-js/lib/expression.js:98:18 at Array.forEach () at Function.Expression.compile (node_modules/yang-js/lib/expression.js:97:18) at node_modules/yang-js/lib/expression.js:98:18 at Array.forEach () at Function.Expression.compile (node_modules/yang-js/lib/expression.js:97:18) at Function.resolve (node_modules/yang-js/lib/lang/extensions.js:1654:56)

sekur commented 4 years ago

Thanks for reporting this issue. Looks like it implicitly expects that the extension will always have an argument to the statement although spec does not require the argument to extensions.

I’ll take a look and fix.

sekur commented 4 years ago

published in 0.5.22