plugin types REFACTOR remove STORE and CANONIZE flags

The behavior was changed as if both of these
flags are always set. Also, types now always
include their canonical/JSON string value.

Finally, default value resolution was also
refactored to avoid some code duplication.
This change was most evident in deviations,
which were then significantly refactored.
diff --git a/tests/utests/data/test_new.c b/tests/utests/data/test_new.c
index 50a7740..cfb7a6a 100644
--- a/tests/utests/data/test_new.c
+++ b/tests/utests/data/test_new.c
@@ -218,7 +218,6 @@
 
     LY_ERR ret;
     struct lyd_node *root, *node, *parent;
-    int dynamic;
 
     /* create 2 nodes */
     ret = lyd_new_path2(NULL, ctx, "/a:c/x[.='val']", "vvv", 0, 0, &root, &node);
@@ -227,24 +226,21 @@
     assert_string_equal(root->schema->name, "c");
     assert_non_null(node);
     assert_string_equal(node->schema->name, "x");
-    assert_string_equal("val", lyd_value2str((struct lyd_node_term *)node, &dynamic));
-    assert_int_equal(dynamic, 0);
+    assert_string_equal("val", LYD_CANONICAL(node));
 
     /* append another */
     ret = lyd_new_path2(root, NULL, "/a:c/x", "val2", 0, 0, &parent, &node);
     assert_int_equal(ret, LY_SUCCESS);
     assert_ptr_equal(parent, node);
     assert_string_equal(node->schema->name, "x");
-    assert_string_equal("val2", lyd_value2str((struct lyd_node_term *)node, &dynamic));
-    assert_int_equal(dynamic, 0);
+    assert_string_equal("val2", LYD_CANONICAL(node));
 
     /* and a last one */
     ret = lyd_new_path2(root, NULL, "x", "val3", 0, 0, &parent, &node);
     assert_int_equal(ret, LY_SUCCESS);
     assert_ptr_equal(parent, node);
     assert_string_equal(node->schema->name, "x");
-    assert_string_equal("val3", lyd_value2str((struct lyd_node_term *)node, &dynamic));
-    assert_int_equal(dynamic, 0);
+    assert_string_equal("val3", LYD_CANONICAL(node));
 
     lyd_free_tree(root);
 
@@ -276,8 +272,7 @@
     assert_int_equal(ret, LY_SUCCESS);
     assert_non_null(root);
     assert_string_equal(node->schema->name, "x");
-    assert_string_equal("val", lyd_value2str((struct lyd_node_term *)node, &dynamic));
-    assert_int_equal(dynamic, 0);
+    assert_string_equal("val", LYD_CANONICAL(node));
 
     ret = lyd_new_path2(root, NULL, "/a:l2[1]/c/x", "val", 0, 0, NULL, &node);
     assert_int_equal(ret, LY_EEXIST);
@@ -290,8 +285,7 @@
     assert_int_equal(ret, LY_SUCCESS);
     assert_non_null(node);
     assert_string_equal(node->schema->name, "x");
