Skip to content

Generate API error "KeyError: 'schema_node_id'" #133

@AlbrechtL

Description

@AlbrechtL

Thanks for this great tool!

Today I tried to generate an OpenAPI API with the "Generate API" function. Unfortunately this doesn't work (see screenshot below) and python is throwing the error KeyError: 'schema_node_id'. I'm using the one docker solution in the latest version.

Screenshot
Image

Docker logs

[30/Oct/2025 14:41:31] ERROR [django.request:246] Internal Server Error: /restconf/genswag/
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/asgiref/sync.py", line 552, in thread_handler
    raise exc_info[1]
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 42, in inner
    response = await get_response(request)
  File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 253, in _get_response_async
    response = await wrapped_callback(
  File "/usr/local/lib/python3.10/site-packages/asgiref/sync.py", line 502, in __call__
    ret = await asyncio.shield(exec_coro)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/asgiref/sync.py", line 556, in thread_handler
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapper_view
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/ysrestconf/views.py", line 151, in gen_swag
    swagobj = generate_swagger(req)
  File "/usr/local/lib/python3.10/site-packages/ysrestconf/restconf.py", line 138, in generate_swagger
    return get_restconf_parser(ysmodels, **request)
  File "/usr/local/lib/python3.10/site-packages/ysrestconf/restconf.py", line 79, in get_restconf_parser
    node_ids = [node['schema_node_id'] for node in nodes]
  File "/usr/local/lib/python3.10/site-packages/ysrestconf/restconf.py", line 79, in <listcomp>
    node_ids = [node['schema_node_id'] for node in nodes]
KeyError: 'schema_node_id'
192.168.200.1:49746 - - [30/Oct/2025:14:41:31] "GET /restconf/genswag/?yangset=developer:VLAN&models=openconfig-vlan&nodes=%7B%22module%22:%22openconfig-vlan%22,%22revision%22:%222023-02-07%22,%22revision_info%22:%22Remove+prefix+from+enums+in+when+statements%22,%22description%22:%22This+module+defines+configuration+and+state+variables+for+VLANs,%5Cnin+addition+to+VLAN+parameters+associated+with+interfaces%22,%22organization%22:%22OpenConfig+working+group%22,%22imports%22:[%22openconfig-vlan-types%22,%22openconfig-interfaces%22,%22openconfig-if-ethernet%22,%22openconfig-if-aggregate%22,%22iana-if-type%22,%22openconfig-extensions%22],%22namespace%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Fvlan%22,%22prefix%22:%22oc-vlan%22,%22namespace_prefixes%22:%7B%22ianaift%22:%22urn:ietf:params:xml:ns:yang:iana-if-type%22,%22oc-eth%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Finterfaces%2Fethernet%22,%22oc-ext%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Fopenconfig-ext%22,%22oc-if%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Finterfaces%22,%22oc-lag%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Finterfaces%2Faggregate%22,%22oc-vlan%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Fvlan%22,%22oc-vlan-types%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Fvlan-types%22,%22oc-yang%22:%22http:%2F%2Fopenconfig.net%2Fyang%2Ftypes%2Fyang%22%7D,%22modtype%22:%22module%22,%22operations%22:[]%7D&host=192.168.200.108:8480&device=testdevice&depthlimit=1&custommediatypes=" 500 145
192.168.200.1:49746 - - [30/Oct/2025:14:41:32] "GET /restconf/getmediatypes" 301 -
192.168.200.1:49746 - - [30/Oct/2025:14:41:32] "GET /restconf/getmediatypes/" 200 85

Update
It seems that the openconfig-vlan yang module is not supported (see picture below).

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions