Skip to content

Commit cbe0ba4

Browse files
committed
use dacite, add a wasm test html file
1 parent b3807e3 commit cbe0ba4

File tree

5 files changed

+280
-88
lines changed

5 files changed

+280
-88
lines changed

airbyte_cdk/models/airbyte_protocol_serializers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from enum import Enum
66
from typing import Any, Callable, Dict, Type, TypeVar, cast
77

8+
import dacite
89
import orjson
910
from pydantic import ValidationError
1011

@@ -71,7 +72,7 @@ def dump(self, obj: T) -> Dict[str, Any]:
7172
def load(self, data: Dict[str, Any]) -> T:
7273
"""Convert dictionary to dataclass instance"""
7374
# Handle custom types
74-
return self.model_class(**data)
75+
return dacite.from_dict(data_class=self.model_class, data=data)
7576

7677
def _serialize_nested(self, obj: Any) -> Any:
7778
"""Helper to serialize nested objects"""

poetry.lock

Lines changed: 20 additions & 87 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ whenever = { version = "^0.6.16", markers = "sys_platform != 'emscripten'"} # T
9191
setuptools = "^80.9.0" # Some connectors depend on this as an undeclared transitive dependency (e.g. source-shopify)
9292
unidecode = "^1.3.8" # IMPORTANT: DO NOT USE. Added to support source-google-sheets migration. This dep is deprecated in favour of `anyascii` and is slated for removal.
9393
dateparser = "^1.2.2"
94+
dacite = "^1.9.2"
9495

9596
[tool.poetry.group.dev.dependencies]
9697
freezegun = "*"

wasm/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"pokemon_name": "pikachu"}

0 commit comments

Comments
 (0)