JSONXSL plugin error
See original GitHub issueHi,
I am getting below error when trying convert YANG models to XSL schema.
Pyang version: 2.3.2
Command:
pyang --lax-quote-checks -f jsonxsl files/*.yang -o yang.xsl
Error
Traceback (most recent call last):
File "/usr/local/bin/pyang", line 533, in <module>
run()
File "/usr/local/bin/pyang", line 502, in run
emit_obj.emit(ctx, modules, fd)
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 93, in emit
self.process_module(module)
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 113, in process_module
self.process_children(yam, "//nc:*", 1)
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 170, in process_children
self.process_children(ch, p, level + offset)
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 170, in process_children
self.process_children(ch, p, level + offset)
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 170, in process_children
self.process_children(ch, p, level + offset)
[Previous line repeated 1 more time]
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 167, in process_children
self.type_param(ch, ct)
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 175, in type_param
types = self.get_types(node)
File "/usr/local/lib/python3.6/site-packages/pyang/plugins/jsonxsl.py", line 219, in get_types
resolve(node.i_leafref_ptr[0].search_one("type"))
TypeError: 'NoneType' object is not subscriptable
I was also able to overcome the above error by adding simple check like below in jsonxsl.py
function get_types
# if typ.arg == "leafref":
if typ.arg == "leafref" and node.i_leafref_ptr is not None:
resolve(node.i_leafref_ptr[0].search_one("type"))
else:
resolve(typ)
I am not sure if its a bug or intended functionality but with above changes XSL schema gets generated followed by JSON file.
Can anyone please confirm what should be done for this issue?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
JSONXSL plugin needs a valid module · Issue #336 - GitHub
Hi, Am trying to get json from openconfig-bgp and seeing "JSONXSL plugin needs a valid module" error with "-f jsonxsl" argument.
Read more >How to use the pyang.plugin.PyangPlugin function in ... - Snyk
To help you get started, we've selected a few pyang.plugin. ... import json from pyang import plugin, error from pyang.util import unique_prefixes def ......
Read more >pyang.error.err_level Example - Program Talk
Learn how to use python api pyang.error.err_level. ... EmitError("JSONXSL plugin needs a valid module") self.real_prefix = unique_prefixes(ctx) ...
Read more >Convert Yang models to JSON - ConfD User Community
If I try the same command for other yang models that import tailf-common, I get an error, stating that 'JSONXSL plugin needs a...
Read more >How to Fix the Invalid JSON Error in WordPress? - Rank Math
Check the URL Settings of the WordPress Site · Fix the WordPress Permalink Structure · Regenerate WordPress .htaccess File · Check the Themes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rawat-he Hi, I do the modifications as follows,
leaf action-id
in listprogress-report
Closing the issue and thank you @fredgan for your prompt responses.