When creating multiple keys to a list and then serialize to a file, the key names should be enclosed in quotes for statement to be syntactically correct.
Here is result from serialization:
list a11 {
key first-name last-name state mocy-ref;
}
Pyang complains on above: unterminated statement definition for keyword "key"
Expectation is:
list a11 {
key "first-name last-name state mocy-ref";
}
(Or single quotes should be fine too.)
The keys are created programatically using the following snippet of code:
var Key key = substatementsOfType(Key)?.head
if (key === null) {
key = YangFactory.eINSTANCE.createKey();
substatements.add(0, key)
}
for (Leaf keyLeaf : validKeyLeafs) {
if (key.references?.filter[node == keyLeaf].nullOrEmpty) {
val KeyReference keyRef = YangFactory.eINSTANCE.createKeyReference();
keyRef.setNode(keyLeaf);
key.getReferences().add(keyRef);
} else {
LOGGER.warn(keyLeaf.name + " is key of " + it.name + " already, skip add key")
}
}
Hello,
When creating multiple keys to a list and then serialize to a file, the key names should be enclosed in quotes for statement to be syntactically correct.
Here is result from serialization:
Pyang complains on above: unterminated statement definition for keyword "key"
Expectation is:
(Or single quotes should be fine too.)
The keys are created programatically using the following snippet of code:
Thanks, Andreas