File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
packages/models-library/src/models_library Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 33from re import Pattern
44from typing import Annotated , ClassVar , Final , TypeAlias
55
6+ import annotated_types
67from common_library .basic_types import BootModeEnum , BuildTargetEnum , LogLevel
78from pydantic import Field , HttpUrl , PositiveInt , StringConstraints
89from pydantic_core import core_schema
7071UUIDStr : TypeAlias = Annotated [str , StringConstraints (pattern = UUID_RE )]
7172
7273
74+ SafeQueryStr : TypeAlias = Annotated [
75+ str ,
76+ StringConstraints (
77+ max_length = 512 , # Reasonable limit for query parameters to avoid overflows
78+ strip_whitespace = True ,
79+ ),
80+ annotated_types .doc (
81+ """
82+ A string that is safe to use in URLs and query parameters.
83+ """ ,
84+ ),
85+ ]
86+
87+
7388# non-empty bounded string used as identifier
7489# e.g. "123" or "name_123" or "fa327c73-52d8-462a-9267-84eeaf0f90e3" but NOT ""
7590_ELLIPSIS_CHAR : Final [str ] = "..."
You can’t perform that action at this time.
0 commit comments