Data Modelling #1441
Kircheneer
started this conversation in
Ideas
Data Modelling
#1441
Replies: 1 comment 7 replies
-
As type hints for NXOS have now landed in this repository it might be worth it having this discussion before going through with type hinting for the other drivers, otherwise that would be duplicated work. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Between the open type hinting PR #1434 and a short discussion on the Network-to-Code slack server NAPALM channel I got thinking whether it would be best to model the data returned by NAPALM (here) using Pydantic. Currently it is modelled using
typing.TypedDict
.Advantages
From my point of view, Pydantic would offer the following advantages:
pydantic.BaseModel
can be nested (in contrast totyping.TypedDict
)The BaseModel class also supports the annotations field, which should allow for a rather easy migration from TypedDict to BaseModel in regards to the model testing code.
Downsides
As such a change would have to be implemented in every getter method of all the drivers, one of the following things would be needed:
Beta Was this translation helpful? Give feedback.
All reactions