diff --git a/Cargo.lock b/Cargo.lock index 86f0eab7f..7c610daa5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", "getrandom", @@ -43,9 +43,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -93,9 +93,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "idna" @@ -119,9 +119,9 @@ dependencies = [ [[package]] name = "indoc" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2d6f23ffea9d7e76c53eee25dfb67bcd8fde7f1198b0855350698c9f07c780" +checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" [[package]] name = "itoa" @@ -197,9 +197,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", @@ -216,9 +216,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ "unicode-ident", ] @@ -248,7 +248,8 @@ dependencies = [ [[package]] name = "pyo3" version = "0.18.1" -source = "git+https://github.com/PyO3/pyo3?branch=release-0.18.1#184c085f54deced70d630a388788fbe3a644b492" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06a3d8e8a46ab2738109347433cb7b96dffda2e4a218b03ef27090238886b147" dependencies = [ "cfg-if", "indoc", @@ -264,7 +265,8 @@ dependencies = [ [[package]] name = "pyo3-build-config" version = "0.18.1" -source = "git+https://github.com/PyO3/pyo3?branch=release-0.18.1#184c085f54deced70d630a388788fbe3a644b492" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75439f995d07ddfad42b192dfcf3bc66a7ecfd8b4a1f5f6f046aa5c2c5d7677d" dependencies = [ "once_cell", "target-lexicon", @@ -273,7 +275,8 @@ dependencies = [ [[package]] name = "pyo3-ffi" version = "0.18.1" -source = "git+https://github.com/PyO3/pyo3?branch=release-0.18.1#184c085f54deced70d630a388788fbe3a644b492" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839526a5c07a17ff44823679b68add4a58004de00512a95b6c1c98a6dcac0ee5" dependencies = [ "libc", "pyo3-build-config", @@ -282,7 +285,8 @@ dependencies = [ [[package]] name = "pyo3-macros" version = "0.18.1" -source = "git+https://github.com/PyO3/pyo3?branch=release-0.18.1#184c085f54deced70d630a388788fbe3a644b492" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd44cf207476c6a9760c4653559be4f206efafb924d3e4cbf2721475fc0d6cc5" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -293,7 +297,8 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" version = "0.18.1" -source = "git+https://github.com/PyO3/pyo3?branch=release-0.18.1#184c085f54deced70d630a388788fbe3a644b492" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1f43d8e30460f36350d18631ccf85ded64c059829208fe680904c65bcd0a4c" dependencies = [ "proc-macro2", "quote", @@ -361,9 +366,9 @@ checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "7434af0dc1cbd59268aa98b4c22c131c0584d2232f6fb166efb993e2832e896a" dependencies = [ "indexmap", "itoa", @@ -437,15 +442,15 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" @@ -493,9 +498,18 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", diff --git a/Cargo.toml b/Cargo.toml index 77a57a2ec..36c8d223a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,9 +26,7 @@ include = [ ] [dependencies] -# required since `Py_Ellipsis` fails on windows, see https://github.com/PyO3/pyo3/pull/2911 -pyo3 = { git = "https://github.com/PyO3/pyo3", branch = "release-0.18.1" } -#pyo3 = "0.18.0" +pyo3 = "0.18.1" regex = "1.6.0" strum = { version = "0.24.1", features = ["derive"] } strum_macros = "0.24.3" @@ -67,6 +65,4 @@ strip = true [build-dependencies] version_check = "0.9.4" # used where logic has to be version/distribution specific, e.g. pypy -# FIXME change when `pyo3` above is updated -pyo3-build-config = { git = "https://github.com/PyO3/pyo3", branch = "release-0.18.1" } -#pyo3 = "0.18.0" +pyo3-build-config = "0.18.1" diff --git a/generate_self_schema.py b/generate_self_schema.py index 87fdcd09c..ffa2bcf97 100644 --- a/generate_self_schema.py +++ b/generate_self_schema.py @@ -122,14 +122,14 @@ def type_dict_schema(typed_dict) -> dict[str, Any]: # noqa: C901 if matched: required = True - if 'CoreSchema' == fr_arg or re.search('[^a-zA-Z]CoreSchema', fr_arg): - if fr_arg == 'CoreSchema': + if 'CoreSchemaBase' == fr_arg or re.search('[^a-zA-Z]CoreSchemaBase', fr_arg): + if fr_arg == 'CoreSchemaBase': schema = schema_ref_validator - elif fr_arg == 'List[CoreSchema]': + elif fr_arg == 'List[CoreSchemaBase]': schema = {'type': 'list', 'items_schema': schema_ref_validator} - elif fr_arg == 'Dict[str, CoreSchema]': + elif fr_arg == 'Dict[str, CoreSchemaBase]': schema = {'type': 'dict', 'keys_schema': {'type': 'str'}, 'values_schema': schema_ref_validator} - elif fr_arg == 'Dict[str, Union[str, CoreSchema]]': + elif fr_arg == 'Dict[str, Union[str, CoreSchemaBase]]': schema = { 'type': 'dict', 'keys_schema': {'type': 'str'}, diff --git a/pydantic_core/core_schema.py b/pydantic_core/core_schema.py index ea2b45400..b1670c6f4 100644 --- a/pydantic_core/core_schema.py +++ b/pydantic_core/core_schema.py @@ -191,7 +191,7 @@ def __call__(self, __input_value: Any, __serializer: SerializeWrapHandler, __inf class FunctionWrapSerSchema(TypedDict, total=False): type: Required[Literal['function-wrap']] function: Required[SerializeWrapFunction] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] json_return_type: JsonReturnTypes when_used: WhenUsed # default: 'always' @@ -262,7 +262,7 @@ def to_string_ser_schema(*, when_used: WhenUsed = 'json-unless-none') -> ToStrin class ModelSerSchema(TypedDict, total=False): type: Required[Literal['model']] cls: Required[Type[Any]] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] def model_ser_schema(cls: Type[Any], schema: CoreSchema) -> ModelSerSchema: @@ -281,7 +281,11 @@ def model_ser_schema(cls: Type[Any], schema: CoreSchema) -> ModelSerSchema: ] -class AnySchema(TypedDict, total=False): +class CoreSchemaBase(TypedDict): + ... + + +class AnySchema(CoreSchemaBase, total=False): type: Required[Literal['any']] ref: str extra: Any @@ -307,7 +311,7 @@ def any_schema(*, ref: str | None = None, extra: Any = None, serialization: SerS return dict_not_none(type='any', ref=ref, extra=extra, serialization=serialization) -class NoneSchema(TypedDict, total=False): +class NoneSchema(CoreSchemaBase, total=False): type: Required[Literal['none']] ref: str extra: Any @@ -333,7 +337,7 @@ def none_schema(*, ref: str | None = None, extra: Any = None, serialization: Ser return dict_not_none(type='none', ref=ref, extra=extra, serialization=serialization) -class BoolSchema(TypedDict, total=False): +class BoolSchema(CoreSchemaBase, total=False): type: Required[Literal['bool']] strict: bool ref: str @@ -363,7 +367,7 @@ def bool_schema( return dict_not_none(type='bool', strict=strict, ref=ref, extra=extra, serialization=serialization) -class IntSchema(TypedDict, total=False): +class IntSchema(CoreSchemaBase, total=False): type: Required[Literal['int']] multiple_of: int le: int @@ -423,7 +427,7 @@ def int_schema( ) -class FloatSchema(TypedDict, total=False): +class FloatSchema(CoreSchemaBase, total=False): type: Required[Literal['float']] allow_inf_nan: bool # whether 'NaN', '+inf', '-inf' should be forbidden. default: True multiple_of: float @@ -487,7 +491,7 @@ def float_schema( ) -class StringSchema(TypedDict, total=False): +class StringSchema(CoreSchemaBase, total=False): type: Required[Literal['str']] pattern: str max_length: int @@ -551,7 +555,7 @@ def str_schema( ) -class BytesSchema(TypedDict, total=False): +class BytesSchema(CoreSchemaBase, total=False): type: Required[Literal['bytes']] max_length: int min_length: int @@ -599,7 +603,7 @@ def bytes_schema( ) -class DateSchema(TypedDict, total=False): +class DateSchema(CoreSchemaBase, total=False): type: Required[Literal['date']] strict: bool le: date @@ -666,7 +670,7 @@ def date_schema( ) -class TimeSchema(TypedDict, total=False): +class TimeSchema(CoreSchemaBase, total=False): type: Required[Literal['time']] strict: bool le: time @@ -715,7 +719,7 @@ def time_schema( ) -class DatetimeSchema(TypedDict, total=False): +class DatetimeSchema(CoreSchemaBase, total=False): type: Required[Literal['datetime']] strict: bool le: datetime @@ -787,7 +791,7 @@ def datetime_schema( ) -class TimedeltaSchema(TypedDict, total=False): +class TimedeltaSchema(CoreSchemaBase, total=False): type: Required[Literal['timedelta']] strict: bool le: timedelta @@ -836,7 +840,7 @@ def timedelta_schema( ) -class LiteralSchema(TypedDict, total=False): +class LiteralSchema(CoreSchemaBase, total=False): type: Required[Literal['literal']] expected: Required[List[Any]] ref: str @@ -870,7 +874,7 @@ def literal_schema( JsonType = Literal['null', 'bool', 'int', 'float', 'str', 'list', 'dict'] -class IsInstanceSchema(TypedDict, total=False): +class IsInstanceSchema(CoreSchemaBase, total=False): type: Required[Literal['is-instance']] cls: Required[Any] cls_repr: str @@ -927,7 +931,7 @@ class A: ) -class IsSubclassSchema(TypedDict, total=False): +class IsSubclassSchema(CoreSchemaBase, total=False): type: Required[Literal['is-subclass']] cls: Required[Type[Any]] cls_repr: str @@ -973,7 +977,7 @@ class B(A): ) -class CallableSchema(TypedDict, total=False): +class CallableSchema(CoreSchemaBase, total=False): type: Required[Literal['callable']] ref: str extra: Any @@ -1014,9 +1018,9 @@ def filter_seq_schema(*, include: Set[int] | None = None, exclude: Set[int] | No IncExSeqOrElseSerSchema = Union[IncExSeqSerSchema, SerSchema] -class ListSchema(TypedDict, total=False): +class ListSchema(CoreSchemaBase, total=False): type: Required[Literal['list']] - items_schema: CoreSchema + items_schema: CoreSchemaBase min_length: int max_length: int strict: bool @@ -1070,11 +1074,11 @@ def list_schema( ) -class TuplePositionalSchema(TypedDict, total=False): +class TuplePositionalSchema(CoreSchemaBase, total=False): type: Required[Literal['tuple']] mode: Required[Literal['positional']] - items_schema: Required[List[CoreSchema]] - extra_schema: CoreSchema + items_schema: Required[List[CoreSchemaBase]] + extra_schema: CoreSchemaBase strict: bool ref: str extra: Any @@ -1119,10 +1123,10 @@ def tuple_positional_schema( ) -class TupleVariableSchema(TypedDict, total=False): +class TupleVariableSchema(CoreSchemaBase, total=False): type: Required[Literal['tuple']] mode: Literal['variable'] - items_schema: CoreSchema + items_schema: CoreSchemaBase min_length: int max_length: int strict: bool @@ -1173,9 +1177,9 @@ def tuple_variable_schema( ) -class SetSchema(TypedDict, total=False): +class SetSchema(CoreSchemaBase, total=False): type: Required[Literal['set']] - items_schema: CoreSchema + items_schema: CoreSchemaBase min_length: int max_length: int generator_max_length: int @@ -1229,9 +1233,9 @@ def set_schema( ) -class FrozenSetSchema(TypedDict, total=False): +class FrozenSetSchema(CoreSchemaBase, total=False): type: Required[Literal['frozenset']] - items_schema: CoreSchema + items_schema: CoreSchemaBase min_length: int max_length: int generator_max_length: int @@ -1285,9 +1289,9 @@ def frozenset_schema( ) -class GeneratorSchema(TypedDict, total=False): +class GeneratorSchema(CoreSchemaBase, total=False): type: Required[Literal['generator']] - items_schema: CoreSchema + items_schema: CoreSchemaBase max_length: int ref: str extra: Any @@ -1350,10 +1354,10 @@ def filter_dict_schema(*, include: IncExDict | None = None, exclude: IncExDict | IncExDictOrElseSerSchema = Union[IncExDictSerSchema, SerSchema] -class DictSchema(TypedDict, total=False): +class DictSchema(CoreSchemaBase, total=False): type: Required[Literal['dict']] - keys_schema: CoreSchema # default: AnySchema - values_schema: CoreSchema # default: AnySchema + keys_schema: CoreSchemaBase # default: AnySchema + values_schema: CoreSchemaBase # default: AnySchema min_length: int max_length: int strict: bool @@ -1415,11 +1419,11 @@ def __call__( ... -class FunctionSchema(TypedDict, total=False): +class FunctionSchema(CoreSchemaBase, total=False): type: Required[Literal['function']] mode: Required[Literal['before', 'after']] function: Required[ValidatorFunction] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] ref: str extra: Any serialization: SerSchema @@ -1528,11 +1532,11 @@ def __call__( ... -class FunctionWrapSchema(TypedDict, total=False): +class FunctionWrapSchema(CoreSchemaBase, total=False): type: Required[Literal['function']] mode: Required[Literal['wrap']] function: Required[WrapValidatorFunction] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] ref: str extra: Any serialization: SerSchema @@ -1580,7 +1584,7 @@ def fn(v: str, *, validator, **kwargs) -> str: ) -class FunctionPlainSchema(TypedDict, total=False): +class FunctionPlainSchema(CoreSchemaBase, total=False): type: Required[Literal['function']] mode: Required[Literal['plain']] function: Required[ValidatorFunction] @@ -1618,9 +1622,9 @@ def fn(v: str, **kwargs) -> str: ) -class WithDefaultSchema(TypedDict, total=False): +class WithDefaultSchema(CoreSchemaBase, total=False): type: Required[Literal['default']] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] default: Any default_factory: Callable[[], Any] on_error: Literal['raise', 'omit', 'default'] # default: 'raise' @@ -1682,9 +1686,9 @@ def with_default_schema( return s -class NullableSchema(TypedDict, total=False): +class NullableSchema(CoreSchemaBase, total=False): type: Required[Literal['nullable']] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] strict: bool ref: str extra: Any @@ -1721,9 +1725,9 @@ def nullable_schema( ) -class UnionSchema(TypedDict, total=False): +class UnionSchema(CoreSchemaBase, total=False): type: Required[Literal['union']] - choices: Required[List[CoreSchema]] + choices: Required[List[CoreSchemaBase]] # default true, whether to automatically collapse unions with one element to the inner validator auto_collapse: bool custom_error_type: str @@ -1782,9 +1786,9 @@ def union_schema( ) -class TaggedUnionSchema(TypedDict, total=False): +class TaggedUnionSchema(CoreSchemaBase, total=False): type: Required[Literal['tagged-union']] - choices: Required[Dict[str, Union[str, CoreSchema]]] + choices: Required[Dict[str, Union[str, CoreSchemaBase]]] discriminator: Required[ Union[str, List[Union[str, int]], List[List[Union[str, int]]], Callable[[Any], Optional[str]]] ] @@ -1863,9 +1867,9 @@ def tagged_union_schema( ) -class ChainSchema(TypedDict, total=False): +class ChainSchema(CoreSchemaBase, total=False): type: Required[Literal['chain']] - steps: Required[List[CoreSchema]] + steps: Required[List[CoreSchemaBase]] ref: str extra: Any serialization: SerSchema @@ -1899,10 +1903,10 @@ def fn(v: str, **kwargs) -> str: return dict_not_none(type='chain', steps=steps, ref=ref, extra=extra, serialization=serialization) -class LaxOrStrictSchema(TypedDict, total=False): +class LaxOrStrictSchema(CoreSchemaBase, total=False): type: Required[Literal['lax-or-strict']] - lax_schema: Required[CoreSchema] - strict_schema: Required[CoreSchema] + lax_schema: Required[CoreSchemaBase] + strict_schema: Required[CoreSchemaBase] strict: bool ref: str extra: Any @@ -1959,8 +1963,8 @@ def fn(v: str, **kwargs) -> str: ) -class TypedDictField(TypedDict, total=False): - schema: Required[CoreSchema] +class TypedDictField(CoreSchemaBase, total=False): + schema: Required[CoreSchemaBase] required: bool validation_alias: Union[str, List[Union[str, int]], List[List[Union[str, int]]]] serialization_alias: str @@ -2001,11 +2005,11 @@ def typed_dict_field( ) -class TypedDictSchema(TypedDict, total=False): +class TypedDictSchema(CoreSchemaBase, total=False): type: Required[Literal['typed-dict']] fields: Required[Dict[str, TypedDictField]] strict: bool - extra_validator: CoreSchema + extra_validator: CoreSchemaBase return_fields_set: bool # all these values can be set via config, equivalent fields have `typed_dict_` prefix extra_behavior: Literal['allow', 'forbid', 'ignore'] @@ -2071,10 +2075,10 @@ def typed_dict_schema( ) -class ModelSchema(TypedDict, total=False): +class ModelSchema(CoreSchemaBase, total=False): type: Required[Literal['model']] cls: Required[Type[Any]] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] call_after_init: str strict: bool config: CoreConfig @@ -2145,7 +2149,7 @@ class MyModel: class ArgumentsParameter(TypedDict, total=False): name: Required[str] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] mode: Literal['positional_only', 'positional_or_keyword', 'keyword_only'] # default positional_or_keyword alias: Union[str, List[Union[str, int]], List[List[Union[str, int]]]] @@ -2174,12 +2178,12 @@ def arguments_parameter( return dict_not_none(name=name, schema=schema, mode=mode, alias=alias) -class ArgumentsSchema(TypedDict, total=False): +class ArgumentsSchema(CoreSchemaBase, total=False): type: Required[Literal['arguments']] arguments_schema: Required[List[ArgumentsParameter]] populate_by_name: bool - var_args_schema: CoreSchema - var_kwargs_schema: CoreSchema + var_args_schema: CoreSchemaBase + var_kwargs_schema: CoreSchemaBase ref: str extra: Any serialization: SerSchema @@ -2227,11 +2231,11 @@ def arguments_schema( ) -class CallSchema(TypedDict, total=False): +class CallSchema(CoreSchemaBase, total=False): type: Required[Literal['call']] - arguments_schema: Required[CoreSchema] + arguments_schema: Required[CoreSchemaBase] function: Required[Callable[..., Any]] - return_schema: CoreSchema + return_schema: CoreSchemaBase ref: str extra: Any serialization: SerSchema @@ -2283,7 +2287,7 @@ def call_schema( ) -class RecursiveReferenceSchema(TypedDict, total=False): +class RecursiveReferenceSchema(CoreSchemaBase, total=False): type: Required[Literal['recursive-ref']] schema_ref: Required[str] extra: Any @@ -2312,9 +2316,9 @@ def recursive_reference_schema( return dict_not_none(type='recursive-ref', schema_ref=schema_ref, extra=extra, serialization=serialization) -class CustomErrorSchema(TypedDict, total=False): +class CustomErrorSchema(CoreSchemaBase, total=False): type: Required[Literal['custom-error']] - schema: Required[CoreSchema] + schema: Required[CoreSchemaBase] custom_error_type: Required[str] custom_error_message: str custom_error_context: Dict[str, Union[str, int, float]] @@ -2366,9 +2370,9 @@ def custom_error_schema( ) -class JsonSchema(TypedDict, total=False): +class JsonSchema(CoreSchemaBase, total=False): type: Required[Literal['json']] - schema: CoreSchema + schema: CoreSchemaBase ref: str extra: Any serialization: SerSchema @@ -2414,7 +2418,7 @@ class MyModel: return dict_not_none(type='json', schema=schema, ref=ref, extra=extra, serialization=serialization) -class UrlSchema(TypedDict, total=False): +class UrlSchema(CoreSchemaBase, total=False): type: Required[Literal['url']] max_length: int allowed_schemes: List[str] @@ -2479,7 +2483,7 @@ def url_schema( ) -class MultiHostUrlSchema(TypedDict, total=False): +class MultiHostUrlSchema(CoreSchemaBase, total=False): type: Required[Literal['multi-host-url']] max_length: int allowed_schemes: List[str]