Skip to content

Commit 9474626

Browse files
committed
fix(schemas): advertise epoch seconds in expire_after request schema
The expire_after before-validator accepts Unix epoch seconds alongside ISO 8601 strings, but the generated schema only advertised string date-time, so every SDK had to hand-widen the type. Set json_schema_input_type on the three request validators and regenerate openapi.json. Runtime parsing and validation are unchanged.
1 parent 0a56bad commit 9474626

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

openapi.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9592,6 +9592,9 @@
95929592
"type": "string",
95939593
"format": "date-time"
95949594
},
9595+
{
9596+
"type": "integer"
9597+
},
95959598
{
95969599
"type": "null"
95979600
}
@@ -10143,6 +10146,9 @@
1014310146
"type": "string",
1014410147
"format": "date-time"
1014510148
},
10149+
{
10150+
"type": "integer"
10151+
},
1014610152
{
1014710153
"type": "null"
1014810154
}
@@ -12826,6 +12832,9 @@
1282612832
"type": "string",
1282712833
"format": "date-time"
1282812834
},
12835+
{
12836+
"type": "integer"
12837+
},
1282912838
{
1283012839
"type": "null"
1283112840
}

schemas/dto/requests/bulk.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ class BulkUpdateExpiryRequest(BulkIdsRequest):
9090
examples=[1767225600],
9191
)
9292

93-
@field_validator("expire_after", mode="before")
93+
@field_validator(
94+
"expire_after", mode="before", json_schema_input_type=datetime | int | None
95+
)
9496
@classmethod
9597
def _parse_expire_after(cls, v: str | int | None) -> datetime | None:
9698
# Same coercion as UpdateUrlRequest.expire_after — one parser for

schemas/dto/requests/url.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ class CreateUrlRequest(RequestBase):
257257
def _alias_shape(cls, v: str | None) -> str | None:
258258
return _validate_alias_shape(v)
259259

260-
@field_validator("expire_after", mode="before")
260+
@field_validator(
261+
"expire_after", mode="before", json_schema_input_type=datetime | int | None
262+
)
261263
@classmethod
262264
def _parse_expire_after(cls, v: str | int | None) -> datetime | None:
263265
if v is None:
@@ -368,7 +370,9 @@ class UpdateUrlRequest(RequestBase):
368370
def _alias_shape(cls, v: str | None) -> str | None:
369371
return _validate_alias_shape(v)
370372

371-
@field_validator("expire_after", mode="before")
373+
@field_validator(
374+
"expire_after", mode="before", json_schema_input_type=datetime | int | None
375+
)
372376
@classmethod
373377
def _parse_expire_after(cls, v: str | int | None) -> datetime | None:
374378
if v is None:

0 commit comments

Comments
 (0)