libyang icon indicating copy to clipboard operation
libyang copied to clipboard

LYD_OPT_OBSOLETE equivalence for libyang2

Open Haititi opened this issue 3 years ago • 3 comments

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().

Haititi avatar Aug 16 '22 10:08 Haititi

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?

michalvasko avatar Aug 17 '22 09:08 michalvasko

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.

Haititi avatar Aug 17 '22 09:08 Haititi

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.

michalvasko avatar Aug 17 '22 10:08 michalvasko