Open troymanchester opened 1 month ago
cc @hellt
paging also @dpeachey if he came across choices in his work. I think a YANG choice would/should be oneOf in JSON schema intermediary
Thanks for reporting this issue. I will try to reproduce the mistake and fix it.
I am using pydantify via pydantic-srlinux.
What I'm seeing is that a choice statement in YANG is not being correctly reflected in the pydantic model. The YANG choice statement is resulting in a nested container field.
Here is JSON representation of what an SRLinux device wants:
Here is what the pydantic model wants (in JSON representation):
Generated pydantic classes that illustrate this issue - there is an "action" field of type ActionContainer, and ActionContainer itself has an "action" field which has the choices. I'd expect that the model would not have nested "action" fields like this.
Apologies if this is the wrong place raise this - I am not 100% certain this is pydantify, this could be a problem w/ pyang or it could be an issue w/ the YANG files I'm using, but I'm not familiar enough w/ all the different pieces yet to determine where something is going wrong.
Breadcrumbs: