stackit-authorization 0.7.1__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/PKG-INFO +1 -1
  2. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/pyproject.toml +1 -1
  3. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/api_client.py +15 -17
  4. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/add_custom_role_response.py +10 -3
  5. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/add_members_payload.py +7 -3
  6. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/add_role_payload.py +7 -3
  7. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/delete_role_response.py +4 -3
  8. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/error_response.py +4 -3
  9. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/existing_permission.py +7 -3
  10. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/get_role_response.py +10 -3
  11. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/list_members_response.py +10 -3
  12. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/list_permissions_response.py +4 -3
  13. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/list_user_memberships_response.py +4 -3
  14. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/list_user_permissions_response.py +4 -3
  15. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/member.py +7 -3
  16. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/members_response.py +10 -3
  17. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/permission.py +7 -3
  18. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/permission_request.py +7 -3
  19. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/remove_members_payload.py +7 -3
  20. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/role.py +10 -3
  21. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/roles_response.py +10 -3
  22. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/update_role_payload.py +7 -3
  23. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/update_role_response.py +10 -3
  24. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/user_membership.py +13 -3
  25. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/user_permission.py +10 -3
  26. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/zookie.py +4 -3
  27. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/.gitignore +0 -0
  28. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/LICENSE.md +0 -0
  29. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/NOTICE.txt +0 -0
  30. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/README.md +0 -0
  31. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/__init__.py +0 -0
  32. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/api/__init__.py +0 -0
  33. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/api/default_api.py +0 -0
  34. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/api_response.py +0 -0
  35. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/configuration.py +0 -0
  36. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/exceptions.py +0 -0
  37. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/models/__init__.py +0 -0
  38. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/py.typed +0 -0
  39. {stackit_authorization-0.7.1 → stackit_authorization-0.8.0}/src/stackit/authorization/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stackit-authorization
3
- Version: 0.7.1
3
+ Version: 0.8.0
4
4
  Summary: STACKIT Membership API
5
5
  Project-URL: Homepage, https://github.com/stackitcloud/stackit-sdk-python
6
6
  Project-URL: Issues, https://github.com/stackitcloud/stackit-sdk-python/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "stackit-authorization"
3
- version = "v0.7.1"
3
+ version = "v0.8.0"
4
4
  description = "STACKIT Membership API"
5
5
  authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }]
6
6
  requires-python = ">=3.9,<4.0"
@@ -66,6 +66,7 @@ class ApiClient:
66
66
  "date": datetime.date,
67
67
  "datetime": datetime.datetime,
68
68
  "decimal": decimal.Decimal,
69
+ "UUID": uuid.UUID,
69
70
  "object": object,
70
71
  }
71
72
  _pool = None
@@ -265,7 +266,7 @@ class ApiClient:
265
266
  response_text = None
266
267
  return_data = None
267
268
  try:
268
- if response_type == "bytearray":
269
+ if response_type in ("bytearray", "bytes"):
269
270
  return_data = response_data.data
270
271
  elif response_type == "file":
271
272
  return_data = self.__deserialize_file(response_data)
@@ -326,25 +327,20 @@ class ApiClient:
326
327
  return obj.isoformat()
327
328
  elif isinstance(obj, decimal.Decimal):
328
329
  return str(obj)
329
-
330
330
  elif isinstance(obj, dict):
331
- obj_dict = obj
331
+ return {key: self.sanitize_for_serialization(val) for key, val in obj.items()}
332
+
333
+ # Convert model obj to dict except
334
+ # attributes `openapi_types`, `attribute_map`
335
+ # and attributes which value is not None.
336
+ # Convert attribute name to json key in
337
+ # model definition for request.
338
+ if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
339
+ obj_dict = obj.to_dict()
332
340
  else:
333
- # Convert model obj to dict except
334
- # attributes `openapi_types`, `attribute_map`
335
- # and attributes which value is not None.
336
- # Convert attribute name to json key in
337
- # model definition for request.
338
- if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009
339
- obj_dict = obj.to_dict()
340
- else:
341
- obj_dict = obj.__dict__
342
-
343
- if isinstance(obj_dict, list):
344
- # 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
345
- return self.sanitize_for_serialization(obj_dict)
341
+ obj_dict = obj.__dict__
346
342
 
347
- return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()}
343
+ return self.sanitize_for_serialization(obj_dict)
348
344
 
349
345
  def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
