Skip to content

Commit d62072a

Browse files
committed
fix refs
1 parent 005b079 commit d62072a

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

airbyte_cdk/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
ab_connector_spec_to_string,
5757
ab_message_from_string,
5858
ab_message_to_string,
59+
ab_state_message_to_string,
5960
)
6061
from .well_known_types import (
6162
BinaryData,

airbyte_cdk/models/airbyte_protocol_serializers.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,16 @@ def ab_state_message_from_string(
159159
raise ValueError(f"Failed to decode JSON: {e}") from e
160160

161161

162-
def ab_state_blob_from_string(
163-
state_blob_json: str,
164-
) -> AirbyteStateBlob:
162+
def ab_state_message_to_string(
163+
state: AirbyteStateMessage,
164+
) -> str:
165165
"""
166-
Convert a JSON string to an AirbyteStateBlob.
166+
Convert an AirbyteStateMessage to a JSON string.
167167
168168
Args:
169-
state_blob_json (str): The JSON string to convert.
169+
state (AirbyteStateMessage): The AirbyteStateMessage to convert.
170170
171171
Returns:
172-
AirbyteStateBlob: The deserialized AirbyteStateBlob.
172+
str: JSON string representation of the AirbyteStateMessage.
173173
"""
174-
try:
175-
return AirbyteStateBlob.model_validate_json(state_blob_json)
176-
except ValidationError as e:
177-
raise ValueError(f"Invalid AirbyteStateBlob format: {e}") from e
178-
except orjson.JSONDecodeError as e:
179-
raise ValueError(f"Failed to decode JSON: {e}") from e
174+
return state.model_dump_json()

0 commit comments

Comments
 (0)