Fix YangTemplate key statement generation 74/68074/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 29 Jan 2018 14:39:16 +0000 (15:39 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 8 Feb 2018 21:36:36 +0000 (21:36 +0000)
key statement should be terminated by a semicolon and it should be
emitted only if the key definition is really present.

Change-Id: I499b697be586d5cf92149a14a8ca763ba2272816
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d816769c0b68a69653478b724d46dc04cfb4eb0c)

binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/YangTemplate.xtend

index 692da569b952ea27a9246142e9766b1d13dc3e6f..88af7561d2467578af8f1e85a2ee1688b2ee185f 100644 (file)
@@ -658,8 +658,9 @@ class YangTemplate {
 
         '''
             list «listSchemaNode.getQName.localName» {
-                key «FOR listKey : listSchemaNode.keyDefinition SEPARATOR " "»"«listKey.localName»"
-                «ENDFOR»
+                «IF !listSchemaNode.keyDefinition.empty»
+                    key «FOR listKey : listSchemaNode.keyDefinition SEPARATOR " "»"«listKey.localName»"«ENDFOR»;
+                «ENDIF»
                 «IF !listSchemaNode.childNodes.nullOrEmpty»
                     «writeDataSchemaNodes(listSchemaNode.childNodes)»
                 «ENDIF»