Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 86e9932

Browse files
JSON serialiser issue
Change-Id: Ib61a3ef54e548debee129f86aefe88f23349ae6c
1 parent 281e10f commit 86e9932

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

serializers/json/src/main/java/org/onosproject/yang/serializers/json/EncoderUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ private static DataNodeSiblingPositionType getCurrentChildSiblingType(DataNode c
161161
case UNKNOWN_TYPE:
162162
case LAST_INSTANCE:
163163
case NOT_MULTI_INSTANCE_NODE:
164+
case SINGLE_INSTANCE_IN_MULTI_NODE:
164165
/*
165166
* If type of previous child is unknown or last instance,
166167
* that means the current child is the first sibling. If

serializers/json/src/test/resources/demo1.yang

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,37 @@ module demo1 {
2424
leaf name {
2525
type string;
2626
description "name of logistics-supervisor";
27+
}
28+
leaf departmentId {
29+
type string;
30+
description "name of department";
31+
}
2732
}
2833

29-
leaf departmentId {
30-
type string;
31-
description "name of department";
34+
list General-supervisor {
35+
key "name";
36+
leaf name {
37+
type string;
38+
}
3239
}
33-
}
3440

35-
container Purchasing-supervisor {
36-
leaf purchasing-specialist {
37-
type string;
38-
description "name of the purchasing-specialist person";
41+
list Supervisor {
42+
key "name";
43+
leaf name {
44+
type string;
45+
}
3946
}
4047

41-
leaf-list support {
42-
type string;
43-
description "name of the support person";
44-
}
48+
container Purchasing-supervisor {
49+
leaf purchasing-specialist {
50+
type string;
51+
description "name of the purchasing-specialist person";
52+
}
53+
54+
leaf-list support {
55+
type string;
56+
description "name of the support person";
57+
}
4558
}
4659

4760
leaf-list Warehouse-supervisor {

serializers/json/src/test/resources/test.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
"departmentId": "string6"
2222
}
2323
],
24+
"General-supervisor": [
25+
{
26+
"name": "string5"
27+
},
28+
{
29+
"name": "string6"
30+
},
31+
{
32+
"name": "string7"
33+
}
34+
],
35+
"Supervisor" : [
36+
{
37+
"name": "string8"
38+
}
39+
],
2440
"Purchasing-supervisor": {
2541
"purchasing-specialist": "string7",
2642
"support": [

0 commit comments

Comments
 (0)