Set default for bits type 78/105878/24
authortobias.pobocik <tobias.pobocik@pantheon.tech>
Wed, 10 May 2023 11:20:44 +0000 (13:20 +0200)
committerIvan Hrasko <ivan.hrasko@pantheon.tech>
Fri, 4 Aug 2023 13:51:24 +0000 (15:51 +0200)
Set default bits type leaf value when such value is present.

Dues to constrained nature of bits type its difficult to set
example values.

JIRA: NETCONF-999
Change-Id: I4edccce7699a3b6ce69965779a8651cb3252c564
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/DefinitionGenerator.java

index 3e8fac454a93833386a52c76225977acf41d6a37..b0677f87876aefeff796510bb05b3d28bb9f5aac 100644 (file)
@@ -749,6 +749,7 @@ public class DefinitionGenerator {
         }
         property.set(ENUM_KEY, enumNames);
         property.put(DEFAULT_KEY, enumNames.iterator().next() + " " + enumNames.get(enumNames.size() - 1));
+        bitsType.getDefaultValue().ifPresent(v -> setDefaultValue(property, (String) v));
         return STRING_TYPE;
     }