-    assert_string_equal("val2", lyd_value2str((struct lyd_node_term *)node, &dynamic));
-    assert_int_equal(dynamic, 0);
+    assert_string_equal("val2", LYD_CANONICAL(node));
 
     lyd_free_tree(root);
 
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index 90c7431..14370d8 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -138,12 +138,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("foo", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("foo value", leaf->value.original);
+    assert_string_equal("foo value", leaf->value.canonical);
 
     assert_int_equal(LYS_LEAF, tree->next->next->schema->nodetype);
     assert_string_equal("foo2", tree->next->next->schema->name);
     leaf = (struct lyd_node_term*)tree->next->next;
-    assert_string_equal("default-val", leaf->value.original);
+    assert_string_equal("default-val", leaf->value.canonical);
     assert_true(leaf->flags & LYD_DEFAULT);
 
     lyd_print_tree(out, tree, LYD_JSON, 0);
@@ -158,7 +158,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("foo2", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("default-val", leaf->value.original);
+    assert_string_equal("default-val", leaf->value.canonical);
     assert_false(leaf->flags & LYD_DEFAULT);
 
     lyd_print_tree(out, tree, LYD_JSON, 0);
@@ -173,7 +173,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("foo2", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("default-val", leaf->value.original);
+    assert_string_equal("default-val", leaf->value.canonical);
     assert_true(leaf->flags & LYD_DEFAULT);
 
     /* TODO default values
@@ -192,13 +192,13 @@
     assert_non_null(tree->meta);
     assert_string_equal("hint", tree->meta->name);
     assert_int_equal(LY_TYPE_INT8, tree->meta->value.realtype->basetype);
-    assert_string_equal("1", tree->meta->value.original);
+    assert_string_equal("1", tree->meta->value.canonical);
     assert_int_equal(1, tree->meta->value.int8);
     assert_ptr_equal(tree, tree->meta->parent);
     assert_non_null(tree->meta->next);
     assert_string_equal("hint", tree->meta->next->name);
     assert_int_equal(LY_TYPE_INT8, tree->meta->next->value.realtype->basetype);
-    assert_string_equal("2", tree->meta->next->value.original);
+    assert_string_equal("2", tree->meta->next->value.canonical);
     assert_int_equal(2, tree->meta->next->value.int8);
     assert_ptr_equal(tree, tree->meta->next->parent);
     assert_null(tree->meta->next->next);
@@ -242,13 +242,13 @@
     assert_int_equal(LYS_LEAFLIST, tree->schema->nodetype);
     assert_string_equal("ll1", tree->schema->name);
     ll = (struct lyd_node_term*)tree;
-    assert_string_equal("10", ll->value.original);
+    assert_string_equal("10", ll->value.canonical);
 
     assert_non_null(tree->next);
     assert_int_equal(LYS_LEAFLIST, tree->next->schema->nodetype);
     assert_string_equal("ll1", tree->next->schema->name);
     ll = (struct lyd_node_term*)tree->next;
-    assert_string_equal("11", ll->value.original);
+    assert_string_equal("11", ll->value.canonical);
 
     lyd_print_all(out, tree, LYD_JSON, 0);
     assert_string_equal(printed, data);
@@ -262,16 +262,16 @@
     assert_int_equal(LYS_LEAFLIST, tree->schema->nodetype);
     assert_string_equal("ll1", tree->schema->name);
     ll = (struct lyd_node_term*)tree;
-    assert_string_equal("10", ll->value.original);
+    assert_string_equal("10", ll->value.canonical);
     assert_null(ll->meta);
 
     assert_non_null(tree->next);
     assert_int_equal(LYS_LEAFLIST, tree->next->schema->nodetype);
     assert_string_equal("ll1", tree->next->schema->name);
     ll = (struct lyd_node_term*)tree->next;
-    assert_string_equal("11", ll->value.original);
+    assert_string_equal("11", ll->value.canonical);
     assert_non_null(ll->meta);
-    assert_string_equal("2", ll->meta->value.original);
+    assert_string_equal("2", ll->meta->value.canonical);
     assert_null(ll->meta->next);
 
     lyd_print_all(out, tree, LYD_JSON, 0);
@@ -286,17 +286,17 @@
     assert_int_equal(LYS_LEAFLIST, tree->schema->nodetype);
     assert_string_equal("ll1", tree->schema->name);
     ll = (struct lyd_node_term*)tree;
-    assert_string_equal("1", ll->value.original);
+    assert_string_equal("1", ll->value.canonical);
     assert_non_null(ll->meta);
     assert_string_equal("hint", ll->meta->name);
     assert_int_equal(LY_TYPE_INT8, ll->meta->value.realtype->basetype);
-    assert_string_equal("1", ll->meta->value.original);
+    assert_string_equal("1", ll->meta->value.canonical);
     assert_int_equal(1, ll->meta->value.int8);
     assert_ptr_equal(ll, ll->meta->parent);
     assert_non_null(ll->meta->next);
     assert_string_equal("hint", ll->meta->next->name);
     assert_int_equal(LY_TYPE_INT8, ll->meta->next->value.realtype->basetype);
-    assert_string_equal("10", ll->meta->next->value.original);
+    assert_string_equal("10", ll->meta->next->value.canonical);
     assert_int_equal(10, ll->meta->next->value.int8);
     assert_ptr_equal(ll, ll->meta->next->parent);
     assert_null(ll->meta->next->next);
@@ -305,18 +305,18 @@
     assert_int_equal(LYS_LEAFLIST, tree->next->schema->nodetype);
     assert_string_equal("ll1", tree->next->schema->name);
     ll = (struct lyd_node_term*)tree->next;
-    assert_string_equal("2", ll->value.original);
+    assert_string_equal("2", ll->value.canonical);
     assert_null(ll->meta);
 
     assert_non_null(tree->next->next);
     assert_int_equal(LYS_LEAFLIST, tree->next->next->schema->nodetype);
     assert_string_equal("ll1", tree->next->next->schema->name);
     ll = (struct lyd_node_term*)tree->next->next;
-    assert_string_equal("3", ll->value.original);
+    assert_string_equal("3", ll->value.canonical);
     assert_non_null(ll->meta);
     assert_string_equal("hint", ll->meta->name);
     assert_int_equal(LY_TYPE_INT8, ll->meta->value.realtype->basetype);
-    assert_string_equal("3", ll->meta->value.original);
+    assert_string_equal("3", ll->meta->value.canonical);
     assert_int_equal(3, ll->meta->value.int8);
     assert_ptr_equal(ll, ll->meta->parent);
     assert_null(ll->meta->next);
@@ -467,7 +467,7 @@
     assert_string_equal("cp", tree->schema->name);
     assert_non_null(tree->meta);
     assert_string_equal("hint", tree->meta->name);
-    assert_string_equal("1", tree->meta->value.original);
+    assert_string_equal("1", tree->meta->value.canonical);
     assert_ptr_equal(tree, tree->meta->parent);
     assert_null(tree->meta->next);
 
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index 077c8b4..3632a3c 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -132,12 +132,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("foo", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("foo value", leaf->value.original);
+    assert_string_equal("foo value", leaf->value.canonical);
 
     assert_int_equal(LYS_LEAF, tree->next->next->schema->nodetype);
     assert_string_equal("foo2", tree->next->next->schema->name);
     leaf = (struct lyd_node_term*)tree->next->next;
-    assert_string_equal("default-val", leaf->value.original);
+    assert_string_equal("default-val", leaf->value.canonical);
     assert_true(leaf->flags & LYD_DEFAULT);
 
     lyd_free_all(tree);
@@ -149,7 +149,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("foo2", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("default-val", leaf->value.original);
+    assert_string_equal("default-val", leaf->value.canonical);
     assert_false(leaf->flags & LYD_DEFAULT);
 
     lyd_free_all(tree);
@@ -161,7 +161,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("foo2", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("default-val", leaf->value.original);
+    assert_string_equal("default-val", leaf->value.canonical);
     assert_true(leaf->flags & LYD_DEFAULT);
 
     lyd_free_all(tree);
diff --git a/tests/utests/data/test_tree_data.c b/tests/utests/data/test_tree_data.c
index 38a7239..9bb7f10 100644
--- a/tests/utests/data/test_tree_data.c
+++ b/tests/utests/data/test_tree_data.c
@@ -277,8 +277,7 @@
     struct lyd_node *tree;
     struct lyxp_expr *exp;
     struct ly_path *path;
-    const char *path_str = "/a:l2[2]/c/d[3]", *val;
-    int dynamic;
+    const char *path_str = "/a:l2[2]/c/d[3]";
     const char *data =
         "<l2 xmlns=\"urn:tests:a\"><c>"
             "<d>a</d>"
@@ -300,12 +299,8 @@
     term = lyd_target(path, tree);
 
     assert_string_equal(term->schema->name, "d");
-    val = lyd_value2str(term, &dynamic);
-    assert_int_equal(dynamic, 0);
-    assert_string_equal(val, "b");
-    val = lyd_value2str((struct lyd_node_term *)term->prev, &dynamic);
-    assert_int_equal(dynamic, 0);
-    assert_string_equal(val, "b");
+    assert_string_equal(LYD_CANONICAL(term), "b");
+    assert_string_equal(LYD_CANONICAL(term->prev), "b");
 
     lyd_free_all(tree);
     ly_path_free(ctx, path);
diff --git a/tests/utests/data/test_types.c b/tests/utests/data/test_types.c
index f78f851..900c9b2 100644
--- a/tests/utests/data/test_types.c
+++ b/tests/utests/data/test_types.c
@@ -181,12 +181,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("int8", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("15", leaf->value.canonical_cache);
+    assert_string_equal("15", leaf->value.canonical);
     assert_int_equal(15, leaf->value.int8);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
+    assert_string_equal(leaf->value.canonical, value.canonical);
     assert_int_equal(15, value.int8);
     value.realtype->plugin->free(s->ctx, &value);
     memset(&value, 0, sizeof value);
@@ -222,12 +222,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("uint8", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("150", leaf->value.canonical_cache);
+    assert_string_equal("150", leaf->value.canonical);
     assert_int_equal(150, leaf->value.uint8);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
+    assert_string_equal(leaf->value.canonical, value.canonical);
     assert_int_equal(150, value.uint8);
     value.realtype->plugin->free(s->ctx, &value);
     memset(&value, 0, sizeof value);
@@ -263,12 +263,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("8.0", leaf->value.canonical_cache);
+    assert_string_equal("8.0", leaf->value.canonical);
     assert_int_equal(80, leaf->value.dec64);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
+    assert_string_equal(leaf->value.canonical, value.canonical);
     assert_int_equal(80, value.dec64);
     value.realtype->plugin->free(s->ctx, &value);
     memset(&value, 0, sizeof value);
@@ -278,7 +278,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("8.0", leaf->value.canonical_cache);
+    assert_string_equal("8.0", leaf->value.canonical);
     assert_int_equal(80, leaf->value.dec64);
     lyd_free_all(tree);
 
@@ -286,7 +286,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("-9.223372036854775808", leaf->value.canonical_cache);
+    assert_string_equal("-9.223372036854775808", leaf->value.canonical);
     assert_int_equal(INT64_C(-9223372036854775807) - INT64_C(1), leaf->value.dec64);
     lyd_free_all(tree);
 
@@ -294,7 +294,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("dec64-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("9.223372036854775807", leaf->value.canonical_cache);
+    assert_string_equal("9.223372036854775807", leaf->value.canonical);
     assert_int_equal(INT64_C(9223372036854775807), leaf->value.dec64);
     lyd_free_all(tree);
 
@@ -328,7 +328,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("str", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("teststring", leaf->value.canonical_cache);
+    assert_string_equal("teststring", leaf->value.canonical);
     lyd_free_all(tree);
 
     /* multibyte characters (€ encodes as 3-byte UTF8 character, length restriction is 2-5) */
@@ -336,7 +336,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("str-utf8", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("€€", leaf->value.canonical_cache);
+    assert_string_equal("€€", leaf->value.canonical);
     lyd_free_all(tree);
     TEST_DATA("<str-utf8 xmlns=\"urn:tests:types\">€</str-utf8>", LY_EVALID, "Length \"1\" does not satisfy the length constraint. /types:str-utf8");
     TEST_DATA("<str-utf8 xmlns=\"urn:tests:types\">€€€€€€</str-utf8>", LY_EVALID, "Length \"6\" does not satisfy the length constraint. /types:str-utf8");
@@ -369,14 +369,14 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bits", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("zero two", leaf->value.canonical_cache);
+    assert_string_equal("zero two", leaf->value.canonical);
     assert_int_equal(2, LY_ARRAY_COUNT(leaf->value.bits_items));
     assert_string_equal("zero", leaf->value.bits_items[0]->name);
     assert_string_equal("two", leaf->value.bits_items[1]->name);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
+    assert_string_equal(leaf->value.canonical, value.canonical);
     assert_int_equal(2, LY_ARRAY_COUNT(value.bits_items));
     assert_string_equal("zero", value.bits_items[0]->name);
     assert_string_equal("two", value.bits_items[1]->name);
@@ -388,7 +388,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bits", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("zero two", leaf->value.canonical_cache);
+    assert_string_equal("zero two", leaf->value.canonical);
     lyd_free_all(tree);
 
     /* disabled feature */
@@ -400,13 +400,13 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bits", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("one", leaf->value.canonical_cache);
+    assert_string_equal("one", leaf->value.canonical);
     assert_int_equal(1, LY_ARRAY_COUNT(leaf->value.bits_items));
     assert_string_equal("one", leaf->value.bits_items[0]->name);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
+    assert_string_equal(leaf->value.canonical, value.canonical);
     assert_int_equal(1, LY_ARRAY_COUNT(value.bits_items));
     assert_string_equal("one", value.bits_items[0]->name);
     value.realtype->plugin->free(s->ctx, &value);
@@ -438,12 +438,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("enums", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("white", leaf->value.canonical_cache);
+    assert_string_equal("white", leaf->value.canonical);
     assert_string_equal("white", leaf->value.enum_item->name);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
+    assert_string_equal(leaf->value.canonical, value.canonical);
     assert_string_equal("white", value.enum_item->name);
     value.realtype->plugin->free(s->ctx, &value);
     lyd_free_all(tree);
@@ -458,7 +458,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("enums", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("yellow", leaf->value.canonical_cache);
+    assert_string_equal("yellow", leaf->value.canonical);
     lyd_free_all(tree);
 
     /* leading/trailing whitespaces are not valid */
@@ -488,16 +488,16 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("aGVs\nbG8=", leaf->value.canonical_cache);
+    assert_string_equal("aGVs\nbG8=", leaf->value.canonical);
     assert_non_null(tree = tree->next);
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("TQ==", leaf->value.canonical_cache);
+    assert_string_equal("TQ==", leaf->value.canonical);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal(leaf->value.canonical_cache, value.canonical_cache);
+    assert_string_equal(leaf->value.canonical, value.canonical);
     value.realtype->plugin->free(s->ctx, &value);
     memset(&value, 0, sizeof value);
     lyd_free_all(tree);
@@ -507,19 +507,19 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("", leaf->value.canonical_cache);
+    assert_string_equal("</binary-norestr>", leaf->value.canonical);
     lyd_free_all(tree);
     TEST_DATA("<binary-norestr xmlns=\"urn:tests:types\"></binary-norestr>", LY_SUCCESS, "");
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("", leaf->value.canonical_cache);
+    assert_string_equal("", leaf->value.canonical);
     lyd_free_all(tree);
     TEST_DATA("<binary-norestr xmlns=\"urn:tests:types\"/>", LY_SUCCESS, "");
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("binary-norestr", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("", leaf->value.canonical_cache);
+    assert_string_equal("", leaf->value.canonical);
     lyd_free_all(tree);
 
     /* invalid base64 character */
@@ -559,7 +559,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bool", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("true", leaf->value.canonical_cache);
+    assert_string_equal("true", leaf->value.canonical);
     assert_int_equal(1, leaf->value.boolean);
     lyd_free_all(tree);
 
@@ -567,7 +567,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("bool", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("false", leaf->value.canonical_cache);
+    assert_string_equal("false", leaf->value.canonical);
     assert_int_equal(0, leaf->value.boolean);
     lyd_free_all(tree);
 
@@ -575,7 +575,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("tbool", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("false", leaf->value.canonical_cache);
+    assert_string_equal("false", leaf->value.canonical);
     assert_int_equal(0, leaf->value.boolean);
     lyd_free_all(tree);
 
@@ -603,21 +603,21 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("empty", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("", leaf->value.canonical_cache);
+    assert_string_equal("", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<empty xmlns=\"urn:tests:types\"/>", LY_SUCCESS, "");
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("empty", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("", leaf->value.canonical_cache);
+    assert_string_equal("", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<tempty xmlns=\"urn:tests:types\"/>", LY_SUCCESS, "");
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("tempty", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("", leaf->value.canonical_cache);
+    assert_string_equal("", leaf->value.canonical);
     lyd_free_all(tree);
 
     /* invalid value */
@@ -658,13 +658,14 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("ident", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_non_null(leaf->value.canonical);
+    assert_string_equal("types:gigabit-ethernet", leaf->value.canonical);
     assert_string_equal("gigabit-ethernet", leaf->value.ident->name);
     test_printed_value(&leaf->value, "t:gigabit-ethernet", LY_PREF_SCHEMA, s->mod_types);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_null(value.canonical_cache);
+    assert_string_equal("types:gigabit-ethernet", value.canonical);
     assert_string_equal("gigabit-ethernet", value.ident->name);
     value.realtype->plugin->free(s->ctx, &value);
     lyd_free_all(tree);
@@ -673,7 +674,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("ident", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("defs:fast-ethernet", leaf->value.canonical);
     test_printed_value(&leaf->value, "d:fast-ethernet", LY_PREF_SCHEMA, s->mod_defs);
     lyd_free_all(tree);
 
@@ -721,7 +722,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/types:cont/leaftarget", leaf->value.canonical);
     assert_int_equal(2, LY_ARRAY_COUNT(leaf->value.target));
     assert_string_equal("cont", leaf->value.target[0].node->name);
     assert_null(leaf->value.target[0].predicates);
@@ -730,7 +731,7 @@
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_null(value.canonical_cache);
+    assert_string_equal("/types:cont/leaftarget", value.canonical);
     assert_true(LY_ARRAY_COUNT(leaf->value.target) == LY_ARRAY_COUNT(value.target));
     assert_true(leaf->value.target[0].node == value.target[0].node);
     assert_true(leaf->value.target[0].predicates == value.target[0].predicates); /* NULL */
@@ -745,7 +746,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/types:list[id='b']/id", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<leaflisttarget xmlns=\"urn:tests:types\">1</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">2</leaflisttarget>"
@@ -754,7 +755,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/types:leaflisttarget[.='1']", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<list_inst xmlns=\"urn:tests:types\"><id xmlns:b=\"urn:tests:types\">/b:leaflisttarget[.='a']</id><value>x</value></list_inst>"
@@ -765,7 +766,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/types:list_inst[id=\"/types:leaflisttarget[.='b']\"]/value", leaf->value.canonical);
     assert_int_equal(2, LY_ARRAY_COUNT(leaf->value.target));
     assert_string_equal("list_inst", leaf->value.target[0].node->name);
     assert_int_equal(1, LY_ARRAY_COUNT(leaf->value.target[0].predicates));
@@ -777,7 +778,7 @@
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_null(value.canonical_cache);
+    assert_string_equal("/types:list_inst[id=\"/types:leaflisttarget[.='b']\"]/value", value.canonical);
     assert_true(LY_ARRAY_COUNT(leaf->value.target) == LY_ARRAY_COUNT(value.target));
     assert_true(leaf->value.target[0].node == value.target[0].node);
     assert_true(LY_ARRAY_COUNT(leaf->value.target[0].predicates) == LY_ARRAY_COUNT(value.target[0].predicates));
@@ -792,7 +793,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/types:list[id='b']/value", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<list_inst xmlns=\"urn:tests:types\"><id xmlns:b=\"urn:tests:types\">/b:leaflisttarget[.='a']</id><value>x</value></list_inst>"
@@ -803,7 +804,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/types:list_inst[id=\"/types:leaflisttarget[.='a']\"]/value", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<list_ident xmlns=\"urn:tests:types\"><id xmlns:dfs=\"urn:tests:defs\">dfs:ethernet</id><value>x</value></list_ident>"
@@ -813,7 +814,8 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_non_null(leaf->value.canonical);
+    assert_string_equal("/types:list_ident[id='defs:fast-ethernet']/value", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<list2 xmlns=\"urn:tests:types\"><id>types:xxx</id><value>x</value></list2>"
@@ -823,7 +825,8 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_non_null(leaf->value.canonical);
+    assert_string_equal("/types:list2[id='a:xxx'][value='y']/value", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<list xmlns=\"urn:tests:types\"><id>types:xxx</id><value>x</value></list>"
@@ -833,7 +836,8 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("inst", tree->schema->name);
     leaf = (const struct lyd_node_term*)tree;
-    assert_null(leaf->value.canonical_cache);
+    assert_non_null(leaf->value.canonical);
+    assert_string_equal("/types:list[id='a:xxx']/value", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<list2 xmlns=\"urn:tests:types\"><id>a</id><value>a</value></list2>"
@@ -843,10 +847,11 @@
     leaf = (const struct lyd_node_term*)tree->prev->prev;
     assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
     assert_string_equal("inst", leaf->schema->name);
-    assert_null(leaf->value.canonical_cache);
+    assert_non_null(leaf->value.canonical);
+    assert_string_equal("/types:list2[id='a'][value='b']/id", leaf->value.canonical);
     assert_non_null(leaf = lyd_target(leaf->value.target, tree));
-    assert_string_equal("a", leaf->value.canonical_cache);
-    assert_string_equal("b", ((struct lyd_node_term*)leaf->next)->value.canonical_cache);
+    assert_string_equal("a", leaf->value.canonical);
+    assert_string_equal("b", ((struct lyd_node_term*)leaf->next)->value.canonical);
     lyd_free_all(tree);
 
     /* invalid value */
@@ -864,10 +869,10 @@
     TEST_DATA("<inst xmlns=\"urn:tests:types\">/cont/leaftarget</inst>", LY_EVALID,
               "Invalid instance-identifier \"/cont/leaftarget\" value - syntax error. /types:inst");
 
-    /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
+    /* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
     TEST_DATA( "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>", LY_EVALID, "Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found. /types:inst");
 
-    /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
+    /* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
     TEST_DATA( "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>", LY_EVALID, "Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found. /types:inst");
 
     TEST_DATA("<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><t:inst xmlns:t=\"urn:tests:types\">/t:leaflisttarget[1</t:inst>", LY_EVALID,
@@ -899,7 +904,7 @@
               "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[.='x']</t:inst>", LY_EVALID,
               "Invalid instance-identifier \"/t:cont/t:listtarget[.='x']\" value - semantic error. /types:inst");
 
-    /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
+    /* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
     TEST_DATA("<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
               "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[.='2']</t:inst>", LY_EVALID,
               "Invalid instance-identifier \"/types:cont/leaflisttarget[.='2']\" value - required instance not found. /types:inst");
@@ -910,7 +915,7 @@
               "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='x']</t:inst>", LY_EVALID,
               "Invalid instance-identifier \"/t:cont/t:listtarget[t:id='x']\" value - semantic error. /types:inst");
 
-    /* instance-identifier is here in JSON format because it is already in internal representation without original prefixes */
+    /* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
     TEST_DATA("<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
               "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='2']</t:inst>", LY_EVALID,
               "Invalid instance-identifier \"/types:cont/listtarget[id='2']\" value - required instance not found. /types:inst");
@@ -994,7 +999,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("lref", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("y", leaf->value.canonical_cache);
+    assert_string_equal("y", leaf->value.canonical);
     assert_int_equal(LY_TYPE_STRING, leaf->value.realtype->plugin->type);
     lyd_free_all(tree);
 
@@ -1005,7 +1010,7 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("lref2", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("y", leaf->value.canonical_cache);
+    assert_string_equal("y", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
@@ -1014,7 +1019,7 @@
     leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree, 0)->next, 0)->prev);
     assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
     assert_string_equal("lr1", leaf->schema->name);
-    assert_string_equal("y", leaf->value.canonical_cache);
+    assert_string_equal("y", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
@@ -1024,7 +1029,7 @@
     leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree, 0)->prev, 0)->prev);
     assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
     assert_string_equal("lr2", leaf->schema->name);
-    assert_string_equal("y", leaf->value.canonical_cache);
+    assert_string_equal("y", leaf->value.canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
@@ -1035,7 +1040,7 @@
     leaf = (struct lyd_node_term*)(lyd_node_children(lyd_node_children(tree, 0)->prev, 0)->prev);
     assert_int_equal(LYS_LEAF, leaf->schema->nodetype);
     assert_string_equal("lr3", leaf->schema->name);
-    assert_string_equal("c", leaf->value.canonical_cache);
+    assert_string_equal("c", leaf->value.canonical);
     lyd_free_all(tree);
 
     /* invalid value */
@@ -1098,25 +1103,23 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("12", leaf->value.original);
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("12", leaf->value.canonical);
     assert_non_null(leaf->value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 1);
     assert_int_equal(LY_TYPE_UNION, leaf->value.realtype->basetype);
     assert_int_equal(LY_TYPE_INT8, leaf->value.subvalue->value->realtype->basetype);
-    assert_string_equal("12", leaf->value.subvalue->value->canonical_cache);
+    assert_string_equal("12", leaf->value.subvalue->value->canonical);
     assert_int_equal(12, leaf->value.subvalue->value->int8);
 
     test_printed_value(&leaf->value, "12", LY_PREF_SCHEMA, NULL);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal("12", value.original);
-    assert_null(value.canonical_cache);
+    assert_string_equal("12", value.canonical);
     assert_non_null(value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 1);
     assert_int_equal(LY_TYPE_INT8, value.subvalue->value->realtype->basetype);
-    assert_string_equal("12", value.subvalue->value->canonical_cache);
+    assert_string_equal("12", value.subvalue->value->canonical);
     assert_int_equal(12, leaf->value.subvalue->value->int8);
     value.realtype->plugin->free(s->ctx, &value);
     lyd_free_all(tree);
@@ -1126,35 +1129,32 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("2", leaf->value.original);
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("2", leaf->value.canonical);
     assert_non_null(leaf->value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 1);
     assert_int_equal(LY_TYPE_UNION, leaf->value.realtype->basetype);
     assert_int_equal(LY_TYPE_STRING, leaf->value.subvalue->value->realtype->basetype);
-    assert_string_equal("2", leaf->value.subvalue->value->canonical_cache);
+    assert_string_equal("2", leaf->value.subvalue->value->canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<un1 xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:fast-ethernet</un1>", LY_SUCCESS, "");
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("x:fast-ethernet", leaf->value.original);
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("defs:fast-ethernet", leaf->value.canonical);
     assert_non_null(leaf->value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 2);
     assert_int_equal(LY_TYPE_UNION, leaf->value.realtype->basetype);
     assert_int_equal(LY_TYPE_IDENT, leaf->value.subvalue->value->realtype->basetype);
-    assert_null(leaf->value.subvalue->value->canonical_cache); /* identityref does not have canonical form */
+    assert_string_equal("defs:fast-ethernet", leaf->value.subvalue->value->canonical);
 
     test_printed_value(&leaf->value, "d:fast-ethernet", LY_PREF_SCHEMA, s->mod_defs);
     test_printed_value(leaf->value.subvalue->value, "d:fast-ethernet", LY_PREF_SCHEMA, s->mod_defs);
 
     value.realtype = leaf->value.realtype;
     assert_int_equal(LY_SUCCESS, value.realtype->plugin->duplicate(s->ctx, &leaf->value, &value));
-    assert_string_equal("x:fast-ethernet", value.original);
-    assert_null(value.canonical_cache);
-    assert_null(value.subvalue->value->canonical_cache);
+    assert_string_equal("defs:fast-ethernet", value.canonical);
+    assert_string_equal("defs:fast-ethernet", value.subvalue->value->canonical);
     assert_non_null(value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 2);
     assert_int_equal(LY_TYPE_IDENT, value.subvalue->value->realtype->basetype);
@@ -1166,13 +1166,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("d:superfast-ethernet", leaf->value.original);
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("d:superfast-ethernet", leaf->value.canonical);
     assert_non_null(leaf->value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 2);
     assert_int_equal(LY_TYPE_UNION, leaf->value.realtype->basetype);
     assert_int_equal(LY_TYPE_STRING, leaf->value.subvalue->value->realtype->basetype);
-    assert_string_equal("d:superfast-ethernet", leaf->value.subvalue->value->canonical_cache);
+    assert_string_equal("d:superfast-ethernet", leaf->value.subvalue->value->canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">y</leaflisttarget>"
@@ -1181,13 +1180,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("/a:leaflisttarget[.='y']", leaf->value.original);
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/types:leaflisttarget[.='y']", leaf->value.canonical);
     assert_non_null(leaf->value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 2);
     assert_int_equal(LY_TYPE_UNION, leaf->value.realtype->basetype);
     assert_int_equal(LY_TYPE_INST, leaf->value.subvalue->value->realtype->basetype);
-    assert_null(leaf->value.subvalue->value->canonical_cache); /* instance-identifier does not have canonical form */
+    assert_string_equal("/types:leaflisttarget[.='y']", leaf->value.subvalue->value->canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget><leaflisttarget xmlns=\"urn:tests:types\">y</leaflisttarget>"
@@ -1196,13 +1194,12 @@
     assert_int_equal(LYS_LEAF, tree->schema->nodetype);
     assert_string_equal("un1", tree->schema->name);
     leaf = (struct lyd_node_term*)tree;
-    assert_string_equal("/a:leaflisttarget[3]", leaf->value.original);
-    assert_null(leaf->value.canonical_cache);
+    assert_string_equal("/a:leaflisttarget[3]", leaf->value.canonical);
     assert_non_null(leaf->value.subvalue->prefix_data);
     assert_int_equal(((struct ly_set *)leaf->value.subvalue->prefix_data)->count, 2);
     assert_int_equal(LY_TYPE_UNION, leaf->value.realtype->basetype);
     assert_int_equal(LY_TYPE_STRING, leaf->value.subvalue->value->realtype->basetype);
-    assert_string_equal("/a:leaflisttarget[3]", leaf->value.subvalue->value->canonical_cache);
+    assert_string_equal("/a:leaflisttarget[3]", leaf->value.subvalue->value->canonical);
     lyd_free_all(tree);
 
     TEST_DATA("<un1 xmlns=\"urn:tests:types\">123456789012345678901</un1>", LY_EVALID, "Invalid union value \"123456789012345678901\" - no matching subtype found. /types:un1");