350
346
  """Deserializes response into an object.
@@ -417,6 +413,8 @@ class ApiClient:
417
413
  return self.__deserialize_datetime(data)
418
414
  elif klass is decimal.Decimal:
419
415
  return decimal.Decimal(data)
416
+ elif klass is uuid.UUID:
417
+ return uuid.UUID(data)
420
418
  elif issubclass(klass, Enum):
421
419
  return self.__deserialize_enum(data, klass)
422
420
  else:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.role import Role
@@ -37,6 +38,9 @@ class AddCustomRoleResponse(BaseModel):
37
38
  @field_validator("resource_id")
38
39
  def resource_id_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
41
45
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
42
46
  return value
@@ -44,12 +48,16 @@ class AddCustomRoleResponse(BaseModel):
44
48
  @field_validator("resource_type")
45
49
  def resource_type_validate_regular_expression(cls, value):
46
50
  """Validates the regular expression"""
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
47
54
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
48
55
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
49
56
  return value
50
57
 
51
58
  model_config = ConfigDict(
52
- populate_by_name=True,
59
+ validate_by_name=True,
60
+ validate_by_alias=True,
53
61
  validate_assignment=True,
54
62
  protected_namespaces=(),
55
63
  )
@@ -60,8 +68,7 @@ class AddCustomRoleResponse(BaseModel):
60
68
 
61
69
  def to_json(self) -> str:
62
70
  """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
72
 
66
73
  @classmethod
67
74
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.member import Member
@@ -36,12 +37,16 @@ class AddMembersPayload(BaseModel):
36
37
  @field_validator("resource_type")
37
38
  def resource_type_validate_regular_expression(cls, value):
38
39
  """Validates the regular expression"""
40
+ if not isinstance(value, str):
41
+ value = str(value)
42
+
39
43
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
40
44
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
41
45
  return value
42
46
 
43
47
  model_config = ConfigDict(
44
- populate_by_name=True,
48
+ validate_by_name=True,
49
+ validate_by_alias=True,
45
50
  validate_assignment=True,
46
51
  protected_namespaces=(),
47
52
  )
@@ -52,8 +57,7 @@ class AddMembersPayload(BaseModel):
52
57
 
53
58
  def to_json(self) -> str:
54
59
  """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
60
+ return json.dumps(to_jsonable_python(self.to_dict()))
57
61
 
58
62
  @classmethod
59
63
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.permission_request import PermissionRequest
@@ -37,12 +38,16 @@ class AddRolePayload(BaseModel):
37
38
  @field_validator("name")
38
39
  def name_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
41
45
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
42
46
  return value
43
47
 
44
48
  model_config = ConfigDict(
45
- populate_by_name=True,
49
+ validate_by_name=True,
50
+ validate_by_alias=True,
46
51
  validate_assignment=True,
47
52
  protected_namespaces=(),
48
53
  )
@@ -53,8 +58,7 @@ class AddRolePayload(BaseModel):
53
58
 
54
59
  def to_json(self) -> str:
55
60
  """Returns the JSON representation of the model using alias"""
56
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
- return json.dumps(self.to_dict())
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
62
 
59
63
  @classmethod
60
64
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, Field
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.authorization.models.zookie import Zookie
@@ -32,7 +33,8 @@ class DeleteRoleResponse(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["writtenAt"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class DeleteRoleResponse(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -20,6 +20,7 @@ from datetime import datetime
20
20
  from typing import Any, ClassVar, Dict, List, Optional, Set
21
21
 
22
22
  from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
23
+ from pydantic_core import to_jsonable_python
23
24
  from typing_extensions import Self
24
25
 
25
26
 
@@ -49,7 +50,8 @@ class ErrorResponse(BaseModel):
49
50
  return value
50
51
 
51
52
  model_config = ConfigDict(
52
- populate_by_name=True,
53
+ validate_by_name=True,
54
+ validate_by_alias=True,
53
55
  validate_assignment=True,
54
56
  protected_namespaces=(),
55
57
  )
@@ -60,8 +62,7 @@ class ErrorResponse(BaseModel):
60
62
 
61
63
  def to_json(self) -> str:
62
64
  """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
65
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
66
 
66
67
  @classmethod
67
68
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -34,12 +35,16 @@ class ExistingPermission(BaseModel):
34
35
  @field_validator("name")
35
36
  def name_validate_regular_expression(cls, value):
36
37
  """Validates the regular expression"""
38
+ if not isinstance(value, str):
39
+ value = str(value)
40
+
37
41
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
38
42
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
39
43
  return value
