fix(schema): empty string → None for captions/AD VTT fields (Bug 2B)
Frontend sends audio_description_vtt: "" for CC-only jobs. Pydantic validator converts "" to None before validation, so the backend skips VTT format validation and returns 200 instead of 400. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f2968a2989
commit
9e6ce657bf
1 changed files with 6 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, field_validator
|
||||
|
||||
from ..models.job import (
|
||||
AccessibleVideoProgressItem,
|
||||
|
|
@ -78,6 +78,11 @@ class VttUpdateRequest(BaseModel):
|
|||
if_match: str | None = None # Optimistic locking — SHA1 of expected current content
|
||||
retranslate_languages: bool = False # Re-translate all target languages from updated source VTT
|
||||
|
||||
@field_validator('captions_vtt', 'audio_description_vtt', mode='before')
|
||||
@classmethod
|
||||
def empty_str_to_none(cls, v: Any) -> str | None:
|
||||
return None if v == '' else v
|
||||
|
||||
|
||||
class VttTimingAdjustRequest(BaseModel):
|
||||
offset_seconds: float
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue