Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/feature_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/road_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/surface_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/topography_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/tree_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/tree_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
1 change: 1 addition & 0 deletions fastfuels_sdk/client_library/models/water_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def to_dict(self) -> Dict[str, Any]:
])

_dict = self.model_dump(
mode='json',
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
Expand Down
27 changes: 27 additions & 0 deletions tests/test_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,33 @@ def test_to_json_clean_geometry_serialization(self, test_domain):
assert "one_of_schemas" not in geometry
assert "discriminator_value_class_map" not in geometry

def test_to_json_datetime_serialization(self, test_domain):
"""Test that datetime fields are properly serialized as ISO 8601 strings."""
from datetime import datetime

result = test_domain.to_json()
parsed = json.loads(result)

# Verify datetime fields exist and are strings (not datetime objects)
assert "createdOn" in parsed
assert "modifiedOn" in parsed
assert isinstance(parsed["createdOn"], str)
assert isinstance(parsed["modifiedOn"], str)

# Verify they are valid ISO 8601 format by parsing them back
created_dt = datetime.fromisoformat(parsed["createdOn"].replace("Z", "+00:00"))
modified_dt = datetime.fromisoformat(
parsed["modifiedOn"].replace("Z", "+00:00")
)

assert isinstance(created_dt, datetime)
assert isinstance(modified_dt, datetime)

# Verify the parsed datetime values match the original (accounting for timezone)
# Compare timestamp values to handle timezone differences
assert abs((created_dt.timestamp() - test_domain.created_on.timestamp())) < 1
assert abs((modified_dt.timestamp() - test_domain.modified_on.timestamp())) < 1


class TestDomainToGeoDataFrame:
"""Test suite for Domain.to_geodataframe() method."""
Expand Down
Loading