diff --git a/python/pydantic_core/core_schema.py b/python/pydantic_core/core_schema.py index 6d265d48e..803569244 100644 --- a/python/pydantic_core/core_schema.py +++ b/python/pydantic_core/core_schema.py @@ -122,37 +122,57 @@ class CoreConfig(TypedDict, total=False): class SerializationInfo(Protocol[ContextT]): + """Extra data used during serialization.""" + @property - def include(self) -> IncExCall: ... + def include(self) -> IncExCall: + """The `include` argument set during serialization.""" + ... @property - def exclude(self) -> IncExCall: ... + def exclude(self) -> IncExCall: + """The `exclude` argument set during serialization.""" + ... @property def context(self) -> ContextT: - """Current serialization context.""" + """The current serialization context.""" ... @property - def mode(self) -> str: ... + def mode(self) -> Literal['python', 'json']: + """The serialization mode set during serialization.""" + ... @property - def by_alias(self) -> bool: ... + def by_alias(self) -> bool: + """The `by_alias` argument set during serialization.""" + ... @property - def exclude_unset(self) -> bool: ... + def exclude_unset(self) -> bool: + """The `exclude_unset` argument set during serialization.""" + ... @property - def exclude_defaults(self) -> bool: ... + def exclude_defaults(self) -> bool: + """The `exclude_defaults` argument set during serialization.""" + ... @property - def exclude_none(self) -> bool: ... + def exclude_none(self) -> bool: + """The `exclude_none` argument set during serialization.""" + ... @property - def serialize_as_any(self) -> bool: ... + def serialize_as_any(self) -> bool: + """The `serialize_as_any` argument set during serialization.""" + ... @property - def round_trip(self) -> bool: ... + def round_trip(self) -> bool: + """The `round_trip` argument set during serialization.""" + ... def mode_is_json(self) -> bool: ... @@ -162,18 +182,20 @@ def __repr__(self) -> str: ... class FieldSerializationInfo(SerializationInfo[ContextT], Protocol): + """Extra data used during field serialization.""" + @property - def field_name(self) -> str: ... + def field_name(self) -> str: + """The name of the current field being serialized.""" + ... class ValidationInfo(Protocol[ContextT]): - """ - Argument passed to validation functions. - """ + """Extra data used during validation.""" @property def context(self) -> ContextT: - """Current validation context.""" + """The current validation context.""" ... @property