schema compile BUGFIX skip list key check for groupings
... without explicit config since they may end up
state-only.
Fixes #1813
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index f052184..5037876 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -3202,6 +3202,7 @@
struct lysp_node_list *list_p = (struct lysp_node_list *)pnode;
struct lysc_node_list *list = (struct lysc_node_list *)node;
struct lysp_node *child_p;
+ struct lysc_node *parent;
struct lysc_node_leaf *key, *prev_key = NULL;
size_t len;
const char *keystr, *delim;
@@ -3224,9 +3225,22 @@
LY_CHECK_GOTO(ret, done);
/* keys */
- if ((list->flags & LYS_CONFIG_W) && (!list_p->key || !list_p->key[0])) {
- LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Missing key in list representing configuration data.");
- return LY_EVALID;
+ if (list->flags & LYS_CONFIG_W) {
+ parent = node;
+ if (ctx->compile_opts & LYS_COMPILE_GROUPING) {
+ /* compiling individual grouping, we can check this only if there is an explicit config set */
+ while (parent) {
+ if (parent->flags & LYS_SET_CONFIG) {
+ break;
+ }
+ parent = parent->parent;
+ }
+ }
+
+ if (parent && (!list_p->key || !list_p->key[0])) {
+ LOGVAL(ctx->ctx, LYVE_SEMANTICS, "Missing key in list representing configuration data.");
+ return LY_EVALID;
+ }
}
/* find all the keys (must be direct children) */