From e2d88379376923fbdddc78b59f74d75fd8040ec6 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Thu, 8 Feb 2024 15:04:05 +0000 Subject: Fix test failure by ordering leaf-lists YANG specifies two ways that leaf-lists can be ordered: - ordered-by user: original order in JSON is preserved - ordered-by system (default): it is up to the system how to order For leaf-lists to preserve same order as the JSON, the Yang module must specify 'ordered-by user'. To ensure consistent behaviour even when system ordering is used, the leaf-list is sorted during parsing. - Add 'ordered-by user' to authors field in bookstore.yang - Sort leaf-list during parsing when using 'ordered-by system' - Add new tests to verify ordering Issue-ID: CPS-2057 Signed-off-by: danielhanrahan Change-Id: I6ab688ec2fa4a22182e853d1a8b26642f278c40a --- integration-test/src/test/resources/data/bookstore/bookstore.yang | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'integration-test/src/test/resources/data') diff --git a/integration-test/src/test/resources/data/bookstore/bookstore.yang b/integration-test/src/test/resources/data/bookstore/bookstore.yang index 2abde656d4..0d093ea36c 100644 --- a/integration-test/src/test/resources/data/bookstore/bookstore.yang +++ b/integration-test/src/test/resources/data/bookstore/bookstore.yang @@ -9,6 +9,11 @@ module stores { revision-date 2024-01-30; } + revision "2024-02-08" { + description + "Order of book authors is preserved"; + } + revision "2024-01-30" { description "Extracted bookstore types"; @@ -107,6 +112,7 @@ module stores { type string; } leaf-list authors { + ordered-by user; type string; } leaf-list editions { -- cgit 1.2.3-korg