`wapi.DataType.list()` fails with ValueError: 'text_length' of incorrect type. Expected int, got <class 'NoneType'>
Apparently the wapi/datatype/list endpoint returns datatypes with a text_length field set to None
. This leads to a failing type check in wapi.DataType.
Code to reproduce:
import netdb_client.util
import netdb_client.api32 as api
import netdb_client.api32.wapi as wapi
from pprint import pprint
if __name__ == "__main__":
parser = netdb_client.util.ArgumentParser()
args = parser.parse_args()
endpoint = api.APIEndpoint(**vars(args))
session = api.APISession(endpoint)
ta = [wapi.DataType.list_ta()]
result = session.execute_ta(ta)
pprint(result)
result2 = wapi.DataType.list(session)
pprint(result2)
This gives me the following output from the prod database:
<...>
{'description': 'unsigned time interval',
'format_literal': None,
'json_name': 'string',
'name': 'intervalu',
'operator_list': [],
'text_length': None},
{'description': 'UUID',
'format_literal': None,
'json_name': 'string',
'name': 'uuid',
'operator_list': ['uuid_eq', 'uuid_gt', 'uuid_lt', 'uuid_range'],
'text_length': None}]]
Traceback (most recent call last):
File "/home/jo/KIT/netdoc-doc/netdocdoc/__main__.py", line 18, in <module>
result2 = wapi.DataType.list(session)
File "/home/jo/KIT/netdoc-doc/venv/lib/python3.10/site-packages/netdb_client/api32/wapi.py", line 365, in list
return [cls(**s) for s in res.json()[0]]
File "/home/jo/KIT/netdoc-doc/venv/lib/python3.10/site-packages/netdb_client/api32/wapi.py", line 365, in <listcomp>
return [cls(**s) for s in res.json()[0]]
File "<string>", line 9, in __init__
File "/home/jo/KIT/netdoc-doc/venv/lib/python3.10/site-packages/netdb_client/api32/wapi.py", line 323, in __post_init__
raise ValueError(f"'text_length' of incorrect type. Expected int, got {type(self.text_length)}")
ValueError: 'text_length' of incorrect type. Expected int, got <class 'NoneType'>
This was tested against the current netdb_client from the nightly build artifacts.