Dataclasses better legacy UserService compat (#49)

This commit is contained in:
Otto Winter 2021-06-29 16:07:12 +02:00 committed by GitHub
parent be1a8e1691
commit 29b1902577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -485,9 +485,11 @@ class UserServiceArg(APIModelBase):
ret = []
for x in value:
if isinstance(x, dict):
ret.append(UserServiceArg(x["name"], x["type"]))
if "type_" in x and "type" not in x:
x = {**x, "type": x["type_"]}
ret.append(UserServiceArg.from_dict(x))
else:
ret.append(UserServiceArg(x.name, x.type))
ret.append(UserServiceArg.from_pb(x))
return ret