libyang icon indicating copy to clipboard operation
libyang copied to clipboard

Implicit defaults without validation

Open steweg opened this issue 4 months ago • 2 comments

Hi,

I am currently troubleshooting some issue related the data node creation with implicit default. My working assumption was that adding implicit defaults doesn't trigger any special validations on the rest of the data tree. If needed it will trigger validation of these default nodes only.

But my assumption is apparently wrong. I was not yet able to determine the root-cause and prepare a patch, but I have found a workaround within my application to simply postpone adding of implicit defaults to later stages when the validation step is working correctly (I need to properly perform linking of newly created data with the rest of the existing data tree prior I am adding implicit defaults).

My question to you is whether there was some intention within libyang that adding implicit nodes will revalidate the rest of data tree as well or not? If not, then this can be considered as a kind of bug. If yes, then it might be worth considering adding new option into the API calls, which will allow caller to decide whether or not to perform validation (kind of PARSE_ONLY or STORE_ONLY like flag)

Thanks

steweg avatar Oct 08 '25 10:10 steweg

You would have to include more details about the use-case, but adding implicit nodes should definitely not trigger validation of the whole data tree. There are when conditions evaluated on these new nodes, I think, but probably nothing else.

michalvasko avatar Oct 09 '25 08:10 michalvasko

Hi, I am still not able to get the root-cause of my issue, as I was getting errors related to leafref resolutions, even though I definitely doesn't have any leafref with default setting within model. So it doesn't make sense to me. But I am suspecting that this might not be libyang bug, but rather something with my usage, which somehow resulted in this error.....

steweg avatar Oct 09 '25 09:10 steweg