refactor: make API registry authoritative
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import uuid
|
||||
|
||||
|
||||
REQUEST_ID_PATTERN = re.compile(r"[A-Za-z0-9._-]{8,80}")
|
||||
|
||||
|
||||
def correlation_id(supplied: str = "") -> str:
|
||||
value = str(supplied or "").strip()
|
||||
return value if REQUEST_ID_PATTERN.fullmatch(value) else uuid.uuid4().hex
|
||||
Reference in New Issue
Block a user