40
44
 
41
45
  model_config = ConfigDict(
42
- populate_by_name=True,
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
43
48
  validate_assignment=True,
44
49
  protected_namespaces=(),
45
50
  )
@@ -50,8 +55,7 @@ class ExistingPermission(BaseModel):
50
55
 
51
56
  def to_json(self) -> str:
52
57
  """Returns the JSON representation of the model using alias"""
53
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
- return json.dumps(self.to_dict())
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
55
59
 
56
60
  @classmethod
57
61
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.role import Role
@@ -37,6 +38,9 @@ class GetRoleResponse(BaseModel):
37
38
  @field_validator("resource_id")
38
39
  def resource_id_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
41
45
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
42
46
  return value
@@ -44,12 +48,16 @@ class GetRoleResponse(BaseModel):
44
48
  @field_validator("resource_type")
45
49
  def resource_type_validate_regular_expression(cls, value):
46
50
  """Validates the regular expression"""
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
47
54
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
48
55
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
49
56
  return value
50
57
 
51
58
  model_config = ConfigDict(
52
- populate_by_name=True,
59
+ validate_by_name=True,
60
+ validate_by_alias=True,
53
61
  validate_assignment=True,
54
62
  protected_namespaces=(),
55
63
  )
@@ -60,8 +68,7 @@ class GetRoleResponse(BaseModel):
60
68
 
61
69
  def to_json(self) -> str:
62
70
  """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
72
 
66
73
  @classmethod
67
74
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.member import Member
@@ -37,6 +38,9 @@ class ListMembersResponse(BaseModel):
37
38
  @field_validator("resource_id")
38
39
  def resource_id_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
41
45
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
42
46
  return value
@@ -44,12 +48,16 @@ class ListMembersResponse(BaseModel):
44
48
  @field_validator("resource_type")
45
49
  def resource_type_validate_regular_expression(cls, value):
46
50
  """Validates the regular expression"""
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
47
54
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
48
55
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
49
56
  return value
50
57
 
51
58
  model_config = ConfigDict(
52
- populate_by_name=True,
59
+ validate_by_name=True,
60
+ validate_by_alias=True,
53
61
  validate_assignment=True,
54
62
  protected_namespaces=(),
55
63
  )
@@ -60,8 +68,7 @@ class ListMembersResponse(BaseModel):
60
68
 
61
69
  def to_json(self) -> str:
62
70
  """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
72
 
66
73
  @classmethod
