@@ -364,7 +364,7 @@ schema_mount_create_ctx(const struct lysc_ext_instance *ext, const struct lyd_no
364364 * @param[in] ext_data Extension data retrieved by the callback with the yang-library data.
365365 * @param[in] parent Optional data parent to use.
366366 * @param[in] shared Whether the 'mount-point' is shared or inline.
367- * @param[out] ext_yl_data Data tree 'yang-library' of @p ext.
367+ * @param[out] ext_yl_data Data tree 'yang-library' of @p ext, NULL if none found .
368368 * @return LY_ERR value.
369369 */
370370static LY_ERR
@@ -411,13 +411,6 @@ schema_mount_get_yanglib(const struct lysc_ext_instance *ext, const struct lyd_n
411411 }
412412 }
413413
414- if (!* ext_yl_data ) {
415- lyplg_ext_compile_log (NULL , ext , LY_LLERR , LY_EVALID , "Could not find 'yang-library' data in \"%s\"." ,
416- parent_path ? parent_path : "<top-level>" );
417- rc = LY_EVALID ;
418- goto cleanup ;
419- }
420-
421414cleanup :
422415 free (parent_path );
423416 ly_set_free (set , NULL );
@@ -464,7 +457,7 @@ schema_mount_get_content_id(struct lysc_ext_instance *ext, const struct lyd_node
464457 * @param[in] ext Compiled extension instance.
465458 * @param[in] ext_data Extension data retrieved by the callback.
466459 * @param[in] config Whether the whole schema should keep its config or be set to false.
467- * @param[out] ext_ctx Schema to use for parsing the data.
460+ * @param[out] ext_ctx Created/found context. If not set, no yang-library data are not considered an error .
468461 * @return LY_ERR value.
469462 */
470463static LY_ERR
@@ -478,6 +471,7 @@ schema_mount_get_ctx_shared(struct lysc_ext_instance *ext, const struct lyd_node
478471 uint32_t i ;
479472 const char * content_id ;
480473 void * mem ;
474+ char * path ;
481475
482476 assert (sm_data && sm_data -> shared );
483477
@@ -489,6 +483,15 @@ schema_mount_get_ctx_shared(struct lysc_ext_instance *ext, const struct lyd_node
489483 if ((r = schema_mount_get_yanglib (ext , ext_data , NULL , 1 , & ext_yl_data ))) {
490484 return r ;
491485 }
486+ if (!ext_yl_data ) {
487+ if (ext_ctx ) {
488+ path = lysc_path (ext -> parent , LYSC_PATH_DATA , NULL , 0 );
489+ lyplg_ext_compile_log (NULL , ext , LY_LLERR , LY_EVALID , "Could not find 'yang-library' data in \"%s\"." , path );
490+ free (path );
491+ rc = LY_EVALID ;
492+ }
493+ goto cleanup ;
494+ }
492495
493496 /* get yang-library content-id or module-set-id */
494497 if ((r = schema_mount_get_content_id (ext , ext_yl_data , & content_id ))) {
@@ -824,6 +827,10 @@ schema_mount_get_ctx_inline(struct lysc_ext_instance *ext, const struct lyd_node
824827 if ((r = schema_mount_get_yanglib (ext , ext_data , NULL , 0 , & ext_yl_data ))) {
825828 rc = r ;
826829 goto cleanup ;
830+ } else if (!ext_yl_data ) {
831+ lyplg_ext_compile_log (NULL , ext , LY_LLERR , LY_EVALID , "Could not find 'yang-library' data in \"<top-level>\"." );
832+ rc = LY_EVALID ;
833+ goto cleanup ;
827834 }
828835
829836 /* new schema required, create context */
@@ -1328,6 +1335,7 @@ lyplg_ext_schema_mount_create_context(const struct lysc_ext_instance *ext, const
13281335 uint32_t i ;
13291336 ly_ext_data_clb ext_data_clb ;
13301337 const struct lyd_node * ext_yl_data ;
1338+ char * path ;
13311339
13321340 LY_CHECK_ARG_RET (NULL , ext , ctx , LY_EINVAL );
13331341
@@ -1392,6 +1400,12 @@ lyplg_ext_schema_mount_create_context(const struct lysc_ext_instance *ext, const
13921400 /* find 'yang-library' data */
13931401 if ((rc = schema_mount_get_yanglib (ext , ext_data , parent , shared , & ext_yl_data ))) {
13941402 goto cleanup ;
1403+ } else if (!ext_yl_data ) {
1404+ path = lyd_path (parent , LYD_PATH_STD , NULL , 0 );
1405+ lyplg_ext_compile_log (NULL , ext , LY_LLERR , LY_EVALID , "Could not find 'yang-library' data in \"%s\"." , path );
1406+ free (path );
1407+ rc = LY_EVALID ;
1408+ goto cleanup ;
13951409 }
13961410
13971411 /* create the context */
0 commit comments