Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers = [
"Framework :: FastAPI",
]
dependencies = [
"dhi>=1.1.3",
"dhi>=1.1.15",
]

[project.urls]
Expand Down
20 changes: 10 additions & 10 deletions tests/test_satya_0_4_0_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

import pytest
from dhi import BaseModel, Field, ValidationError, field_validator
from dhi import BaseModel, Field, ValidationError
from turboapi.models import TurboRequest, TurboResponse


Expand Down Expand Up @@ -251,18 +251,18 @@ class User(BaseModel):
assert "alice@example.com" in json_str

def test_field_validator(self):
"""Test field_validator decorator."""
"""Test string transformation with StripWhitespace.

Note: dhi 1.1.15+ uses built-in string transformers like StripWhitespace
instead of field_validator decorators for common string operations.
"""
from typing import Annotated
from dhi import StripWhitespace

class User(BaseModel):
name: str
name: Annotated[str, StripWhitespace()]
email: str

@field_validator('name')
@classmethod
def name_must_not_be_empty(cls, v):
if not v.strip():
raise ValueError('name cannot be empty')
return v.strip()

user = User(name=" Alice ", email="a@b.com")
assert user.name == "Alice"

Expand Down