67
74
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.authorization.models.permission import Permission
@@ -32,7 +33,8 @@ class ListPermissionsResponse(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["permissions"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class ListPermissionsResponse(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.authorization.models.user_membership import UserMembership
@@ -32,7 +33,8 @@ class ListUserMembershipsResponse(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["items"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class ListUserMembershipsResponse(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
  from stackit.authorization.models.user_permission import UserPermission
@@ -32,7 +33,8 @@ class ListUserPermissionsResponse(BaseModel):
32
33
  __properties: ClassVar[List[str]] = ["items"]
33
34
 
34
35
  model_config = ConfigDict(
35
- populate_by_name=True,
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
36
38
  validate_assignment=True,
37
39
  protected_namespaces=(),
38
40
  )
@@ -43,8 +45,7 @@ class ListUserPermissionsResponse(BaseModel):
43
45
 
44
46
  def to_json(self) -> str:
45
47
  """Returns the JSON representation of the model using alias"""
46
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
- return json.dumps(self.to_dict())
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
48
49
 
49
50
  @classmethod
50
51
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -34,12 +35,16 @@ class Member(BaseModel):
34
35
  @field_validator("role")
35
36
  def role_validate_regular_expression(cls, value):
36
37
  """Validates the regular expression"""
38
+ if not isinstance(value, str):
39
+ value = str(value)
40
+
37
41
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
38
42
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
39
43
  return value
40
44
 
41
45
  model_config = ConfigDict(
42
- populate_by_name=True,
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
43
48
  validate_assignment=True,
44
49
  protected_namespaces=(),
45
50
  )
@@ -50,8 +55,7 @@ class Member(BaseModel):
50
55
 
51
56
  def to_json(self) -> str:
52
57
  """Returns the JSON representation of the model using alias"""
53
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
- return json.dumps(self.to_dict())
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
55
59
 
56
60
  @classmethod
57
61
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.member import Member
@@ -39,6 +40,9 @@ class MembersResponse(BaseModel):
39
40
  @field_validator("resource_id")
40
41
  def resource_id_validate_regular_expression(cls, value):
41
42
  """Validates the regular expression"""
43
+ if not isinstance(value, str):
44
+ value = str(value)
45
+
42
46
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
43
47
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
44
48
  return value
@@ -46,12 +50,16 @@ class MembersResponse(BaseModel):
46
50
  @field_validator("resource_type")
47
51
  def resource_type_validate_regular_expression(cls, value):
48
52
  """Validates the regular expression"""
53
+ if not isinstance(value, str):
54
+ value = str(value)
55
+
49
56
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
50
57
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
51
58
  return value
52
59
 
53
60
  model_config = ConfigDict(
54
- populate_by_name=True,
61
+ validate_by_name=True,
62
+ validate_by_alias=True,
55
63
  validate_assignment=True,
56
64
  protected_namespaces=(),
57
65
  )
@@ -62,8 +70,7 @@ class MembersResponse(BaseModel):
62
70
 
63
71
  def to_json(self) -> str:
64
72
  """Returns the JSON representation of the model using alias"""
65
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
66
- return json.dumps(self.to_dict())
73
+ return json.dumps(to_jsonable_python(self.to_dict()))
67
74
 
68
75
  @classmethod
69
76
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -34,12 +35,16 @@ class Permission(BaseModel):
34
35
  @field_validator("name")
35
36
  def name_validate_regular_expression(cls, value):
36
37
  """Validates the regular expression"""
38
+ if not isinstance(value, str):
39
+ value = str(value)
40
+
37
41
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
38
42
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
39
43
  return value
40
44
 
41
45
  model_config = ConfigDict(
42
- populate_by_name=True,
46
+ validate_by_name=True,
47
+ validate_by_alias=True,
43
48
  validate_assignment=True,
44
49
  protected_namespaces=(),
45
50
  )
@@ -50,8 +55,7 @@ class Permission(BaseModel):
50
55
 
51
56
  def to_json(self) -> str:
52
57
  """Returns the JSON representation of the model using alias"""
53
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
- return json.dumps(self.to_dict())
58
+ return json.dumps(to_jsonable_python(self.to_dict()))
55
59
 
56
60
  @classmethod
57
61
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -33,12 +34,16 @@ class PermissionRequest(BaseModel):
33
34
  @field_validator("name")
34
35
  def name_validate_regular_expression(cls, value):
35
36
  """Validates the regular expression"""
37
+ if not isinstance(value, str):
38
+ value = str(value)
39
+
36
40
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
37
41
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
38
42
  return value
39
43
 
40
44
  model_config = ConfigDict(
41
- populate_by_name=True,
45
+ validate_by_name=True,
46
+ validate_by_alias=True,
42
47
  validate_assignment=True,
43
48
  protected_namespaces=(),
44
49
  )
@@ -49,8 +54,7 @@ class PermissionRequest(BaseModel):
49
54
 
50
55
  def to_json(self) -> str:
51
56
  """Returns the JSON representation of the model using alias"""
52
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
- return json.dumps(self.to_dict())
57
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
58
 
55
59
  @classmethod
56
60
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.member import Member
@@ -37,12 +38,16 @@ class RemoveMembersPayload(BaseModel):
37
38
  @field_validator("resource_type")
38
39
  def resource_type_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
41
45
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
42
46
  return value
43
47
 
44
48
  model_config = ConfigDict(
45
- populate_by_name=True,
49
+ validate_by_name=True,
50
+ validate_by_alias=True,
46
51
  validate_assignment=True,
47
52
  protected_namespaces=(),
48
53
  )
@@ -53,8 +58,7 @@ class RemoveMembersPayload(BaseModel):
53
58
 
54
59
  def to_json(self) -> str:
55
60
  """Returns the JSON representation of the model using alias"""
56
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
- return json.dumps(self.to_dict())
61
+ return json.dumps(to_jsonable_python(self.to_dict()))
58
62
 
59
63
  @classmethod
60
64
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.permission import Permission
@@ -42,6 +43,9 @@ class Role(BaseModel):
42
43
  if value is None:
43
44
  return value
44
45
 
46
+ if not isinstance(value, str):
47
+ value = str(value)
48
+
45
49
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+]{1,})$", value):
46
50
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+]{1,})$/")
47
51
  return value
@@ -49,12 +53,16 @@ class Role(BaseModel):
49
53
  @field_validator("name")
50
54
  def name_validate_regular_expression(cls, value):
51
55
  """Validates the regular expression"""
56
+ if not isinstance(value, str):
57
+ value = str(value)
58
+
52
59
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
53
60
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
54
61
  return value
55
62
 
56
63
  model_config = ConfigDict(
57
- populate_by_name=True,
64
+ validate_by_name=True,
65
+ validate_by_alias=True,
58
66
  validate_assignment=True,
59
67
  protected_namespaces=(),
60
68
  )
@@ -65,8 +73,7 @@ class Role(BaseModel):
65
73
 
66
74
  def to_json(self) -> str:
67
75
  """Returns the JSON representation of the model using alias"""
68
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
- return json.dumps(self.to_dict())
76
+ return json.dumps(to_jsonable_python(self.to_dict()))
70
77
 
71
78
  @classmethod
72
79
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.role import Role
@@ -37,6 +38,9 @@ class RolesResponse(BaseModel):
37
38
  @field_validator("resource_id")
38
39
  def resource_id_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
41
45
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
42
46
  return value
@@ -44,12 +48,16 @@ class RolesResponse(BaseModel):
44
48
  @field_validator("resource_type")
45
49
  def resource_type_validate_regular_expression(cls, value):
46
50
  """Validates the regular expression"""
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
47
54
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
48
55
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
49
56
  return value
50
57
 
51
58
  model_config = ConfigDict(
52
- populate_by_name=True,
59
+ validate_by_name=True,
60
+ validate_by_alias=True,
53
61
  validate_assignment=True,
54
62
  protected_namespaces=(),
55
63
  )
@@ -60,8 +68,7 @@ class RolesResponse(BaseModel):
60
68
 
61
69
  def to_json(self) -> str:
62
70
  """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
72
 
66
73
  @classmethod
67
74
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.permission_request import PermissionRequest
@@ -38,12 +39,16 @@ class UpdateRolePayload(BaseModel):
38
39
  @field_validator("name")
39
40
  def name_validate_regular_expression(cls, value):
40
41
  """Validates the regular expression"""
42
+ if not isinstance(value, str):
43
+ value = str(value)
44
+
41
45
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
42
46
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
43
47
  return value
44
48
 
45
49
  model_config = ConfigDict(
46
- populate_by_name=True,
50
+ validate_by_name=True,
51
+ validate_by_alias=True,
47
52
  validate_assignment=True,
48
53
  protected_namespaces=(),
49
54
  )
@@ -54,8 +59,7 @@ class UpdateRolePayload(BaseModel):
54
59
 
55
60
  def to_json(self) -> str:
56
61
  """Returns the JSON representation of the model using alias"""
57
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
58
- return json.dumps(self.to_dict())
62
+ return json.dumps(to_jsonable_python(self.to_dict()))
59
63
 
60
64
  @classmethod
61
65
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.role import Role
@@ -37,6 +38,9 @@ class UpdateRoleResponse(BaseModel):
37
38
  @field_validator("resource_id")
38
39
  def resource_id_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
41
45
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
42
46
  return value
@@ -44,12 +48,16 @@ class UpdateRoleResponse(BaseModel):
44
48
  @field_validator("resource_type")
45
49
  def resource_type_validate_regular_expression(cls, value):
46
50
  """Validates the regular expression"""
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
47
54
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
48
55
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
49
56
  return value
50
57
 
51
58
  model_config = ConfigDict(
52
- populate_by_name=True,
59
+ validate_by_name=True,
60
+ validate_by_alias=True,
53
61
  validate_assignment=True,
54
62
  protected_namespaces=(),
55
63
  )
@@ -60,8 +68,7 @@ class UpdateRoleResponse(BaseModel):
60
68
 
61
69
  def to_json(self) -> str:
62
70
  """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
72
 
66
73
  @classmethod
67
74
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
 
@@ -36,6 +37,9 @@ class UserMembership(BaseModel):
36
37
  @field_validator("resource_id")
37
38
  def resource_id_validate_regular_expression(cls, value):
38
39
  """Validates the regular expression"""
40
+ if not isinstance(value, str):
41
+ value = str(value)
42
+
39
43
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
40
44
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
41
45
  return value
@@ -43,6 +47,9 @@ class UserMembership(BaseModel):
43
47
  @field_validator("resource_type")
44
48
  def resource_type_validate_regular_expression(cls, value):
45
49
  """Validates the regular expression"""
50
+ if not isinstance(value, str):
51
+ value = str(value)
52
+
46
53
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
47
54
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
48
55
  return value
@@ -50,12 +57,16 @@ class UserMembership(BaseModel):
50
57
  @field_validator("role")
51
58
  def role_validate_regular_expression(cls, value):
52
59
  """Validates the regular expression"""
60
+ if not isinstance(value, str):
61
+ value = str(value)
62
+
53
63
  if not re.match(r"^[a-z](?:[-.]?[a-z]){1,63}$", value):
54
64
  raise ValueError(r"must validate the regular expression /^[a-z](?:[-.]?[a-z]){1,63}$/")
55
65
  return value
56
66
 
57
67
  model_config = ConfigDict(
58
- populate_by_name=True,
68
+ validate_by_name=True,
69
+ validate_by_alias=True,
59
70
  validate_assignment=True,
60
71
  protected_namespaces=(),
61
72
  )
@@ -66,8 +77,7 @@ class UserMembership(BaseModel):
66
77
 
67
78
  def to_json(self) -> str:
68
79
  """Returns the JSON representation of the model using alias"""
69
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
- return json.dumps(self.to_dict())
80
+ return json.dumps(to_jsonable_python(self.to_dict()))
71
81
 
72
82
  @classmethod
73
83
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -19,6 +19,7 @@ import re # noqa: F401
19
19
  from typing import Any, ClassVar, Dict, List, Optional, Set
20
20
 
21
21
  from pydantic import BaseModel, ConfigDict, Field, field_validator
22
+ from pydantic_core import to_jsonable_python
22
23
  from typing_extensions import Annotated, Self
23
24
 
24
25
  from stackit.authorization.models.existing_permission import ExistingPermission
@@ -37,6 +38,9 @@ class UserPermission(BaseModel):
37
38
  @field_validator("resource_id")
38
39
  def resource_id_validate_regular_expression(cls, value):
39
40
  """Validates the regular expression"""
41
+ if not isinstance(value, str):
42
+ value = str(value)
43
+
40
44
  if not re.match(r"^([a-zA-Z0-9\/_|\-=+@.]{1,})$", value):
41
45
  raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9\/_|\-=+@.]{1,})$/")
