Skip to content

Comments

schema: check parsed object before use#167

Merged
samuel-gauthier merged 1 commit intoCESNET:masterfrom
jeremie6wind:master
Feb 20, 2026
Merged

schema: check parsed object before use#167
samuel-gauthier merged 1 commit intoCESNET:masterfrom
jeremie6wind:master

Conversation

@jeremie6wind
Copy link
Contributor

With libyang/sysrepo 4 and printed contexts, the parsed object can be null.
Check the parsed object before using it.
If the parsed object is missing:

  • Module methods won't yield anything.
  • ExtensionParsed _module_from_parsed raises an exception.
  • SNode if_features won't yield anything.
  • Create a Type object without the parsed type.
  • The Container presence returns None.
  • For list and leaflist order, return the info from the compiled object.

Fixes: 0a4b09f ("cffi: allows to usage of libyang v4")

@jeremie6wind jeremie6wind force-pushed the master branch 5 times, most recently from c6a457f to 63cb3b6 Compare February 20, 2026 16:50
In libyang4, when dealing with printed contexts, cdata_parsed is not
set.
Check it before using it to get the node type.

Fixes: 0a4b09f ("cffi: allows to usage of libyang v4")
Signed-off-by: Jeremie Leska <jeremie.leska@6wind.com>
@samuel-gauthier samuel-gauthier merged commit a69eb4a into CESNET:master Feb 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants