validation CHANGE leafref validation fix
diff --git a/src/validation.c b/src/validation.c
index 72f1a41..d9ad265 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -73,7 +73,13 @@
if (unres_data_add(unres, (struct lyd_node *)node, UNRES_UNION)) {
return 1;
}
- } else if ((((struct lys_node_leaf *)leaf->schema)->type.base == LY_TYPE_LEAFREF) && (leaf->validity & LYD_VAL_LEAFREF)) {
+ } else if ((((struct lys_node_leaf *)leaf->schema)->type.base == LY_TYPE_LEAFREF)
+ && ((leaf->validity & LYD_VAL_LEAFREF) || (leaf->value_flags & LY_VALUE_UNRES))) {
+ /* always retry validation on unres leafrefs, if again not possible, the correct flags should
+ * be set and the leafref will be kept unresolved */
+ leaf->value_flags &= ~LY_VALUE_UNRES;
+ leaf->validity |= LYD_VAL_LEAFREF;
+
if (unres_data_add(unres, (struct lyd_node *)node, UNRES_LEAFREF)) {
return 1;
}