libyang
libyang copied to clipboard
LYD_OPT_OBSOLETE equivalence for libyang2
Hi!
In libyang 1.x, LYD_OPT_OBSOLETE option allowed to return an error instead of a warning during validation with lyd_validate() in case an obsolete statement was used.
Is there a way to do the same thing in libyang 2.x ? I couldn't find any similar option to use with lyd_validate_all().
This feature has been removed and they are always warnings now. The RFC says only that the data SHOULD NOT be instantiated. Do you really need an error?
Well, i'm actually working on a cli that provides some kind of "validate" command which would check if some obsolete definitions were used depending on user input. This flag would be helpful.
I think there was more to this and an actual reason why the flag was causing problems. In any case, you can always look for the warning to detect that such data were instantiated. Using a logging callback, for example.