schema compile BUGFIX disabled identityref referencing disabled base identity
When validating identityref in a disabled (if-feature false) tree,
referencing a disabled base identity must be fine, but it was reported
as an error.
diff --git a/src/schema_compile.c b/src/schema_compile.c
index e98e4f7..d84db7e 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -457,14 +457,18 @@
}
}
if (!idref || !(*idref)) {
- if (ident) {
+ if (ident || (ctx->options & LYS_COMPILE_DISABLED)) {
/* look into the parsed module to check whether the identity is not merely disabled */
LY_ARRAY_FOR(mod->parsed->identities, v) {
if (!strcmp(mod->parsed->identities[v].name, name)) {
- *enabled = 0;
+ if (ident) {
+ *enabled = 0;
+ }
return LY_SUCCESS;
}
}
+ }
+ if (ident) {
LOGVAL(ctx->ctx, LYVE_SYNTAX_YANG,
"Unable to find base (%s) of identity \"%s\".", bases_p[u], ident->name);
} else {