from datetime import datetime from typing import Any from ninja import Schema from pydantic import Field class FieldError(Schema): field: str = Field( ..., description="Field name with error (can be nested)", ) issue: str = Field(..., description="Problem description") rejected_value: Any = Field( None, description="Value that failed validation" ) class ApiError(Schema): code: str message: str trace_id: str timestamp: datetime path: str details: dict[str, Any] | None = None class ValidationError(ApiError): field_errors: list[FieldError]