Constrained scalar types¶
The constrained scalars under didactic.types.
didactic.types._types_lib.SecretStr ¶
Wraps a string so its repr / serialisation hides the value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The wrapped string. Stored verbatim; never printed. |
required |
Examples:
The remaining members of didactic.types are annotation aliases:
| name | shape |
|---|---|
EmailStr |
Annotated[str, _StringPattern(<email regex>, "email")] |
HttpUrl |
Annotated[str, _StringPattern(<http url regex>, "http_url")] |
Json[T] |
Annotated[str, _JsonOf(inner=T)] |
Use them as drop-in field annotations: