From 6fb21acd18d269f680421d2f3ebbd64a7a4e40a7 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 11 May 2026 14:58:38 +0000 Subject: [PATCH] Generate scf --- services/scf/oas_commit | 2 +- services/scf/src/stackit/scf/api_client.py | 32 +++++++++---------- .../apply_organization_quota_payload.py | 7 ++-- .../scf/models/create_org_role_payload.py | 7 ++-- .../scf/models/create_organization_payload.py | 7 ++-- .../scf/models/create_space_payload.py | 7 ++-- .../scf/models/create_space_role_payload.py | 7 ++-- .../src/stackit/scf/models/error_response.py | 7 ++-- .../stackit/scf/models/isolation_segment.py | 7 ++-- .../scf/models/isolation_segments_list.py | 7 ++-- .../scf/src/stackit/scf/models/org_manager.py | 7 ++-- .../scf/models/org_manager_delete_response.py | 10 ++++-- .../scf/models/org_manager_response.py | 7 ++-- .../scf/models/org_role_create_bff_request.py | 7 ++-- .../stackit/scf/models/org_role_response.py | 7 ++-- .../src/stackit/scf/models/organization.py | 7 ++-- .../organization_create_bff_response.py | 7 ++-- .../models/organization_create_response.py | 7 ++-- .../models/organization_delete_response.py | 7 ++-- .../stackit/scf/models/organization_quota.py | 7 ++-- .../scf/models/organization_usage_summary.py | 7 ++-- .../stackit/scf/models/organizations_list.py | 7 ++-- .../scf/models/organizations_list_item.py | 7 ++-- .../scf/src/stackit/scf/models/pagination.py | 7 ++-- .../src/stackit/scf/models/platform_list.py | 7 ++-- .../scf/src/stackit/scf/models/platforms.py | 7 ++-- services/scf/src/stackit/scf/models/quota.py | 7 ++-- .../scf/src/stackit/scf/models/quota_apps.py | 7 ++-- .../src/stackit/scf/models/quota_domains.py | 7 ++-- .../src/stackit/scf/models/quota_routes.py | 7 ++-- .../src/stackit/scf/models/quota_services.py | 7 ++-- services/scf/src/stackit/scf/models/space.py | 7 ++-- .../scf/models/space_created_bff_response.py | 7 ++-- .../scf/models/space_delete_response.py | 10 ++++-- .../models/space_role_create_bff_request.py | 7 ++-- .../models/space_role_create_bff_response.py | 7 ++-- .../scf/models/space_role_create_response.py | 7 ++-- .../models/space_with_isolation_segment.py | 7 ++-- .../scf/src/stackit/scf/models/spaces_list.py | 7 ++-- .../scf/models/update_organization_payload.py | 7 ++-- .../scf/models/update_space_payload.py | 7 ++-- .../src/stackit/scf/models/usage_summary.py | 7 ++-- 42 files changed, 182 insertions(+), 138 deletions(-) diff --git a/services/scf/oas_commit b/services/scf/oas_commit index e3713dde3..72dcff29c 100644 --- a/services/scf/oas_commit +++ b/services/scf/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +0867dbbb09a8032415dc6debe18bc392bd58ba42 diff --git a/services/scf/src/stackit/scf/api_client.py b/services/scf/src/stackit/scf/api_client.py index de0489cc6..d6584a245 100644 --- a/services/scf/src/stackit/scf/api_client.py +++ b/services/scf/src/stackit/scf/api_client.py @@ -67,6 +67,7 @@ class ApiClient: "date": datetime.date, "datetime": datetime.datetime, "decimal": decimal.Decimal, + "UUID": uuid.UUID, "object": object, } _pool = None @@ -266,7 +267,7 @@ def response_deserialize( response_text = None return_data = None try: - if response_type == "bytearray": + if response_type in ("bytearray", "bytes"): return_data = response_data.data elif response_type == "file": return_data = self.__deserialize_file(response_data) @@ -327,25 +328,20 @@ def sanitize_for_serialization(self, obj): return obj.isoformat() elif isinstance(obj, decimal.Decimal): return str(obj) - elif isinstance(obj, dict): - obj_dict = obj + return {key: self.sanitize_for_serialization(val) for key, val in obj.items()} + + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): + obj_dict = obj.to_dict() else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009 - obj_dict = obj.to_dict() - else: - obj_dict = obj.__dict__ - - if isinstance(obj_dict, list): - # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501 - return self.sanitize_for_serialization(obj_dict) + obj_dict = obj.__dict__ - return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} + return self.sanitize_for_serialization(obj_dict) def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): """Deserializes response into an object. @@ -418,6 +414,8 @@ def __deserialize(self, data, klass): return self.__deserialize_datetime(data) elif klass is decimal.Decimal: return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: diff --git a/services/scf/src/stackit/scf/models/apply_organization_quota_payload.py b/services/scf/src/stackit/scf/models/apply_organization_quota_payload.py index 76e90b6a0..44af036ad 100644 --- a/services/scf/src/stackit/scf/models/apply_organization_quota_payload.py +++ b/services/scf/src/stackit/scf/models/apply_organization_quota_payload.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class ApplyOrganizationQuotaPayload(BaseModel): __properties: ClassVar[List[str]] = ["quotaId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/create_org_role_payload.py b/services/scf/src/stackit/scf/models/create_org_role_payload.py index 60a9a7ae7..ed0b34a7f 100644 --- a/services/scf/src/stackit/scf/models/create_org_role_payload.py +++ b/services/scf/src/stackit/scf/models/create_org_role_payload.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.org_role_type import OrgRoleType @@ -36,7 +37,8 @@ class CreateOrgRolePayload(BaseModel): __properties: ClassVar[List[str]] = ["type", "userGuid", "userName"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/create_organization_payload.py b/services/scf/src/stackit/scf/models/create_organization_payload.py index 84011d8ec..0d7ce3285 100644 --- a/services/scf/src/stackit/scf/models/create_organization_payload.py +++ b/services/scf/src/stackit/scf/models/create_organization_payload.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -33,7 +34,8 @@ class CreateOrganizationPayload(BaseModel): __properties: ClassVar[List[str]] = ["name", "platformId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/create_space_payload.py b/services/scf/src/stackit/scf/models/create_space_payload.py index 304e766c3..9c10c2ba8 100644 --- a/services/scf/src/stackit/scf/models/create_space_payload.py +++ b/services/scf/src/stackit/scf/models/create_space_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -31,7 +32,8 @@ class CreateSpacePayload(BaseModel): __properties: ClassVar[List[str]] = ["name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/create_space_role_payload.py b/services/scf/src/stackit/scf/models/create_space_role_payload.py index 1022d67fb..065a4c16f 100644 --- a/services/scf/src/stackit/scf/models/create_space_role_payload.py +++ b/services/scf/src/stackit/scf/models/create_space_role_payload.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.space_role_type import SpaceRoleType @@ -36,7 +37,8 @@ class CreateSpaceRolePayload(BaseModel): __properties: ClassVar[List[str]] = ["type", "userGuid", "userName"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/error_response.py b/services/scf/src/stackit/scf/models/error_response.py index bb6f640de..c466ebffd 100644 --- a/services/scf/src/stackit/scf/models/error_response.py +++ b/services/scf/src/stackit/scf/models/error_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class ErrorResponse(BaseModel): __properties: ClassVar[List[str]] = ["code", "message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/isolation_segment.py b/services/scf/src/stackit/scf/models/isolation_segment.py index 267979ac2..cd7cefcc5 100644 --- a/services/scf/src/stackit/scf/models/isolation_segment.py +++ b/services/scf/src/stackit/scf/models/isolation_segment.py @@ -22,6 +22,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -76,7 +77,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -87,8 +89,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/isolation_segments_list.py b/services/scf/src/stackit/scf/models/isolation_segments_list.py index d8f13184c..213330b60 100644 --- a/services/scf/src/stackit/scf/models/isolation_segments_list.py +++ b/services/scf/src/stackit/scf/models/isolation_segments_list.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.isolation_segment import IsolationSegment @@ -35,7 +36,8 @@ class IsolationSegmentsList(BaseModel): __properties: ClassVar[List[str]] = ["pagination", "resources"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/org_manager.py b/services/scf/src/stackit/scf/models/org_manager.py index 5a51e6d49..7030e9da4 100644 --- a/services/scf/src/stackit/scf/models/org_manager.py +++ b/services/scf/src/stackit/scf/models/org_manager.py @@ -22,6 +22,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -76,7 +77,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -87,8 +89,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/org_manager_delete_response.py b/services/scf/src/stackit/scf/models/org_manager_delete_response.py index 45d71bfaa..747f82d9a 100644 --- a/services/scf/src/stackit/scf/models/org_manager_delete_response.py +++ b/services/scf/src/stackit/scf/models/org_manager_delete_response.py @@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -34,12 +35,16 @@ class OrgManagerDeleteResponse(BaseModel): @field_validator("message") def message_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9\/_]+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9\/_]+$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/org_manager_response.py b/services/scf/src/stackit/scf/models/org_manager_response.py index 16073955d..925e82941 100644 --- a/services/scf/src/stackit/scf/models/org_manager_response.py +++ b/services/scf/src/stackit/scf/models/org_manager_response.py @@ -22,6 +22,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -78,7 +79,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -89,8 +91,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/org_role_create_bff_request.py b/services/scf/src/stackit/scf/models/org_role_create_bff_request.py index a3da7c0c4..8effd0c5c 100644 --- a/services/scf/src/stackit/scf/models/org_role_create_bff_request.py +++ b/services/scf/src/stackit/scf/models/org_role_create_bff_request.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.org_role_type import OrgRoleType @@ -33,7 +34,8 @@ class OrgRoleCreateBffRequest(BaseModel): __properties: ClassVar[List[str]] = ["type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/org_role_response.py b/services/scf/src/stackit/scf/models/org_role_response.py index 3dcaa6711..d662fe442 100644 --- a/services/scf/src/stackit/scf/models/org_role_response.py +++ b/services/scf/src/stackit/scf/models/org_role_response.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.org_role_type import OrgRoleType @@ -39,7 +40,8 @@ class OrgRoleResponse(BaseModel): __properties: ClassVar[List[str]] = ["guid", "orgId", "platformId", "projectId", "region", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organization.py b/services/scf/src/stackit/scf/models/organization.py index 4dab8b219..2cea040d9 100644 --- a/services/scf/src/stackit/scf/models/organization.py +++ b/services/scf/src/stackit/scf/models/organization.py @@ -29,6 +29,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -89,7 +90,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -100,8 +102,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organization_create_bff_response.py b/services/scf/src/stackit/scf/models/organization_create_bff_response.py index a5845abb6..9e2129d42 100644 --- a/services/scf/src/stackit/scf/models/organization_create_bff_response.py +++ b/services/scf/src/stackit/scf/models/organization_create_bff_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.org_role_response import OrgRoleResponse @@ -35,7 +36,8 @@ class OrganizationCreateBffResponse(BaseModel): __properties: ClassVar[List[str]] = ["org", "roles"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organization_create_response.py b/services/scf/src/stackit/scf/models/organization_create_response.py index e589fad4d..858b75699 100644 --- a/services/scf/src/stackit/scf/models/organization_create_response.py +++ b/services/scf/src/stackit/scf/models/organization_create_response.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class OrganizationCreateResponse(BaseModel): __properties: ClassVar[List[str]] = ["guid", "platformId", "projectId", "region"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organization_delete_response.py b/services/scf/src/stackit/scf/models/organization_delete_response.py index 5ce1edd24..bb16ce822 100644 --- a/services/scf/src/stackit/scf/models/organization_delete_response.py +++ b/services/scf/src/stackit/scf/models/organization_delete_response.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class OrganizationDeleteResponse(BaseModel): __properties: ClassVar[List[str]] = ["guid", "platformId", "projectId", "region"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organization_quota.py b/services/scf/src/stackit/scf/models/organization_quota.py index 50636f46e..ac5d55838 100644 --- a/services/scf/src/stackit/scf/models/organization_quota.py +++ b/services/scf/src/stackit/scf/models/organization_quota.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -36,7 +37,8 @@ class OrganizationQuota(BaseModel): __properties: ClassVar[List[str]] = ["orgId", "platformId", "projectId", "quotaId", "region"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organization_usage_summary.py b/services/scf/src/stackit/scf/models/organization_usage_summary.py index 28eb53429..3998ca2d4 100644 --- a/services/scf/src/stackit/scf/models/organization_usage_summary.py +++ b/services/scf/src/stackit/scf/models/organization_usage_summary.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.usage_summary import UsageSummary @@ -38,7 +39,8 @@ class OrganizationUsageSummary(BaseModel): __properties: ClassVar[List[str]] = ["orgId", "platformId", "projectId", "region", "usageSummary"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organizations_list.py b/services/scf/src/stackit/scf/models/organizations_list.py index fcc2c1108..9e9cd12dc 100644 --- a/services/scf/src/stackit/scf/models/organizations_list.py +++ b/services/scf/src/stackit/scf/models/organizations_list.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.organizations_list_item import OrganizationsListItem @@ -35,7 +36,8 @@ class OrganizationsList(BaseModel): __properties: ClassVar[List[str]] = ["pagination", "resources"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/organizations_list_item.py b/services/scf/src/stackit/scf/models/organizations_list_item.py index 4b540964c..67d2eee73 100644 --- a/services/scf/src/stackit/scf/models/organizations_list_item.py +++ b/services/scf/src/stackit/scf/models/organizations_list_item.py @@ -29,6 +29,7 @@ StrictStr, field_validator, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -89,7 +90,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -100,8 +102,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/pagination.py b/services/scf/src/stackit/scf/models/pagination.py index 70ba83fab..892f8a3eb 100644 --- a/services/scf/src/stackit/scf/models/pagination.py +++ b/services/scf/src/stackit/scf/models/pagination.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -32,7 +33,8 @@ class Pagination(BaseModel): __properties: ClassVar[List[str]] = ["totalPages", "totalResults"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/platform_list.py b/services/scf/src/stackit/scf/models/platform_list.py index f973e2ab7..21e0c3d02 100644 --- a/services/scf/src/stackit/scf/models/platform_list.py +++ b/services/scf/src/stackit/scf/models/platform_list.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.pagination import Pagination @@ -35,7 +36,8 @@ class PlatformList(BaseModel): __properties: ClassVar[List[str]] = ["pagination", "resources"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/platforms.py b/services/scf/src/stackit/scf/models/platforms.py index 1df65a51d..9b3359261 100644 --- a/services/scf/src/stackit/scf/models/platforms.py +++ b/services/scf/src/stackit/scf/models/platforms.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -37,7 +38,8 @@ class Platforms(BaseModel): __properties: ClassVar[List[str]] = ["apiUrl", "consoleUrl", "displayName", "guid", "region", "systemId"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/quota.py b/services/scf/src/stackit/scf/models/quota.py index c2c60bc87..23cf1dbc3 100644 --- a/services/scf/src/stackit/scf/models/quota.py +++ b/services/scf/src/stackit/scf/models/quota.py @@ -22,6 +22,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.quota_apps import QuotaApps @@ -89,7 +90,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -100,8 +102,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/quota_apps.py b/services/scf/src/stackit/scf/models/quota_apps.py index b3ebcece7..37506c3ff 100644 --- a/services/scf/src/stackit/scf/models/quota_apps.py +++ b/services/scf/src/stackit/scf/models/quota_apps.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -51,7 +52,8 @@ class QuotaApps(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -62,8 +64,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/quota_domains.py b/services/scf/src/stackit/scf/models/quota_domains.py index 03111e3ca..1152fe898 100644 --- a/services/scf/src/stackit/scf/models/quota_domains.py +++ b/services/scf/src/stackit/scf/models/quota_domains.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -33,7 +34,8 @@ class QuotaDomains(BaseModel): __properties: ClassVar[List[str]] = ["totalDomains"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/quota_routes.py b/services/scf/src/stackit/scf/models/quota_routes.py index 09bb3934b..81a8c334b 100644 --- a/services/scf/src/stackit/scf/models/quota_routes.py +++ b/services/scf/src/stackit/scf/models/quota_routes.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -36,7 +37,8 @@ class QuotaRoutes(BaseModel): __properties: ClassVar[List[str]] = ["totalReservedPorts", "totalRoutes"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/quota_services.py b/services/scf/src/stackit/scf/models/quota_services.py index cebe59255..6aafb88da 100644 --- a/services/scf/src/stackit/scf/models/quota_services.py +++ b/services/scf/src/stackit/scf/models/quota_services.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictBool +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -37,7 +38,8 @@ class QuotaServices(BaseModel): __properties: ClassVar[List[str]] = ["paidServicesAllowed", "totalServiceInstances", "totalServiceKeys"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/space.py b/services/scf/src/stackit/scf/models/space.py index c01fcea5f..a391cd8fc 100644 --- a/services/scf/src/stackit/scf/models/space.py +++ b/services/scf/src/stackit/scf/models/space.py @@ -22,6 +22,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -76,7 +77,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -87,8 +89,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/space_created_bff_response.py b/services/scf/src/stackit/scf/models/space_created_bff_response.py index f1d668ff8..b82232bf9 100644 --- a/services/scf/src/stackit/scf/models/space_created_bff_response.py +++ b/services/scf/src/stackit/scf/models/space_created_bff_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.org_role_response import OrgRoleResponse @@ -37,7 +38,8 @@ class SpaceCreatedBffResponse(BaseModel): __properties: ClassVar[List[str]] = ["orgRole", "space", "spaceRole"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/space_delete_response.py b/services/scf/src/stackit/scf/models/space_delete_response.py index 1c79d93a3..640b90a16 100644 --- a/services/scf/src/stackit/scf/models/space_delete_response.py +++ b/services/scf/src/stackit/scf/models/space_delete_response.py @@ -20,6 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -34,12 +35,16 @@ class SpaceDeleteResponse(BaseModel): @field_validator("message") def message_validate_regular_expression(cls, value): """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + if not re.match(r"^[a-zA-Z0-9\/_]+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9\/_]+$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/space_role_create_bff_request.py b/services/scf/src/stackit/scf/models/space_role_create_bff_request.py index 6949a3b89..b29801f36 100644 --- a/services/scf/src/stackit/scf/models/space_role_create_bff_request.py +++ b/services/scf/src/stackit/scf/models/space_role_create_bff_request.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.space_role_type import SpaceRoleType @@ -33,7 +34,8 @@ class SpaceRoleCreateBffRequest(BaseModel): __properties: ClassVar[List[str]] = ["type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/space_role_create_bff_response.py b/services/scf/src/stackit/scf/models/space_role_create_bff_response.py index 40a471e0b..4487549ac 100644 --- a/services/scf/src/stackit/scf/models/space_role_create_bff_response.py +++ b/services/scf/src/stackit/scf/models/space_role_create_bff_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.org_role_response import OrgRoleResponse @@ -35,7 +36,8 @@ class SpaceRoleCreateBffResponse(BaseModel): __properties: ClassVar[List[str]] = ["orgRole", "spaceRole"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/space_role_create_response.py b/services/scf/src/stackit/scf/models/space_role_create_response.py index 1b8515919..95e27e16a 100644 --- a/services/scf/src/stackit/scf/models/space_role_create_response.py +++ b/services/scf/src/stackit/scf/models/space_role_create_response.py @@ -20,6 +20,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.space_role_type import SpaceRoleType @@ -40,7 +41,8 @@ class SpaceRoleCreateResponse(BaseModel): __properties: ClassVar[List[str]] = ["guid", "orgId", "platformId", "projectId", "region", "spaceId", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/space_with_isolation_segment.py b/services/scf/src/stackit/scf/models/space_with_isolation_segment.py index 5174126de..99dec646e 100644 --- a/services/scf/src/stackit/scf/models/space_with_isolation_segment.py +++ b/services/scf/src/stackit/scf/models/space_with_isolation_segment.py @@ -22,6 +22,7 @@ from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -78,7 +79,8 @@ def updated_at_change_year_zero_to_one(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -89,8 +91,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/spaces_list.py b/services/scf/src/stackit/scf/models/spaces_list.py index fb07c25e7..c9ef6f242 100644 --- a/services/scf/src/stackit/scf/models/spaces_list.py +++ b/services/scf/src/stackit/scf/models/spaces_list.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.scf.models.pagination import Pagination @@ -35,7 +36,8 @@ class SpacesList(BaseModel): __properties: ClassVar[List[str]] = ["pagination", "resources"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/update_organization_payload.py b/services/scf/src/stackit/scf/models/update_organization_payload.py index 84b83f2b9..93e640422 100644 --- a/services/scf/src/stackit/scf/models/update_organization_payload.py +++ b/services/scf/src/stackit/scf/models/update_organization_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictBool +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -34,7 +35,8 @@ class UpdateOrganizationPayload(BaseModel): __properties: ClassVar[List[str]] = ["name", "suspended"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/update_space_payload.py b/services/scf/src/stackit/scf/models/update_space_payload.py index 3fb23b86e..87c127fe4 100644 --- a/services/scf/src/stackit/scf/models/update_space_payload.py +++ b/services/scf/src/stackit/scf/models/update_space_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -31,7 +32,8 @@ class UpdateSpacePayload(BaseModel): __properties: ClassVar[List[str]] = ["name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/services/scf/src/stackit/scf/models/usage_summary.py b/services/scf/src/stackit/scf/models/usage_summary.py index e8268388e..7dc0c1356 100644 --- a/services/scf/src/stackit/scf/models/usage_summary.py +++ b/services/scf/src/stackit/scf/models/usage_summary.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field +from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -47,7 +48,8 @@ class UsageSummary(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -58,8 +60,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: