You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing this into ConnectionHandler.import_connection_data() can mutate the original request. Speficially, endpoints[n].port_id gets renamed to endpoints.id and endpoints[n].vlan becomes endpoints[n].vlan_range.
This is surprising behavior and mutating data like this makes it harder to reason about program behavior. Further, we'll be unable to access the original request, should we need it (such as when needing to look up disallowed VLANs: atlanticwave-sdx/pce#208). Although we still have the data we need in a slightly different form, switching things in this manner is probably not the best way to do this.
(ConnectionHandler._make_port() is the likely culprit. Perhaps using Pydantic to validate connection requests would be a good idea.)
The text was updated successfully, but these errors were encountered:
Consider this connection request:
Passing this into
ConnectionHandler.import_connection_data()
can mutate the original request. Speficially,endpoints[n].port_id
gets renamed toendpoints.id
andendpoints[n].vlan
becomesendpoints[n].vlan_range
.The above code prints:
This is surprising behavior and mutating data like this makes it harder to reason about program behavior. Further, we'll be unable to access the original request, should we need it (such as when needing to look up disallowed VLANs: atlanticwave-sdx/pce#208). Although we still have the data we need in a slightly different form, switching things in this manner is probably not the best way to do this.
(
ConnectionHandler._make_port()
is the likely culprit. Perhaps using Pydantic to validate connection requests would be a good idea.)The text was updated successfully, but these errors were encountered: