schema CHANGE unify naming of children nodes in schema nodes
Use `child` instead of data. The only exception is module where the data
stands for the complete tree.
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index 1aa43e3..8b60689 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -1382,14 +1382,14 @@
assert_non_null(rpcs->input.exts);
assert_non_null(rpcs->input.musts);
assert_non_null(rpcs->input.typedefs);
- assert_non_null(rpcs->input.data);
+ assert_non_null(rpcs->input.child);
/* output */
assert_int_equal(rpcs->output.nodetype, LYS_OUTPUT);
assert_non_null(rpcs->output.groupings);
assert_non_null(rpcs->output.exts);
assert_non_null(rpcs->output.musts);
assert_non_null(rpcs->output.typedefs);
- assert_non_null(rpcs->output.data);
+ assert_non_null(rpcs->output.child);
ly_set_erase(&YCTX->tpdfs_nodes, NULL);
lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)rpcs); rpcs = NULL;
@@ -1439,7 +1439,7 @@
assert_non_null(notifs->groupings);
assert_non_null(notifs->typedefs);
assert_non_null(notifs->musts);
- assert_non_null(notifs->data);
+ assert_non_null(notifs->child);
assert_int_equal(LYS_STATUS_CURR, notifs->flags);
ly_set_erase(&YCTX->tpdfs_nodes, NULL);
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index 8fa9914..0b72851 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -2627,26 +2627,26 @@
ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, ¬if_meta, NULL, NULL), LY_SUCCESS);
assert_string_equal(notifs->name, "notif-name");
- assert_string_equal(notifs->data->name, "anyd");
- assert_int_equal(notifs->data->nodetype, LYS_ANYDATA);
- assert_string_equal(notifs->data->next->name, "anyx");
- assert_int_equal(notifs->data->next->nodetype, LYS_ANYXML);
- assert_string_equal(notifs->data->next->next->name, "leaf");
- assert_int_equal(notifs->data->next->next->nodetype, LYS_LEAF);
- assert_string_equal(notifs->data->next->next->next->name, "llist");
- assert_int_equal(notifs->data->next->next->next->nodetype, LYS_LEAFLIST);
- assert_string_equal(notifs->data->next->next->next->next->name, "sub-list");
- assert_int_equal(notifs->data->next->next->next->next->nodetype, LYS_LIST);
+ assert_string_equal(notifs->child->name, "anyd");
+ assert_int_equal(notifs->child->nodetype, LYS_ANYDATA);
+ assert_string_equal(notifs->child->next->name, "anyx");
+ assert_int_equal(notifs->child->next->nodetype, LYS_ANYXML);
+ assert_string_equal(notifs->child->next->next->name, "leaf");
+ assert_int_equal(notifs->child->next->next->nodetype, LYS_LEAF);
+ assert_string_equal(notifs->child->next->next->next->name, "llist");
+ assert_int_equal(notifs->child->next->next->next->nodetype, LYS_LEAFLIST);
+ assert_string_equal(notifs->child->next->next->next->next->name, "sub-list");
+ assert_int_equal(notifs->child->next->next->next->next->nodetype, LYS_LIST);
assert_true(notifs->flags & LYS_STATUS_DEPRC);
assert_string_equal(notifs->groupings->name, "grp");
assert_int_equal(notifs->groupings->nodetype, LYS_GROUPING);
- assert_string_equal(notifs->data->next->next->next->next->next->name, "uses-name");
- assert_int_equal(notifs->data->next->next->next->next->next->nodetype, LYS_USES);
- assert_string_equal(notifs->data->next->next->next->next->next->next->name, "cont");
- assert_int_equal(notifs->data->next->next->next->next->next->next->nodetype, LYS_CONTAINER);
- assert_int_equal(notifs->data->next->next->next->next->next->next->next->nodetype, LYS_CHOICE);
- assert_string_equal(notifs->data->next->next->next->next->next->next->next->name, "choice");
- assert_null(notifs->data->next->next->next->next->next->next->next->next);
+ assert_string_equal(notifs->child->next->next->next->next->next->name, "uses-name");
+ assert_int_equal(notifs->child->next->next->next->next->next->nodetype, LYS_USES);
+ assert_string_equal(notifs->child->next->next->next->next->next->next->name, "cont");
+ assert_int_equal(notifs->child->next->next->next->next->next->next->nodetype, LYS_CONTAINER);
+ assert_int_equal(notifs->child->next->next->next->next->next->next->next->nodetype, LYS_CHOICE);
+ assert_string_equal(notifs->child->next->next->next->next->next->next->next->name, "choice");
+ assert_null(notifs->child->next->next->next->next->next->next->next->next);
assert_string_equal(notifs->iffeatures[0].str, "iff");
assert_string_equal(notifs->musts->arg.str, "cond");
assert_int_equal(notifs->nodetype, LYS_NOTIF);
@@ -2695,11 +2695,11 @@
ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, &grp_meta, NULL, NULL), LY_SUCCESS);
assert_string_equal(grps->name, "grp-name");
- assert_string_equal(grps->data->name, "anyd");
- assert_string_equal(grps->data->next->name, "anyx");
- assert_string_equal(grps->data->next->next->name, "leaf");
- assert_string_equal(grps->data->next->next->next->name, "llist");
- assert_string_equal(grps->data->next->next->next->next->name, "list");
+ assert_string_equal(grps->child->name, "anyd");
+ assert_string_equal(grps->child->next->name, "anyx");
+ assert_string_equal(grps->child->next->next->name, "leaf");
+ assert_string_equal(grps->child->next->next->next->name, "llist");
+ assert_string_equal(grps->child->next->next->next->next->name, "list");
assert_string_equal(grps->dsc, "desc");
assert_true(grps->flags & LYS_STATUS_CURR);
assert_string_equal(grps->groupings->name, "sub-grp");
@@ -2709,12 +2709,12 @@
assert_string_equal(grps->ref, "ref");
assert_string_equal(grps->typedefs->name, "tpdf");
assert_string_equal(grps->actions->name, "act");
- assert_string_equal(grps->data->next->next->next->next->next->name, "uses-name");
- assert_int_equal(grps->data->next->next->next->next->next->nodetype, LYS_USES);
- assert_string_equal(grps->data->next->next->next->next->next->next->name, "cont");
- assert_int_equal(grps->data->next->next->next->next->next->next->nodetype, LYS_CONTAINER);
- assert_string_equal(grps->data->next->next->next->next->next->next->next->name, "choice");
- assert_int_equal(grps->data->next->next->next->next->next->next->next->nodetype, LYS_CHOICE);
+ assert_string_equal(grps->child->next->next->next->next->next->name, "uses-name");
+ assert_int_equal(grps->child->next->next->next->next->next->nodetype, LYS_USES);
+ assert_string_equal(grps->child->next->next->next->next->next->next->name, "cont");
+ assert_int_equal(grps->child->next->next->next->next->next->next->nodetype, LYS_CONTAINER);
+ assert_string_equal(grps->child->next->next->next->next->next->next->next->name, "choice");
+ assert_int_equal(grps->child->next->next->next->next->next->next->next->nodetype, LYS_CHOICE);
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(grps->exts[0]), LYEXT_SUBSTMT_SELF);
lysp_node_free(UTEST_LYCTX, &grps->node);
grps = NULL;
@@ -2977,23 +2977,23 @@
CHECK_LYSP_RESTR(inout.musts, "cond", NULL, NULL, NULL, 0, NULL);
assert_string_equal(inout.typedefs->name, "tpdf");
assert_string_equal(inout.groupings->name, "sub-grp");
- assert_string_equal(inout.data->name, "anyd");
- assert_int_equal(inout.data->nodetype, LYS_ANYDATA);
- assert_string_equal(inout.data->next->name, "anyx");
- assert_int_equal(inout.data->next->nodetype, LYS_ANYXML);
- assert_string_equal(inout.data->next->next->name, "choice");
- assert_int_equal(inout.data->next->next->nodetype, LYS_CHOICE);
- assert_string_equal(inout.data->next->next->next->name, "subcont");
- assert_int_equal(inout.data->next->next->next->nodetype, LYS_CONTAINER);
- assert_string_equal(inout.data->next->next->next->next->name, "leaf");
- assert_int_equal(inout.data->next->next->next->next->nodetype, LYS_LEAF);
- assert_string_equal(inout.data->next->next->next->next->next->name, "llist");
- assert_int_equal(inout.data->next->next->next->next->next->nodetype, LYS_LEAFLIST);
- assert_string_equal(inout.data->next->next->next->next->next->next->name, "list");
- assert_int_equal(inout.data->next->next->next->next->next->next->nodetype, LYS_LIST);
- assert_string_equal(inout.data->next->next->next->next->next->next->next->name, "uses-name");
- assert_int_equal(inout.data->next->next->next->next->next->next->next->nodetype, LYS_USES);
- assert_null(inout.data->next->next->next->next->next->next->next->next);
+ assert_string_equal(inout.child->name, "anyd");
+ assert_int_equal(inout.child->nodetype, LYS_ANYDATA);
+ assert_string_equal(inout.child->next->name, "anyx");
+ assert_int_equal(inout.child->next->nodetype, LYS_ANYXML);
+ assert_string_equal(inout.child->next->next->name, "choice");
+ assert_int_equal(inout.child->next->next->nodetype, LYS_CHOICE);
+ assert_string_equal(inout.child->next->next->next->name, "subcont");
+ assert_int_equal(inout.child->next->next->next->nodetype, LYS_CONTAINER);
+ assert_string_equal(inout.child->next->next->next->next->name, "leaf");
+ assert_int_equal(inout.child->next->next->next->next->nodetype, LYS_LEAF);
+ assert_string_equal(inout.child->next->next->next->next->next->name, "llist");
+ assert_int_equal(inout.child->next->next->next->next->next->nodetype, LYS_LEAFLIST);
+ assert_string_equal(inout.child->next->next->next->next->next->next->name, "list");
+ assert_int_equal(inout.child->next->next->next->next->next->next->nodetype, LYS_LIST);
+ assert_string_equal(inout.child->next->next->next->next->next->next->next->name, "uses-name");
+ assert_int_equal(inout.child->next->next->next->next->next->next->next->nodetype, LYS_USES);
+ assert_null(inout.child->next->next->next->next->next->next->next->next);
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(inout.exts[0]), LYEXT_SUBSTMT_SELF);
lysp_node_free(UTEST_LYCTX, (struct lysp_node *)&inout);
memset(&inout, 0, sizeof inout);
@@ -3021,23 +3021,23 @@
assert_string_equal(inout.musts->arg.str, "cond");
assert_string_equal(inout.typedefs->name, "tpdf");
assert_string_equal(inout.groupings->name, "sub-grp");
- assert_string_equal(inout.data->name, "anyd");
- assert_int_equal(inout.data->nodetype, LYS_ANYDATA);
- assert_string_equal(inout.data->next->name, "anyx");
- assert_int_equal(inout.data->next->nodetype, LYS_ANYXML);
- assert_string_equal(inout.data->next->next->name, "choice");
- assert_int_equal(inout.data->next->next->nodetype, LYS_CHOICE);
- assert_string_equal(inout.data->next->next->next->name, "subcont");
- assert_int_equal(inout.data->next->next->next->nodetype, LYS_CONTAINER);
- assert_string_equal(inout.data->next->next->next->next->name, "leaf");
- assert_int_equal(inout.data->next->next->next->next->nodetype, LYS_LEAF);
- assert_string_equal(inout.data->next->next->next->next->next->name, "llist");
- assert_int_equal(inout.data->next->next->next->next->next->nodetype, LYS_LEAFLIST);
- assert_string_equal(inout.data->next->next->next->next->next->next->name, "list");
- assert_int_equal(inout.data->next->next->next->next->next->next->nodetype, LYS_LIST);
- assert_string_equal(inout.data->next->next->next->next->next->next->next->name, "uses-name");
- assert_int_equal(inout.data->next->next->next->next->next->next->next->nodetype, LYS_USES);
- assert_null(inout.data->next->next->next->next->next->next->next->next);
+ assert_string_equal(inout.child->name, "anyd");
+ assert_int_equal(inout.child->nodetype, LYS_ANYDATA);
+ assert_string_equal(inout.child->next->name, "anyx");
+ assert_int_equal(inout.child->next->nodetype, LYS_ANYXML);
+ assert_string_equal(inout.child->next->next->name, "choice");
+ assert_int_equal(inout.child->next->next->nodetype, LYS_CHOICE);
+ assert_string_equal(inout.child->next->next->next->name, "subcont");
+ assert_int_equal(inout.child->next->next->next->nodetype, LYS_CONTAINER);
+ assert_string_equal(inout.child->next->next->next->next->name, "leaf");
+ assert_int_equal(inout.child->next->next->next->next->nodetype, LYS_LEAF);
+ assert_string_equal(inout.child->next->next->next->next->next->name, "llist");
+ assert_int_equal(inout.child->next->next->next->next->next->nodetype, LYS_LEAFLIST);
+ assert_string_equal(inout.child->next->next->next->next->next->next->name, "list");
+ assert_int_equal(inout.child->next->next->next->next->next->next->nodetype, LYS_LIST);
+ assert_string_equal(inout.child->next->next->next->next->next->next->next->name, "uses-name");
+ assert_int_equal(inout.child->next->next->next->next->next->next->next->nodetype, LYS_USES);
+ assert_null(inout.child->next->next->next->next->next->next->next->next);
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(inout.exts[0]), LYEXT_SUBSTMT_SELF);
lysp_node_free(UTEST_LYCTX, (struct lysp_node *)&inout);
memset(&inout, 0, sizeof inout);
@@ -3100,7 +3100,7 @@
assert_string_equal(actions->typedefs->name, "tpdf");
assert_string_equal(actions->groupings->name, "grouping");
assert_string_equal(actions->output.musts->arg.str, "cond");
- assert_string_equal(actions->input.data->name, "uses-name");
+ assert_string_equal(actions->input.child->name, "uses-name");
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(actions->exts[0]), LYEXT_SUBSTMT_SELF);
lysp_node_free(UTEST_LYCTX, (struct lysp_node *)actions);
actions = NULL;
@@ -3132,7 +3132,7 @@
assert_string_equal(actions->iffeatures[0].str, "iff");
assert_string_equal(actions->typedefs->name, "tpdf");
assert_string_equal(actions->groupings->name, "grouping");
- assert_string_equal(actions->input.data->name, "uses-name");
+ assert_string_equal(actions->input.child->name, "uses-name");
assert_string_equal(actions->output.musts->arg.str, "cond");
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(actions->exts[0]), LYEXT_SUBSTMT_SELF);
lysp_node_free(UTEST_LYCTX, (struct lysp_node *)actions);
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index aa3ebc0..e37fd1d 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -614,13 +614,13 @@
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("a1", notif->name);
- assert_non_null(notif->data);
- assert_string_equal("x", notif->data->name);
+ assert_non_null(notif->child);
+ assert_string_equal("x", notif->child->name);
notif = notif->next;
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("a2", notif->name);
- assert_null(notif->data);
+ assert_null(notif->child);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module b {yang-version 1.1; namespace urn:b;prefix b; container top {"
"notification b1 {leaf x {type int8;}} notification b2 {must \"/top\";}}}", LYS_IN_YANG, &mod));
@@ -631,13 +631,13 @@
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("b1", notif->name);
- assert_non_null(notif->data);
- assert_string_equal("x", notif->data->name);
+ assert_non_null(notif->child);
+ assert_string_equal("x", notif->child->name);
notif = notif->next;
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("b2", notif->name);
- assert_null(notif->data);
+ assert_null(notif->child);
assert_int_equal(1, LY_ARRAY_COUNT(notif->musts));
/* invalid */
@@ -2450,12 +2450,12 @@
assert_non_null(mod = ly_ctx_get_module_implemented(UTEST_LYCTX, "himp"));
assert_non_null(rpc = mod->compiled->rpcs);
assert_null(rpc->next);
- assert_non_null(rpc->input.data);
- assert_string_equal("x", rpc->input.data->name);
- assert_null(rpc->input.data->next);
- assert_non_null(rpc->output.data);
- assert_string_equal("y", rpc->output.data->name);
- assert_null(rpc->output.data->next);
+ assert_non_null(rpc->input.child);
+ assert_string_equal("x", rpc->input.child->name);
+ assert_null(rpc->input.child->next);
+ assert_non_null(rpc->output.child);
+ assert_string_equal("y", rpc->output.child->name);
+ assert_null(rpc->output.child->next);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module j {namespace urn:j;prefix j;yang-version 1.1; container root;"
"grouping grp {notification grp-notif;}"
@@ -2545,8 +2545,8 @@
assert_null(((struct lysc_node_choice *)node)->cases->next);
assert_non_null(mod->compiled->rpcs);
assert_null(mod->compiled->rpcs->next);
- assert_null(mod->compiled->rpcs->input.data);
- assert_null(mod->compiled->rpcs->output.data);
+ assert_null(mod->compiled->rpcs->input.child);
+ assert_null(mod->compiled->rpcs->output.child);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module c {namespace urn:c;prefix c; typedef mytype {type string; units kilometers;}"
"leaf c1 {type mytype;} leaf c2 {type mytype; units meters;} leaf c3 {type mytype; units meters;}"