42
46
  return value
@@ -44,12 +48,16 @@ class UserPermission(BaseModel):
44
48
  @field_validator("resource_type")
45
49
  def resource_type_validate_regular_expression(cls, value):
46
50
  """Validates the regular expression"""
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
47
54
  if not re.match(r"^[a-z](?:-?[a-z]){1,63}$", value):
48
55
  raise ValueError(r"must validate the regular expression /^[a-z](?:-?[a-z]){1,63}$/")
49
56
  return value
50
57
 
51
58
  model_config = ConfigDict(
52
- populate_by_name=True,
59
+ validate_by_name=True,
60
+ validate_by_alias=True,
53
61
  validate_assignment=True,
54
62
  protected_namespaces=(),
55
63
  )
@@ -60,8 +68,7 @@ class UserPermission(BaseModel):
60
68
 
61
69
  def to_json(self) -> str:
62
70
  """Returns the JSON representation of the model using alias"""
63
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
64
- return json.dumps(self.to_dict())
71
+ return json.dumps(to_jsonable_python(self.to_dict()))
65
72
 
66
73
  @classmethod
67
74
  def from_json(cls, json_str: str) -> Optional[Self]:
@@ -18,6 +18,7 @@ import pprint
18
18
  from typing import Any, ClassVar, Dict, List, Optional, Set
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from pydantic_core import to_jsonable_python
21
22
  from typing_extensions import Self
22
23
 
23
24
 
@@ -30,7 +31,8 @@ class Zookie(BaseModel):
30
31
  __properties: ClassVar[List[str]] = ["zookie"]
31
32
 
32
33
  model_config = ConfigDict(
33
- populate_by_name=True,
34
+ validate_by_name=True,
35
+ validate_by_alias=True,
34
36
  validate_assignment=True,
35
37
  protected_namespaces=(),
36
38
  )
@@ -41,8 +43,7 @@ class Zookie(BaseModel):
41
43
 
42
44
  def to_json(self) -> str:
43
45
  """Returns the JSON representation of the model using alias"""
44
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
45
- return json.dumps(self.to_dict())
46
+ return json.dumps(to_jsonable_python(self.to_dict()))
46
47
 
47
48
  @classmethod
48
49
  def from_json(cls, json_str: str) -> Optional[Self]: