From 1326f90d9a1c8be07adacd5a552fcb5281391302 Mon Sep 17 00:00:00 2001 From: Datata1 <> Date: Sat, 7 Feb 2026 14:48:31 +0100 Subject: [PATCH 1/7] feat(model-export): provide model methods to export data --- pyproject.toml | 1 + src/codesphere/core/base.py | 136 +++++++++++++++++++++++++++++- tests/core/test_base.py | 160 +++++++++++++++++++++++++++++++++++- uv.lock | 2 + 4 files changed, 297 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6377bcf..13e085d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ dependencies = [ "pydantic-settings>=2.11.0", "python-dateutil>=2.9.0.post0", "python-dotenv>=1.2.1", + "pyyaml>=6.0.2", "typing-extensions>=4.14.0", "urllib3>=2.4.0", ] diff --git a/src/codesphere/core/base.py b/src/codesphere/core/base.py index aff6a6f..3d00fbf 100644 --- a/src/codesphere/core/base.py +++ b/src/codesphere/core/base.py @@ -1,4 +1,5 @@ -from typing import Generic, List, TypeVar +from typing import Any, Generic, List, TypeVar + from pydantic import BaseModel, ConfigDict, RootModel from pydantic.alias_generators import to_camel @@ -20,6 +21,68 @@ class CamelModel(BaseModel): serialize_by_alias=True, ) + def to_dict( + self, *, by_alias: bool = True, exclude_none: bool = False + ) -> dict[str, Any]: + """Export model as a Python dictionary. + + Args: + by_alias: Use camelCase keys (API format) if True, snake_case if False. + exclude_none: Exclude fields with None values if True. + + Returns: + Dictionary representation of the model. + """ + return self.model_dump(by_alias=by_alias, exclude_none=exclude_none) + + def to_json( + self, + *, + by_alias: bool = True, + exclude_none: bool = False, + indent: int | None = None, + ) -> str: + """Export model as a JSON string. + + Args: + by_alias: Use camelCase keys (API format) if True, snake_case if False. + exclude_none: Exclude fields with None values if True. + indent: Number of spaces for indentation. None for compact output. + + Returns: + JSON string representation of the model. + """ + return self.model_dump_json( + by_alias=by_alias, exclude_none=exclude_none, indent=indent + ) + + def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: + """Export model as a YAML string. + + Requires PyYAML to be installed (optional dependency). + + Args: + by_alias: Use camelCase keys (API format) if True, snake_case if False. + exclude_none: Exclude fields with None values if True. + + Returns: + YAML string representation of the model. + + Raises: + ImportError: If PyYAML is not installed. + """ + try: + import yaml + except ImportError: + raise ImportError( + "PyYAML is required for YAML export. " + "Install it with: pip install pyyaml" + ) + data = self.to_dict(by_alias=by_alias, exclude_none=exclude_none) + return yaml.dump( + data, default_flow_style=False, allow_unicode=True, sort_keys=False + ) + class ResourceList(RootModel[List[ModelT]], Generic[ModelT]): root: List[ModelT] @@ -32,3 +95,74 @@ def __getitem__(self, item): def __len__(self): return len(self.root) + + def to_list( + self, *, by_alias: bool = True, exclude_none: bool = False + ) -> list[dict[str, Any]]: + """Export all items as a list of dictionaries. + + Args: + by_alias: Use camelCase keys (API format) if True, snake_case if False. + exclude_none: Exclude fields with None values if True. + + Returns: + List of dictionary representations. + """ + return [ + item.model_dump(by_alias=by_alias, exclude_none=exclude_none) + if hasattr(item, "model_dump") + else item + for item in self.root + ] + + def to_json( + self, + *, + by_alias: bool = True, + exclude_none: bool = False, + indent: int | None = None, + ) -> str: + """Export all items as a JSON array string. + + Args: + by_alias: Use camelCase keys (API format) if True, snake_case if False. + exclude_none: Exclude fields with None values if True. + indent: Number of spaces for indentation. None for compact output. + + Returns: + JSON array string representation. + """ + import json + + return json.dumps( + self.to_list(by_alias=by_alias, exclude_none=exclude_none), indent=indent + ) + + def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: + """Export all items as a YAML string. + + Requires PyYAML to be installed (optional dependency). + + Args: + by_alias: Use camelCase keys (API format) if True, snake_case if False. + exclude_none: Exclude fields with None values if True. + + Returns: + YAML string representation. + + Raises: + ImportError: If PyYAML is not installed. + """ + try: + import yaml + except ImportError: + raise ImportError( + "PyYAML is required for YAML export. " + "Install it with: pip install pyyaml" + ) + return yaml.dump( + self.to_list(by_alias=by_alias, exclude_none=exclude_none), + default_flow_style=False, + allow_unicode=True, + sort_keys=False, + ) diff --git a/tests/core/test_base.py b/tests/core/test_base.py index 2b7710b..9e4c29a 100644 --- a/tests/core/test_base.py +++ b/tests/core/test_base.py @@ -1,7 +1,7 @@ -import pytest from dataclasses import dataclass from unittest.mock import MagicMock +import pytest from pydantic import BaseModel from codesphere.core.base import CamelModel, ResourceBase, ResourceList @@ -91,6 +91,96 @@ class SampleModel(CamelModel): assert model.is_private is False +class TestCamelModelExport: + """Tests for CamelModel export methods.""" + + def test_to_dict_default(self): + """to_dict should export with camelCase keys by default.""" + + class SampleModel(CamelModel): + team_id: int + user_name: str + + model = SampleModel(team_id=1, user_name="test") + result = model.to_dict() + + assert result == {"teamId": 1, "userName": "test"} + + def test_to_dict_snake_case(self): + """to_dict with by_alias=False should export with snake_case keys.""" + + class SampleModel(CamelModel): + team_id: int + user_name: str + + model = SampleModel(team_id=1, user_name="test") + result = model.to_dict(by_alias=False) + + assert result == {"team_id": 1, "user_name": "test"} + + def test_to_dict_exclude_none(self): + """to_dict with exclude_none=True should omit None values.""" + + class SampleModel(CamelModel): + team_id: int + optional_field: str | None = None + + model = SampleModel(team_id=1, optional_field=None) + result = model.to_dict(exclude_none=True) + + assert result == {"teamId": 1} + assert "optionalField" not in result + + def test_to_json_default(self): + """to_json should export as JSON string with camelCase keys.""" + + class SampleModel(CamelModel): + team_id: int + + model = SampleModel(team_id=42) + result = model.to_json() + + assert result == '{"teamId":42}' + + def test_to_json_with_indent(self): + """to_json with indent should format output.""" + + class SampleModel(CamelModel): + team_id: int + + model = SampleModel(team_id=42) + result = model.to_json(indent=2) + + assert '"teamId": 42' in result + assert "\n" in result + + def test_to_yaml_import_error(self): + """to_yaml should raise ImportError if PyYAML is not installed.""" + import sys + from unittest.mock import patch + + class SampleModel(CamelModel): + team_id: int + + model = SampleModel(team_id=1) + + with patch.dict(sys.modules, {"yaml": None}): + # Force reimport to trigger ImportError + with pytest.raises(ImportError, match="PyYAML is required"): + # We need to actually make the import fail + import builtins + + original_import = builtins.__import__ + + def mock_import(name, *args, **kwargs): + if name == "yaml": + raise ImportError("No module named 'yaml'") + return original_import(name, *args, **kwargs) + + with patch.object(builtins, "__import__", mock_import): + model.to_yaml() + + class TestResourceList: def test_create_with_list(self): """ResourceList should be created with a list of items.""" @@ -150,6 +240,74 @@ class Item(BaseModel): assert list(resource_list) == [] +class TestResourceListExport: + """Tests for ResourceList export methods.""" + + def test_to_list_default(self): + """to_list should export items as list of dicts with camelCase keys.""" + + class Item(CamelModel): + item_id: int + item_name: str + + items = [Item(item_id=1, item_name="a"), Item(item_id=2, item_name="b")] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_list() + + assert result == [ + {"itemId": 1, "itemName": "a"}, + {"itemId": 2, "itemName": "b"}, + ] + + def test_to_list_snake_case(self): + """to_list with by_alias=False should use snake_case keys.""" + + class Item(CamelModel): + item_id: int + + items = [Item(item_id=1)] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_list(by_alias=False) + + assert result == [{"item_id": 1}] + + def test_to_json_default(self): + """to_json should export as JSON array string.""" + + class Item(CamelModel): + item_id: int + + items = [Item(item_id=1), Item(item_id=2)] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_json() + + assert result == '[{"itemId": 1}, {"itemId": 2}]' + + def test_to_json_with_indent(self): + """to_json with indent should format output.""" + + class Item(CamelModel): + item_id: int + + items = [Item(item_id=1)] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_json(indent=2) + + assert "\n" in result + assert '"itemId": 1' in result + + def test_to_list_empty(self): + """to_list should handle empty lists.""" + + class Item(CamelModel): + item_id: int + + resource_list = ResourceList[Item](root=[]) + result = resource_list.to_list() + + assert result == [] + + class TestResourceBase: def test_initialization_with_http_client(self): """ResourceBase should store the HTTP client.""" diff --git a/uv.lock b/uv.lock index e78960d..85701eb 100644 --- a/uv.lock +++ b/uv.lock @@ -163,6 +163,7 @@ dependencies = [ { name = "pydantic-settings" }, { name = "python-dateutil" }, { name = "python-dotenv" }, + { name = "pyyaml" }, { name = "typing-extensions" }, { name = "urllib3" }, ] @@ -191,6 +192,7 @@ requires-dist = [ { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=6.2.1" }, { name = "python-dateutil", specifier = ">=2.9.0.post0" }, { name = "python-dotenv", specifier = ">=1.2.1" }, + { name = "pyyaml", specifier = ">=6.0.2" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.11.13" }, { name = "typing-extensions", specifier = ">=4.14.0" }, { name = "urllib3", specifier = ">=2.4.0" }, From e23dd98d96b41b35a66aee468cd14a5a0a2a01fe Mon Sep 17 00:00:00 2001 From: Jan-David Wiederstein <141321444+Datata1@users.noreply.github.com> Date: Sat, 7 Feb 2026 14:51:06 +0100 Subject: [PATCH 2/7] Update tests/core/test_base.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/core/test_base.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/tests/core/test_base.py b/tests/core/test_base.py index 9e4c29a..8be5003 100644 --- a/tests/core/test_base.py +++ b/tests/core/test_base.py @@ -165,22 +165,8 @@ class SampleModel(CamelModel): model = SampleModel(team_id=1) with patch.dict(sys.modules, {"yaml": None}): - # Force reimport to trigger ImportError with pytest.raises(ImportError, match="PyYAML is required"): - # We need to actually make the import fail - import builtins - - original_import = builtins.__import__ - - def mock_import(name, *args, **kwargs): - if name == "yaml": - raise ImportError("No module named 'yaml'") - return original_import(name, *args, **kwargs) - - with patch.object(builtins, "__import__", mock_import): - model.to_yaml() - - + model.to_yaml() class TestResourceList: def test_create_with_list(self): """ResourceList should be created with a list of items.""" From 700ff10d654882dc08a7247e97813d3e3c523584 Mon Sep 17 00:00:00 2001 From: Datata1 <> Date: Sat, 7 Feb 2026 14:57:10 +0100 Subject: [PATCH 3/7] adress pr feedback --- src/codesphere/core/base.py | 29 ++--------------------- tests/core/test_base.py | 46 +++++++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/codesphere/core/base.py b/src/codesphere/core/base.py index 3d00fbf..0baacbb 100644 --- a/src/codesphere/core/base.py +++ b/src/codesphere/core/base.py @@ -1,12 +1,13 @@ from typing import Any, Generic, List, TypeVar +import yaml from pydantic import BaseModel, ConfigDict, RootModel from pydantic.alias_generators import to_camel from ..http_client import APIHttpClient from .handler import _APIOperationExecutor -ModelT = TypeVar("ModelT") +ModelT = TypeVar("ModelT", bound=BaseModel) class ResourceBase(_APIOperationExecutor): @@ -59,25 +60,13 @@ def to_json( def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: """Export model as a YAML string. - Requires PyYAML to be installed (optional dependency). - Args: by_alias: Use camelCase keys (API format) if True, snake_case if False. exclude_none: Exclude fields with None values if True. Returns: YAML string representation of the model. - - Raises: - ImportError: If PyYAML is not installed. """ - try: - import yaml - except ImportError: - raise ImportError( - "PyYAML is required for YAML export. " - "Install it with: pip install pyyaml" - ) data = self.to_dict(by_alias=by_alias, exclude_none=exclude_none) return yaml.dump( data, default_flow_style=False, allow_unicode=True, sort_keys=False @@ -110,8 +99,6 @@ def to_list( """ return [ item.model_dump(by_alias=by_alias, exclude_none=exclude_none) - if hasattr(item, "model_dump") - else item for item in self.root ] @@ -141,25 +128,13 @@ def to_json( def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: """Export all items as a YAML string. - Requires PyYAML to be installed (optional dependency). - Args: by_alias: Use camelCase keys (API format) if True, snake_case if False. exclude_none: Exclude fields with None values if True. Returns: YAML string representation. - - Raises: - ImportError: If PyYAML is not installed. """ - try: - import yaml - except ImportError: - raise ImportError( - "PyYAML is required for YAML export. " - "Install it with: pip install pyyaml" - ) return yaml.dump( self.to_list(by_alias=by_alias, exclude_none=exclude_none), default_flow_style=False, diff --git a/tests/core/test_base.py b/tests/core/test_base.py index 8be5003..b060226 100644 --- a/tests/core/test_base.py +++ b/tests/core/test_base.py @@ -1,3 +1,4 @@ +import json from dataclasses import dataclass from unittest.mock import MagicMock @@ -140,7 +141,7 @@ class SampleModel(CamelModel): model = SampleModel(team_id=42) result = model.to_json() - assert result == '{"teamId":42}' + assert json.loads(result) == {"teamId": 42} def test_to_json_with_indent(self): """to_json with indent should format output.""" @@ -151,22 +152,34 @@ class SampleModel(CamelModel): model = SampleModel(team_id=42) result = model.to_json(indent=2) - assert '"teamId": 42' in result + assert json.loads(result) == {"teamId": 42} assert "\n" in result - def test_to_yaml_import_error(self): - """to_yaml should raise ImportError if PyYAML is not installed.""" - import sys - from unittest.mock import patch + def test_to_yaml_default(self): + """to_yaml should export as YAML string with camelCase keys.""" + + class SampleModel(CamelModel): + team_id: int + user_name: str + + model = SampleModel(team_id=1, user_name="test") + result = model.to_yaml() + + assert "teamId: 1" in result + assert "userName: test" in result + + def test_to_yaml_snake_case(self): + """to_yaml with by_alias=False should use snake_case keys.""" class SampleModel(CamelModel): team_id: int model = SampleModel(team_id=1) + result = model.to_yaml(by_alias=False) + + assert "team_id: 1" in result + - with patch.dict(sys.modules, {"yaml": None}): - with pytest.raises(ImportError, match="PyYAML is required"): - model.to_yaml() class TestResourceList: def test_create_with_list(self): """ResourceList should be created with a list of items.""" @@ -267,7 +280,7 @@ class Item(CamelModel): resource_list = ResourceList[Item](root=items) result = resource_list.to_json() - assert result == '[{"itemId": 1}, {"itemId": 2}]' + assert json.loads(result) == [{"itemId": 1}, {"itemId": 2}] def test_to_json_with_indent(self): """to_json with indent should format output.""" @@ -293,6 +306,19 @@ class Item(CamelModel): assert result == [] + def test_to_yaml_default(self): + """to_yaml should export as YAML string.""" + + class Item(CamelModel): + item_id: int + + items = [Item(item_id=1), Item(item_id=2)] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_yaml() + + assert "itemId: 1" in result + assert "itemId: 2" in result + class TestResourceBase: def test_initialization_with_http_client(self): From 7b87f609d3f409a7e9cdef534eb5cd519b84ce86 Mon Sep 17 00:00:00 2001 From: Jan-David Wiederstein <141321444+Datata1@users.noreply.github.com> Date: Sat, 7 Feb 2026 15:02:10 +0100 Subject: [PATCH 4/7] Update src/codesphere/core/base.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/codesphere/core/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codesphere/core/base.py b/src/codesphere/core/base.py index 0baacbb..1baeddb 100644 --- a/src/codesphere/core/base.py +++ b/src/codesphere/core/base.py @@ -68,7 +68,7 @@ def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: YAML string representation of the model. """ data = self.to_dict(by_alias=by_alias, exclude_none=exclude_none) - return yaml.dump( + return yaml.safe_dump( data, default_flow_style=False, allow_unicode=True, sort_keys=False ) From baad614e73e552b84614d4cea130fb33afc44c0a Mon Sep 17 00:00:00 2001 From: Datata1 <> Date: Sat, 7 Feb 2026 15:06:31 +0100 Subject: [PATCH 5/7] pr feedback --- src/codesphere/core/base.py | 23 +++++++++++++------ tests/core/test_base.py | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 7 deletions(-) diff --git a/src/codesphere/core/base.py b/src/codesphere/core/base.py index 1baeddb..83536c3 100644 --- a/src/codesphere/core/base.py +++ b/src/codesphere/core/base.py @@ -1,4 +1,4 @@ -from typing import Any, Generic, List, TypeVar +from typing import Any, Generic, List, Literal, TypeVar import yaml from pydantic import BaseModel, ConfigDict, RootModel @@ -67,7 +67,9 @@ def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: Returns: YAML string representation of the model. """ - data = self.to_dict(by_alias=by_alias, exclude_none=exclude_none) + data = self.model_dump( + by_alias=by_alias, exclude_none=exclude_none, mode="json" + ) return yaml.safe_dump( data, default_flow_style=False, allow_unicode=True, sort_keys=False ) @@ -86,19 +88,25 @@ def __len__(self): return len(self.root) def to_list( - self, *, by_alias: bool = True, exclude_none: bool = False + self, + *, + by_alias: bool = True, + exclude_none: bool = False, + mode: Literal["python", "json"] = "python", ) -> list[dict[str, Any]]: """Export all items as a list of dictionaries. Args: by_alias: Use camelCase keys (API format) if True, snake_case if False. exclude_none: Exclude fields with None values if True. + mode: Serialization mode. "python" returns native Python objects, + "json" returns JSON-compatible types (e.g., datetime as ISO string). Returns: List of dictionary representations. """ return [ - item.model_dump(by_alias=by_alias, exclude_none=exclude_none) + item.model_dump(by_alias=by_alias, exclude_none=exclude_none, mode=mode) for item in self.root ] @@ -122,7 +130,8 @@ def to_json( import json return json.dumps( - self.to_list(by_alias=by_alias, exclude_none=exclude_none), indent=indent + self.to_list(by_alias=by_alias, exclude_none=exclude_none, mode="json"), + indent=indent, ) def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: @@ -135,8 +144,8 @@ def to_yaml(self, *, by_alias: bool = True, exclude_none: bool = False) -> str: Returns: YAML string representation. """ - return yaml.dump( - self.to_list(by_alias=by_alias, exclude_none=exclude_none), + return yaml.safe_dump( + self.to_list(by_alias=by_alias, exclude_none=exclude_none, mode="json"), default_flow_style=False, allow_unicode=True, sort_keys=False, diff --git a/tests/core/test_base.py b/tests/core/test_base.py index b060226..9e66eb7 100644 --- a/tests/core/test_base.py +++ b/tests/core/test_base.py @@ -1,5 +1,6 @@ import json from dataclasses import dataclass +from datetime import datetime, timezone from unittest.mock import MagicMock import pytest @@ -319,6 +320,49 @@ class Item(CamelModel): assert "itemId: 1" in result assert "itemId: 2" in result + def test_to_json_with_datetime_field(self): + """to_json should properly serialize datetime fields to ISO format.""" + + class Item(CamelModel): + item_id: int + created_at: datetime + + dt = datetime(2026, 2, 7, 12, 30, 45, tzinfo=timezone.utc) + items = [Item(item_id=1, created_at=dt)] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_json() + + parsed = json.loads(result) + assert parsed == [{"itemId": 1, "createdAt": "2026-02-07T12:30:45Z"}] + + def test_to_list_mode_json(self): + """to_list with mode='json' should return JSON-serializable types.""" + + class Item(CamelModel): + item_id: int + created_at: datetime + + dt = datetime(2026, 2, 7, 12, 30, 45, tzinfo=timezone.utc) + items = [Item(item_id=1, created_at=dt)] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_list(mode="json") + + assert result == [{"itemId": 1, "createdAt": "2026-02-07T12:30:45Z"}] + + def test_to_list_mode_python(self): + """to_list with mode='python' (default) should return native Python types.""" + + class Item(CamelModel): + item_id: int + created_at: datetime + + dt = datetime(2026, 2, 7, 12, 30, 45, tzinfo=timezone.utc) + items = [Item(item_id=1, created_at=dt)] + resource_list = ResourceList[Item](root=items) + result = resource_list.to_list() + + assert result == [{"itemId": 1, "createdAt": dt}] + class TestResourceBase: def test_initialization_with_http_client(self): From 52da858c40373bcb71d1699ec0a7624278320875 Mon Sep 17 00:00:00 2001 From: Datata1 <> Date: Sat, 7 Feb 2026 15:16:46 +0100 Subject: [PATCH 6/7] pr feedback --- src/codesphere/resources/team/domain/manager.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/codesphere/resources/team/domain/manager.py b/src/codesphere/resources/team/domain/manager.py index 7f54163..2a923b5 100644 --- a/src/codesphere/resources/team/domain/manager.py +++ b/src/codesphere/resources/team/domain/manager.py @@ -1,21 +1,17 @@ from typing import List, Union + from pydantic import Field from ....core.base import ResourceList from ....core.handler import _APIOperationExecutor from ....core.operations import AsyncCallable from ....http_client import APIHttpClient -from .schemas import CustomDomainConfig, DomainRouting, RoutingMap -from .resources import Domain from .operations import _CREATE_OP, _GET_OP, _LIST_OP, _UPDATE_OP, _UPDATE_WS_OP +from .resources import Domain +from .schemas import CustomDomainConfig, DomainRouting, RoutingMap class TeamDomainManager(_APIOperationExecutor): - """ - Verwaltet Domains im Kontext eines spezifischen Teams. - Zugriff typischerweise über 'team.domains'. - """ - def __init__(self, http_client: APIHttpClient, team_id: int): self._http_client = http_client self.team_id = team_id From 2799c566c6d01294009af892eabb7e2e44bed448 Mon Sep 17 00:00:00 2001 From: Datata1 <> Date: Sat, 7 Feb 2026 15:17:03 +0100 Subject: [PATCH 7/7] pr feedback --- src/codesphere/resources/team/domain/schemas.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/codesphere/resources/team/domain/schemas.py b/src/codesphere/resources/team/domain/schemas.py index c2f86a0..d6c9ab4 100644 --- a/src/codesphere/resources/team/domain/schemas.py +++ b/src/codesphere/resources/team/domain/schemas.py @@ -1,5 +1,7 @@ from __future__ import annotations + from typing import Dict, List, Optional, TypeAlias + from pydantic import Field, RootModel from ....core.base import CamelModel @@ -31,10 +33,6 @@ class CustomDomainConfig(CamelModel): class DomainRouting(RootModel): - """ - Helper class to build the routing configuration. - """ - root: RoutingMap = Field(default_factory=dict) def add(self, path: str, workspace_ids: List[int]) -> DomainRouting: