mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -174,6 +174,18 @@ def normalize_uuid(value: str | UUID) -> str:
|
||||
raise ValueError("must be a valid UUID") from exc
|
||||
|
||||
|
||||
def parse_uuid_str_or_none(value: str | None) -> str | None:
|
||||
"""
|
||||
Return None for missing/empty UUID-like values.
|
||||
|
||||
Keep non-empty values unchanged to avoid changing behavior in paths that
|
||||
currently pass placeholder IDs in tests/mocks.
|
||||
"""
|
||||
if value is None or not str(value).strip():
|
||||
return None
|
||||
return str(value)
|
||||
|
||||
|
||||
UUIDStrOrEmpty = Annotated[str, AfterValidator(normalize_uuid)]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user