Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger plugin fails if a augment has more than 3 hierarchy in the path #310

Open
PrathibaJee opened this issue Jun 24, 2024 · 0 comments
Open

Comments

@PrathibaJee
Copy link

If a yang module has augment statement with more than 3 hierarchy in the path , then yang2swagger produces the following issue ,

(env) [xxxxxx@xxxxxxxx YangJsonTools]$ pyang --plugindir $PYBINDPLUGIN -f swagger -p input/ -o export/onf.json input/equipment-augment-1-0.yang
Traceback (most recent call last):
  File "/home/stdapp/YANG2SWAGGER/onmi-iisomi-uml-common/YangJsonTools/env/bin/pyang", line 8, in <module>
    sys.exit(run())
  File "/home/stdapp/YANG2SWAGGER/onmi-iisomi-uml-common/YangJsonTools/env/lib/python3.6/site-packages/pyang/scripts/pyang_tool.py", line 548, in run
    emit_obj.emit(ctx, modules, fd)
  File "/home/stdapp/YANG2SWAGGER/onmi-iisomi-uml-common/YangJsonTools/swagger.py", line 103, in emit
    emit_swagger_spec(ctx, modules, fd, ctx.opts.path)
  File "/home/stdapp/YANG2SWAGGER/onmi-iisomi-uml-common/YangJsonTools/swagger.py", line 180, in emit_swagger_spec
    genAugmentedStatements(ctx, augments, definitions, model['paths'])
  File "/home/stdapp/YANG2SWAGGER/onmi-iisomi-uml-common/YangJsonTools/swagger.py", line 205, in genAugmentedStatements
    for api in apis:
RuntimeError: OrderedDict mutated during iteration

Details :

The equipment-augment-1-0.yang which I m trying to translate has 4 augment statements.
The below augment statement in the YANG is causing this problem which has 5 hierarchy in its path ,

augment "/core-model:control-construct/core-model:equipment/core-model:actual-equipment/core-model:manufactured-thing/core-model:equipment-type" {
    description
      "none";
    uses equipment-type-spec;
  }

After removing this augment statement , I could able to generate swagger2.0 yaml file.

Note : The mentioned path in the yang is valid(validated with pyang and able to generate pyang tree)

Please let us know whether this is an issue in the YANG2Swagger tool. If so , kindly please let us know is it possible to fix.
Many thanks.

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

No branches or pull requests

1 participant