diff --git a/services/mongodbflex/oas_commit b/services/mongodbflex/oas_commit index e3713dde3..72dcff29c 100644 --- a/services/mongodbflex/oas_commit +++ b/services/mongodbflex/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +0867dbbb09a8032415dc6debe18bc392bd58ba42 diff --git a/services/mongodbflex/src/stackit/mongodbflex/api_client.py b/services/mongodbflex/src/stackit/mongodbflex/api_client.py index 6e913bf39..7b71f0568 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/api_client.py +++ b/services/mongodbflex/src/stackit/mongodbflex/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/mongodbflex/src/stackit/mongodbflex/models/acl.py b/services/mongodbflex/src/stackit/mongodbflex/models/acl.py index 69b633d46..2eda950e6 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/acl.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/acl.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 @@ -31,7 +32,8 @@ class ACL(BaseModel): __properties: ClassVar[List[str]] = ["items"] 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/mongodbflex/src/stackit/mongodbflex/models/backup.py b/services/mongodbflex/src/stackit/mongodbflex/models/backup.py index 528239573..fd3078cff 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/backup.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/backup.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -38,7 +39,8 @@ class Backup(BaseModel): __properties: ClassVar[List[str]] = ["endTime", "error", "id", "labels", "name", "options", "size", "startTime"] 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/mongodbflex/src/stackit/mongodbflex/models/backup_schedule.py b/services/mongodbflex/src/stackit/mongodbflex/models/backup_schedule.py index 6fa3ad66d..ceb6ea687 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/backup_schedule.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/backup_schedule.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -43,7 +44,8 @@ class BackupSchedule(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,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/mongodbflex/src/stackit/mongodbflex/models/clone_instance_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/clone_instance_payload.py index 3d980322e..b814ff22d 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/clone_instance_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/clone_instance_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class CloneInstancePayload(BaseModel): __properties: ClassVar[List[str]] = ["instanceId", "timestamp"] 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/mongodbflex/src/stackit/mongodbflex/models/clone_instance_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/clone_instance_response.py index dd17da38d..7e1348c5c 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/clone_instance_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/clone_instance_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -31,7 +32,8 @@ class CloneInstanceResponse(BaseModel): __properties: ClassVar[List[str]] = ["instanceId"] 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/mongodbflex/src/stackit/mongodbflex/models/create_instance_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/create_instance_payload.py index e7846d711..fd439cacb 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/create_instance_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/create_instance_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.acl import ACL @@ -54,7 +55,8 @@ class CreateInstancePayload(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -65,8 +67,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/mongodbflex/src/stackit/mongodbflex/models/create_instance_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/create_instance_response.py index 6a68772fb..323b3acfe 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/create_instance_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/create_instance_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 @@ -31,7 +32,8 @@ class CreateInstanceResponse(BaseModel): __properties: ClassVar[List[str]] = ["id"] 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/mongodbflex/src/stackit/mongodbflex/models/create_user_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/create_user_payload.py index f03b4e90e..80ed77eb0 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/create_user_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/create_user_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class CreateUserPayload(BaseModel): __properties: ClassVar[List[str]] = ["database", "roles", "username"] 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/mongodbflex/src/stackit/mongodbflex/models/create_user_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/create_user_response.py index 207b9f66f..8bb0aa6d7 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/create_user_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/create_user_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.mongodbflex.models.user import User @@ -33,7 +34,8 @@ class CreateUserResponse(BaseModel): __properties: ClassVar[List[str]] = ["item"] 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/mongodbflex/src/stackit/mongodbflex/models/data_point.py b/services/mongodbflex/src/stackit/mongodbflex/models/data_point.py index ec9111a87..155662142 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/data_point.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/data_point.py @@ -25,6 +25,7 @@ StrictInt, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -38,7 +39,8 @@ class DataPoint(BaseModel): __properties: ClassVar[List[str]] = ["timestamp", "value"] 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/mongodbflex/src/stackit/mongodbflex/models/error.py b/services/mongodbflex/src/stackit/mongodbflex/models/error.py index ec6524643..24a74db4b 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/error.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/error.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -34,7 +35,8 @@ class Error(BaseModel): __properties: ClassVar[List[str]] = ["code", "fields", "message", "type"] 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/mongodbflex/src/stackit/mongodbflex/models/flavor.py b/services/mongodbflex/src/stackit/mongodbflex/models/flavor.py index 81b637ed0..eb33128b9 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/flavor.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/flavor.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -34,7 +35,8 @@ class Flavor(BaseModel): __properties: ClassVar[List[str]] = ["cpu", "description", "id", "memory"] 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/mongodbflex/src/stackit/mongodbflex/models/get_backup_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/get_backup_response.py index afe680462..3a5594f87 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/get_backup_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/get_backup_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.mongodbflex.models.backup import Backup @@ -33,7 +34,8 @@ class GetBackupResponse(BaseModel): __properties: ClassVar[List[str]] = ["item"] 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/mongodbflex/src/stackit/mongodbflex/models/get_user_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/get_user_response.py index 02bfedb5e..e55bbc5d8 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/get_user_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/get_user_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.mongodbflex.models.instance_response_user import InstanceResponseUser @@ -33,7 +34,8 @@ class GetUserResponse(BaseModel): __properties: ClassVar[List[str]] = ["item"] 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/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_slow_queries_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_slow_queries_response.py index bbde5dbd9..16c6dc4ff 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_slow_queries_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_slow_queries_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.mongodbflex.models.slow_query import SlowQuery @@ -37,7 +38,8 @@ class HandlersInstancesSlowQueriesResponse(BaseModel): __properties: ClassVar[List[str]] = ["slowQueries"] 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/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_suggested_indexes_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_suggested_indexes_response.py index 8614abb58..300ddfdc2 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_suggested_indexes_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/handlers_instances_suggested_indexes_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.mongodbflex.models.shape import Shape @@ -42,7 +43,8 @@ class HandlersInstancesSuggestedIndexesResponse(BaseModel): __properties: ClassVar[List[str]] = ["shapes", "suggestedIndexes"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,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/mongodbflex/src/stackit/mongodbflex/models/host.py b/services/mongodbflex/src/stackit/mongodbflex/models/host.py index 136f8ba2f..613a1ad42 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/host.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/host.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.host_metric import HostMetric @@ -34,7 +35,8 @@ class Host(BaseModel): __properties: ClassVar[List[str]] = ["hostMetrics", "id"] 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/mongodbflex/src/stackit/mongodbflex/models/host_metric.py b/services/mongodbflex/src/stackit/mongodbflex/models/host_metric.py index 62cf661e8..196d643d3 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/host_metric.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/host_metric.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 from stackit.mongodbflex.models.data_point import DataPoint @@ -35,7 +36,8 @@ class HostMetric(BaseModel): __properties: ClassVar[List[str]] = ["datapoints", "name", "units"] 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/mongodbflex/src/stackit/mongodbflex/models/instance.py b/services/mongodbflex/src/stackit/mongodbflex/models/instance.py index 51ab4820d..2869d240e 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/instance.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/instance.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.acl import ACL @@ -65,7 +66,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -76,8 +78,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/mongodbflex/src/stackit/mongodbflex/models/instance_flavor.py b/services/mongodbflex/src/stackit/mongodbflex/models/instance_flavor.py index 91117dc55..48a8d3151 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/instance_flavor.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/instance_flavor.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class InstanceFlavor(BaseModel): __properties: ClassVar[List[str]] = ["categories", "cpu", "description", "id", "memory"] 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/mongodbflex/src/stackit/mongodbflex/models/instance_list_instance.py b/services/mongodbflex/src/stackit/mongodbflex/models/instance_list_instance.py index 507579a7f..e4ecd9d07 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/instance_list_instance.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/instance_list_instance.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -43,7 +44,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,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/mongodbflex/src/stackit/mongodbflex/models/instance_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/instance_response.py index 5ed6ae040..e276fa044 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/instance_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/instance_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.mongodbflex.models.instance import Instance @@ -33,7 +34,8 @@ class InstanceResponse(BaseModel): __properties: ClassVar[List[str]] = ["item"] 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/mongodbflex/src/stackit/mongodbflex/models/instance_response_user.py b/services/mongodbflex/src/stackit/mongodbflex/models/instance_response_user.py index 7f883a64b..4cb87f6dd 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/instance_response_user.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/instance_response_user.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -39,7 +40,8 @@ class InstanceResponseUser(BaseModel): __properties: ClassVar[List[str]] = ["database", "host", "id", "port", "roles", "username"] 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/mongodbflex/src/stackit/mongodbflex/models/list_backups_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_backups_response.py index 563de3898..f23f770aa 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_backups_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_backups_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.backup import Backup @@ -34,7 +35,8 @@ class ListBackupsResponse(BaseModel): __properties: ClassVar[List[str]] = ["count", "items"] 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/mongodbflex/src/stackit/mongodbflex/models/list_flavors_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_flavors_response.py index 9822a8279..f4339d256 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_flavors_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_flavors_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.mongodbflex.models.instance_flavor import InstanceFlavor @@ -33,7 +34,8 @@ class ListFlavorsResponse(BaseModel): __properties: ClassVar[List[str]] = ["flavors"] 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/mongodbflex/src/stackit/mongodbflex/models/list_instances_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_instances_response.py index 587878ad9..30855eea3 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_instances_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_instances_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.instance_list_instance import InstanceListInstance @@ -34,7 +35,8 @@ class ListInstancesResponse(BaseModel): __properties: ClassVar[List[str]] = ["count", "items"] 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/mongodbflex/src/stackit/mongodbflex/models/list_metrics_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_metrics_response.py index e7fbe0329..086e866e3 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_metrics_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_metrics_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.mongodbflex.models.host import Host @@ -33,7 +34,8 @@ class ListMetricsResponse(BaseModel): __properties: ClassVar[List[str]] = ["hosts"] 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/mongodbflex/src/stackit/mongodbflex/models/list_restore_jobs_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_restore_jobs_response.py index 38074eaaa..449fa6286 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_restore_jobs_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_restore_jobs_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.mongodbflex.models.restore_instance_status import RestoreInstanceStatus @@ -33,7 +34,8 @@ class ListRestoreJobsResponse(BaseModel): __properties: ClassVar[List[str]] = ["items"] 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/mongodbflex/src/stackit/mongodbflex/models/list_storages_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_storages_response.py index 0a90804fd..700616799 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_storages_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_storages_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.storage_range import StorageRange @@ -34,7 +35,8 @@ class ListStoragesResponse(BaseModel): __properties: ClassVar[List[str]] = ["storageClasses", "storageRange"] 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/mongodbflex/src/stackit/mongodbflex/models/list_user.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_user.py index 4eeb4ebc3..a3f2f5351 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_user.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_user.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 ListUser(BaseModel): __properties: ClassVar[List[str]] = ["id", "username"] 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/mongodbflex/src/stackit/mongodbflex/models/list_users_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_users_response.py index 2e859039b..8b556a849 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_users_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_users_response.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.list_user import ListUser @@ -34,7 +35,8 @@ class ListUsersResponse(BaseModel): __properties: ClassVar[List[str]] = ["count", "items"] 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/mongodbflex/src/stackit/mongodbflex/models/list_versions_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/list_versions_response.py index df16cbcaf..630d2616b 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/list_versions_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/list_versions_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 @@ -31,7 +32,8 @@ class ListVersionsResponse(BaseModel): __properties: ClassVar[List[str]] = ["versions"] 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/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_operation.py b/services/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_operation.py index e9b1adf2c..14fbcaef0 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_operation.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_operation.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.mongodbatlas_stats import MongodbatlasStats @@ -37,7 +38,8 @@ class MongodbatlasOperation(BaseModel): __properties: ClassVar[List[str]] = ["predicates", "raw", "stats"] 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/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_stats.py b/services/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_stats.py index 02469ba21..77978e3f7 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_stats.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/mongodbatlas_stats.py @@ -25,6 +25,7 @@ StrictFloat, StrictInt, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -46,7 +47,8 @@ class MongodbatlasStats(BaseModel): __properties: ClassVar[List[str]] = ["ms", "nReturned", "nScanned", "ts"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +59,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/mongodbflex/src/stackit/mongodbflex/models/partial_update_instance_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/partial_update_instance_payload.py index 60ad4ea3b..1dc71b94c 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/partial_update_instance_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/partial_update_instance_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.acl import ACL @@ -52,7 +53,8 @@ class PartialUpdateInstancePayload(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +65,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/mongodbflex/src/stackit/mongodbflex/models/partial_update_user_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/partial_update_user_payload.py index 311b60afd..6a7421a45 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/partial_update_user_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/partial_update_user_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class PartialUpdateUserPayload(BaseModel): __properties: ClassVar[List[str]] = ["database", "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/mongodbflex/src/stackit/mongodbflex/models/restore_instance_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_payload.py index e5df7c65b..d852fb558 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class RestoreInstancePayload(BaseModel): __properties: ClassVar[List[str]] = ["backupId", "instanceId"] 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/mongodbflex/src/stackit/mongodbflex/models/restore_instance_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_response.py index c1189c7a0..ad1be3ea7 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_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.mongodbflex.models.restore_instance_status import RestoreInstanceStatus @@ -33,7 +34,8 @@ class RestoreInstanceResponse(BaseModel): __properties: ClassVar[List[str]] = ["item"] 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/mongodbflex/src/stackit/mongodbflex/models/restore_instance_status.py b/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_status.py index 0ac67b28d..1764021b8 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_status.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/restore_instance_status.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -35,7 +36,8 @@ class RestoreInstanceStatus(BaseModel): __properties: ClassVar[List[str]] = ["backupID", "date", "id", "instanceId", "status"] 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/mongodbflex/src/stackit/mongodbflex/models/shape.py b/services/mongodbflex/src/stackit/mongodbflex/models/shape.py index 98fbda93a..4cb66267b 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/shape.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/shape.py @@ -26,6 +26,7 @@ StrictInt, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.mongodbatlas_operation import MongodbatlasOperation @@ -58,7 +59,8 @@ class Shape(BaseModel): __properties: ClassVar[List[str]] = ["avgMs", "count", "id", "inefficiencyScore", "namespace", "operations"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -69,8 +71,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/mongodbflex/src/stackit/mongodbflex/models/slow_query.py b/services/mongodbflex/src/stackit/mongodbflex/models/slow_query.py index d24ec22d7..c14f19088 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/slow_query.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/slow_query.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class SlowQuery(BaseModel): __properties: ClassVar[List[str]] = ["line", "namespace"] 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/mongodbflex/src/stackit/mongodbflex/models/storage.py b/services/mongodbflex/src/stackit/mongodbflex/models/storage.py index 5f01b0ab2..9375f4405 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/storage.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/storage.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class Storage(BaseModel): __properties: ClassVar[List[str]] = ["class", "size"] 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/mongodbflex/src/stackit/mongodbflex/models/storage_range.py b/services/mongodbflex/src/stackit/mongodbflex/models/storage_range.py index 2d7fbaa32..1c2db164a 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/storage_range.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/storage_range.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -32,7 +33,8 @@ class StorageRange(BaseModel): __properties: ClassVar[List[str]] = ["max", "min"] 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/mongodbflex/src/stackit/mongodbflex/models/suggested_index.py b/services/mongodbflex/src/stackit/mongodbflex/models/suggested_index.py index b23a33347..e855218d3 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/suggested_index.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/suggested_index.py @@ -26,6 +26,7 @@ StrictInt, StrictStr, ) +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -50,7 +51,8 @@ class SuggestedIndex(BaseModel): __properties: ClassVar[List[str]] = ["id", "impact", "index", "namespace", "weight"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -61,8 +63,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/mongodbflex/src/stackit/mongodbflex/models/update_backup_schedule_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/update_backup_schedule_payload.py index eae84e23f..bd92099e1 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/update_backup_schedule_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/update_backup_schedule_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -43,7 +44,8 @@ class UpdateBackupSchedulePayload(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,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/mongodbflex/src/stackit/mongodbflex/models/update_instance_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/update_instance_payload.py index 7477585b6..fbcc101a0 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/update_instance_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/update_instance_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self from stackit.mongodbflex.models.acl import ACL @@ -52,7 +53,8 @@ class UpdateInstancePayload(BaseModel): ] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +65,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/mongodbflex/src/stackit/mongodbflex/models/update_instance_response.py b/services/mongodbflex/src/stackit/mongodbflex/models/update_instance_response.py index e64230828..a11a69f8d 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/update_instance_response.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/update_instance_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.mongodbflex.models.instance import Instance @@ -33,7 +34,8 @@ class UpdateInstanceResponse(BaseModel): __properties: ClassVar[List[str]] = ["item"] 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/mongodbflex/src/stackit/mongodbflex/models/update_user_payload.py b/services/mongodbflex/src/stackit/mongodbflex/models/update_user_payload.py index be3239525..ee826b1be 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/update_user_payload.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/update_user_payload.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -34,7 +35,8 @@ class UpdateUserPayload(BaseModel): __properties: ClassVar[List[str]] = ["database", "roles"] 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/mongodbflex/src/stackit/mongodbflex/models/user.py b/services/mongodbflex/src/stackit/mongodbflex/models/user.py index 23f45e68d..236d56ca8 100644 --- a/services/mongodbflex/src/stackit/mongodbflex/models/user.py +++ b/services/mongodbflex/src/stackit/mongodbflex/models/user.py @@ -19,6 +19,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic_core import to_jsonable_python from typing_extensions import Self @@ -41,7 +42,8 @@ class User(BaseModel): __properties: ClassVar[List[str]] = ["database", "host", "id", "password", "port", "roles", "uri", "username"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,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]: