plugin instanceid BUGFIX lyplg_type_lypath_new()
diff --git a/src/plugins_types/instanceid.c b/src/plugins_types/instanceid.c
index af54700..591af8e 100644
--- a/src/plugins_types/instanceid.c
+++ b/src/plugins_types/instanceid.c
@@ -159,8 +159,14 @@
     LY_CHECK_GOTO(ret, cleanup);
 
     /* compile instance-identifier into path */
-    ret = lyplg_type_lypath_new(ctx, value, value_len, options, format, prefix_data, ctx_node,
-            unres, &path, err);
+    if (format == LY_VALUE_LYB) {
+        /* The @p value in LYB format is the same as in JSON format. */
+        ret = lyplg_type_lypath_new(ctx, value, value_len, options, LY_VALUE_JSON, prefix_data, ctx_node,
+                unres, &path, err);
+    } else {
+        ret = lyplg_type_lypath_new(ctx, value, value_len, options, format, prefix_data, ctx_node,
+                unres, &path, err);
+    }
     LY_CHECK_GOTO(ret, cleanup);
 
     /* store value */
diff --git a/tests/utests/CMakeLists.txt b/tests/utests/CMakeLists.txt
index 8a506d5..e055745 100644
--- a/tests/utests/CMakeLists.txt
+++ b/tests/utests/CMakeLists.txt
@@ -21,6 +21,7 @@
 ly_add_utest(NAME inet_types   SOURCES types/inet_types.c)
 ly_add_utest(NAME yang_types   SOURCES types/yang_types.c)
 ly_add_utest(NAME enumeration  SOURCES types/enumeration.c)
+ly_add_utest(NAME instanceid   SOURCES types/instanceid.c)
 
 ly_add_utest(NAME range  SOURCES restriction/test_range.c)
 ly_add_utest(NAME pattern  SOURCES restriction/test_pattern.c)
diff --git a/tests/utests/types/instanceid.c b/tests/utests/types/instanceid.c
new file mode 100644
index 0000000..f3c7e5c
--- /dev/null
+++ b/tests/utests/types/instanceid.c
@@ -0,0 +1,70 @@
+/**
+ * @file instanceid.c
+ * @author Adam Piecek <piecek@cesnet.cz>
+ * @brief test for built-in enumeration type
+ *
+ * Copyright (c) 2021 CESNET, z.s.p.o.
+ *
+ * This source code is licensed under BSD 3-Clause License (the "License").
+ * You may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://opensource.org/licenses/BSD-3-Clause
+ */
+
+/* INCLUDE UTEST HEADER */
+#define  _UTEST_MAIN_
+#include "../utests.h"
+
+/* LOCAL INCLUDE HEADERS */
+#include "libyang.h"
+
+#define MODULE_CREATE_YANG(MOD_NAME, NODES) \
+    "module " MOD_NAME " {\n" \
+    "  yang-version 1.1;\n" \
+    "  namespace \"urn:tests:" MOD_NAME "\";\n" \
+    "  prefix pref;\n" \
+    NODES \
+    "}\n"
+
+#define TEST_SUCCESS_LYB(MOD_NAME, NODE_NAME1, DATA1, NODE_NAME2, DATA2) \
+    { \
+        struct lyd_node *tree_1; \
+        struct lyd_node *tree_2; \
+        char *xml_out, *data; \
+        data = "<" NODE_NAME1 " xmlns=\"urn:tests:" MOD_NAME "\">" DATA1 "</" NODE_NAME1 ">" \
+        "<xdf:" NODE_NAME2 " xmlns:xdf=\"urn:tests:" MOD_NAME "\">/xdf:" DATA2 "</xdf:" NODE_NAME2 ">"; \
+        CHECK_PARSE_LYD_PARAM(data, LYD_XML, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, LY_SUCCESS, tree_1); \
+        assert_int_equal(lyd_print_mem(&xml_out, tree_1, LYD_LYB, LYD_PRINT_WITHSIBLINGS), 0); \
+        assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, xml_out, LYD_LYB, LYD_PARSE_ONLY | LYD_PARSE_STRICT, 0, &tree_2)); \
+        assert_non_null(tree_2); \
+        CHECK_LYD(tree_1, tree_2); \
+        free(xml_out); \
+        lyd_free_all(tree_1); \
+        lyd_free_all(tree_2); \
+    }
+
+static void
+test_plugin_lyb(void **UNUSED(state))
+{
+
+#if 0
+    const char *schema;
+
+    schema = MODULE_CREATE_YANG("lyb",
+            "leaf-list leaflisttarget {type string;}"
+            "leaf inst {type instance-identifier {require-instance true;}}");
+    UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL);
+    TEST_SUCCESS_LYB("lyb", "leaflisttarget", "1", "inst", "leaflisttarget[.='1']");
+#endif
+}
+
+int
+main(void)
+{
+    const struct CMUnitTest tests[] = {
+        UTEST(test_plugin_lyb),
+    };
+
+    return cmocka_run_group_tests(tests, NULL, NULL);
+}