lyb BUGFIX support for opaque nodes with schema children
Module is printed for all opaque and top-level
nodes. Also, data models are collected from
schema children of opaque nodes.
Fixes cesnet/netopeer2#981
diff --git a/src/parser_lyb.c b/src/parser_lyb.c
index 53e9c1e..51112ca 100644
--- a/src/parser_lyb.c
+++ b/src/parser_lyb.c
@@ -776,8 +776,8 @@
/* register a new subtree */
LY_CHECK_GOTO(ret = lyb_read_start_subtree(lybctx->lybctx), cleanup);
- if (!parent) {
- /* top-level, read module name */
+ if (!parent || !parent->schema) {
+ /* top-level or opaque, read module name */
ret = lyb_parse_model(lybctx->lybctx, lybctx->parse_opts, &mod);
LY_CHECK_GOTO(ret, cleanup);