-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
instanceInstance issues, bugs and feature requestsInstance issues, bugs and feature requestspriority:highestBugs filled by customers, security issuesBugs filled by customers, security issues
Description
Description
When calling list_ips_all()
to retrieve the list of IPs for my instances, the following code fails with a TypeError
:
api = InstanceV1API(client)
return api.list_ips_all(organization=org_id, zone=DEFAULT_ZONE)
The error traceback is:
TypeError: Ip.__init__() missing 1 required positional argument: 'prefix'
Cause
The API response can include IP objects with a null
value for the prefix
field:
{
"ips": [
{
"id": "<REDACTED>",
"address": "<REDACTED>",
"prefix": null,
...
}
]
}
The unmarshal_Ip
function seems to handle this case gracefully:
def unmarshal_Ip(data: Any) -> Ip: |
However, the corresponding dataclass for Ip
does not define prefix
as optional:
class Ip: |
Suggested Fix
Update the Ip
dataclass to make prefix
optional:
prefix: Optional[int] = None
This should resolve the TypeError
when the field is null
in the response.
Metadata
Metadata
Labels
instanceInstance issues, bugs and feature requestsInstance issues, bugs and feature requestspriority:highestBugs filled by customers, security issuesBugs filled by customers, security issues