hawkaa / pygeojson

GeoJSON library for Python with types
8 stars 1 forks source link

Failed to load dict which build from dataclass #16

Open ringsaturn opened 4 years ago

ringsaturn commented 4 years ago
from dataclasses import asdict

from dacite import from_dict
from pygeojson import Point

item = Point(coordinates=[10, 20])
print(item)
item_dict = asdict(item)
print(item_dict)

from_dict(Point, item_dict)

Get error:

dacite.exceptions.UnionMatchError: can not match type "list" to any type of "coordinates" union: typing.Union[typing.Tuple[typing.Union[float, int], typing.Union[float, int]], typing.Tuple[typing.Union[float, int], typing.Union[float, int], typing.Union[float, int]]]