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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from pydantic import (
BaseModel,
ConfigDict,
Field,
StrictBool,
StrictStr,
field_validator,
)
from typing_extensions import Self


Expand All @@ -39,6 +47,32 @@ class AccessToken(BaseModel):
)
__properties: ClassVar[List[str]] = ["active", "createdAt", "id", "token", "validUntil"]

@field_validator("created_at", mode="before")
def created_at_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

@field_validator("valid_until", mode="before")
def valid_until_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from pydantic import (
BaseModel,
ConfigDict,
Field,
StrictBool,
StrictStr,
field_validator,
)
from typing_extensions import Self


Expand All @@ -38,6 +46,32 @@ class AccessTokenMetadata(BaseModel):
)
__properties: ClassVar[List[str]] = ["active", "createdAt", "id", "validUntil"]

@field_validator("created_at", mode="before")
def created_at_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

@field_validator("valid_until", mode="before")
def valid_until_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

Expand Down Expand Up @@ -53,6 +54,19 @@ def algorithm_validate_enum(cls, value):
raise ValueError("must be one of enum values ('RSA_2048', 'RSA_4096')")
return value

@field_validator("valid_until", mode="before")
def valid_until_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

Expand Down Expand Up @@ -63,6 +64,19 @@ class CreateServiceAccountKeyResponse(BaseModel):
"validUntil",
]

@field_validator("created_at", mode="before")
def created_at_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

@field_validator("key_algorithm")
def key_algorithm_validate_enum(cls, value):
"""Validates the enum"""
Expand All @@ -84,6 +98,19 @@ def key_type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('USER_MANAGED', 'SYSTEM_MANAGED')")
return value

@field_validator("valid_until", mode="before")
def valid_until_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from typing_extensions import Self


Expand All @@ -34,6 +35,19 @@ class Error(BaseModel):
time_stamp: datetime = Field(alias="timeStamp")
__properties: ClassVar[List[str]] = ["error", "message", "path", "status", "timeStamp"]

@field_validator("time_stamp", mode="before")
def time_stamp_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

Expand Down Expand Up @@ -63,6 +64,19 @@ class GetServiceAccountKeyResponse(BaseModel):
"validUntil",
]

@field_validator("created_at", mode="before")
def created_at_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

@field_validator("key_algorithm")
def key_algorithm_validate_enum(cls, value):
"""Validates the enum"""
Expand All @@ -84,6 +98,19 @@ def key_type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('USER_MANAGED', 'SYSTEM_MANAGED')")
return value

@field_validator("valid_until", mode="before")
def valid_until_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictBool
from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator
from typing_extensions import Self


Expand All @@ -37,6 +38,19 @@ class PartialUpdateServiceAccountKeyPayload(BaseModel):
)
__properties: ClassVar[List[str]] = ["active", "validUntil"]

@field_validator("valid_until", mode="before")
def valid_until_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set

Expand Down Expand Up @@ -53,6 +54,19 @@ class PartialUpdateServiceAccountKeyResponse(BaseModel):
"validUntil",
]

@field_validator("created_at", mode="before")
def created_at_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

@field_validator("key_algorithm")
def key_algorithm_validate_enum(cls, value):
"""Validates the enum"""
Expand All @@ -74,6 +88,19 @@ def key_type_validate_enum(cls, value):
raise ValueError("must be one of enum values ('USER_MANAGED', 'SYSTEM_MANAGED')")
return value

@field_validator("valid_until", mode="before")
def valid_until_change_year_zero_to_one(cls, value):
"""Workaround which prevents year 0 issue"""
if isinstance(value, str):
# Check for year "0000" at the beginning of the string
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
if value.startswith("0000-01-01T") and re.match(
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
):
# Workaround: Replace "0000" with "0001"
return "0001" + value[4:] # Take "0001" and append the rest of the string
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
import pprint
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from pydantic import (
BaseModel,
ConfigDict,
Field,
StrictBool,
StrictStr,
)
from typing_extensions import Self


Expand Down
Loading