Statement "error-message" not supported as an extension substatement
Hi,
migrating to libyang2, I wanted to support an "error-message" substatement for my extension, as it was possible with libyang1.
/* compile supported substatements */
LY_ARRAY_CREATE(cctx->ctx, c_ext->substmts, 1, goto emem);
LY_ARRAY_INCREMENT(c_ext->substmts);
c_ext->substmts[0].stmt = LY_STMT_ERROR_MESSAGE;
c_ext->substmts[0].cardinality = LY_STMT_CARD_OPT;
c_ext->substmts[0].storage = &c_ext->data;
return lys_compile_extension_instance(cctx, p_ext, c_ext);
when calling lys_compile_extension_instance(), i receive the following error :
[ERR] Statement "error-message" is not supported as an extension (found in "ext-cond:my-plugin //name") substatement.
It seems that the switch case LY_STMT_ERROR_MESSAGE is not handled in lys_compile_extension_instance().
Is there a specific reason for that?
I would have thought that the behavior would be similar to LY_STMT_DESCRIPTION, LY_STMT_REFERENCE and LY_STMT_UNITS.
Thanks for your help.
Right, now all the simple statements with a text argument should be parsed successfully. Note that any other can be added if needed but supporting them all is quite a lot of work and unless there are use-cases, it is not worth it.
That's what i thought actually, the simple statements with a text argument should not be a problem, hence the creation of this issue. Thanks a lot for your reactivity!
There is an internal error when calling lyplg_ext_instance_substatements_free() :
ERROR: Internal error (/build/make-pkg/output/source/DIST_LIBYANG/src/tree_schema_free.c:1230)
it seems we forgot to update the switch case in this API.
Right, should be fixed.