-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I am talking with a varlink service, one of its fields is type ?int when the api returns a payload where this value is null then the python code filters it out, I tracked it down to this block of code:
Line 428 in 885b25e
| if ret != None: |
I'm just trying to understand.
- Why is a null field in a struct not propagated to a client
- How can a client discover all fields and create a valid instance of the object if it doesn't get to know all the fields.
- If it's being sent to the client then it can't be about saving traffic, so why filter it out?
f.ex:
import varlink
with varlink.Client('unix:/tmp/test.sock') as client, client.open('com.example.network') as c:
n = c.Get()
print(type(n))
print(n)Where the interface is:
interface com.example.network
type NetworkSettings (
...
ETH1VLAN_VLAN: ?int,
ETH1VLAN_CIDR_V4: []string,
ETH1VLAN_CIDR_V6: []string,
...
)
method Get() -> (settings: NetworkSettings)
method Set(settings: NetworkSettings) -> ()
method Validate(settings: NetworkSettings) -> ()
I get:
<class 'dict'>
{'settings': {... 'ETH1VLAN_CIDR_V4': [], 'ETH1VLAN_CIDR_V6': [], ...}}
If the value for ETH1VLAN_VLAN is null then the client gets it but filters it out, meaning I cannot discover the key ETH1VLAN_VLAN. If I want to print out the dict I got back, it's not even type NetworkSettings, it's just a plain dict...
Am I using this wrong?
Metadata
Metadata
Assignees
Labels
No labels