JSON serialiser issue
Change-Id: Ib61a3ef54e548debee129f86aefe88f23349ae6c
diff --git a/serializers/json/src/main/java/org/onosproject/yang/serializers/json/EncoderUtils.java b/serializers/json/src/main/java/org/onosproject/yang/serializers/json/EncoderUtils.java
index d69fed2..f285f5f 100644
--- a/serializers/json/src/main/java/org/onosproject/yang/serializers/json/EncoderUtils.java
+++ b/serializers/json/src/main/java/org/onosproject/yang/serializers/json/EncoderUtils.java
@@ -161,6 +161,7 @@
case UNKNOWN_TYPE:
case LAST_INSTANCE:
case NOT_MULTI_INSTANCE_NODE:
+ case SINGLE_INSTANCE_IN_MULTI_NODE:
/*
* If type of previous child is unknown or last instance,
* that means the current child is the first sibling. If
diff --git a/serializers/json/src/test/resources/demo1.yang b/serializers/json/src/test/resources/demo1.yang
index e3e3fa6..edf17eb 100644
--- a/serializers/json/src/test/resources/demo1.yang
+++ b/serializers/json/src/test/resources/demo1.yang
@@ -24,24 +24,37 @@
leaf name {
type string;
description "name of logistics-supervisor";
+ }
+ leaf departmentId {
+ type string;
+ description "name of department";
+ }
}
- leaf departmentId {
- type string;
- description "name of department";
- }
- }
-
- container Purchasing-supervisor {
- leaf purchasing-specialist {
- type string;
- description "name of the purchasing-specialist person";
+ list General-supervisor {
+ key "name";
+ leaf name {
+ type string;
+ }
}
- leaf-list support {
- type string;
- description "name of the support person";
+ list Supervisor {
+ key "name";
+ leaf name {
+ type string;
+ }
}
+
+ container Purchasing-supervisor {
+ leaf purchasing-specialist {
+ type string;
+ description "name of the purchasing-specialist person";
+ }
+
+ leaf-list support {
+ type string;
+ description "name of the support person";
+ }
}
leaf-list Warehouse-supervisor {
diff --git a/serializers/json/src/test/resources/test.json b/serializers/json/src/test/resources/test.json
index 0124173..47f726f 100644
--- a/serializers/json/src/test/resources/test.json
+++ b/serializers/json/src/test/resources/test.json
@@ -21,6 +21,22 @@
"departmentId": "string6"
}
],
+ "General-supervisor": [
+ {
+ "name": "string5"
+ },
+ {
+ "name": "string6"
+ },
+ {
+ "name": "string7"
+ }
+ ],
+ "Supervisor" : [
+ {
+ "name": "string8"
+ }
+ ],
"Purchasing-supervisor": {
"purchasing-specialist": "string7",
"support": [