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
8 changes: 8 additions & 0 deletions pydantic_core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
'ArgsKwargs',
'SchemaError',
'ErrorDetails',
'InitErrorDetails',
'ValidationError',
'PydanticCustomError',
'PydanticKnownError',
Expand All @@ -59,3 +60,10 @@ class ErrorDetails(_TypedDict):
msg: str
input: _Any
ctx: _NotRequired['dict[str, str | int | float]']


class InitErrorDetails(_TypedDict):
type: 'str | PydanticCustomError'
loc: _NotRequired['tuple[int | str, ...]']
input: _Any
ctx: _NotRequired['dict[str, str | int | float]']
8 changes: 1 addition & 7 deletions pydantic_core/_pydantic_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import decimal
import sys
from typing import Any

from pydantic_core import ErrorDetails
from pydantic_core import ErrorDetails, InitErrorDetails
from pydantic_core.core_schema import CoreConfig, CoreSchema, ErrorType

if sys.version_info < (3, 9):
Expand Down Expand Up @@ -170,12 +170,6 @@ class SchemaError(Exception):
def error_count(self) -> int: ...
def errors(self) -> 'list[ErrorDetails]': ...

class InitErrorDetails(TypedDict):
type: 'str | PydanticCustomError'
loc: NotRequired['tuple[int | str, ...]']
input: Any
ctx: NotRequired['dict[str, str | int | float]']

class ValidationError(ValueError):
def __init__(
self, title: str, errors: 'list[InitErrorDetails]', error_mode: Literal['python', 'json'] = 'python'
Expand Down