Open emaheuxPEREN opened 2 weeks ago
Hi @emaheuxPEREN,
Looks like this is fixed on main
, and you can confirm with v2.10.0b1
. Let me know if you're still having issues, and I'd be happy to follow up!
Thank you! Indeed, the example do work with v2.10.0b1
, but it won't work as soon as we use a generic container on top of the custom Pydantic type (which was my use case actually...):
MyRootData = Annotated[
_MyRootData,
PlainValidator(_MyRootData.from_unsafe, json_schema_input_type=list[MyNestedData]), # MODIFIED here
]
print(TypeAdapter(MyRootData).json_schema()) # KeyError: '__main____MyNestedData-Input__1' (as previously)
using:
pydantic version: 2.10.0b1
pydantic-core version: 2.26.0
Ah yeah, looks like we're not resolving refs recursively... cc @viicos.
Initial Checks
Description
I define a custom Pydantic type with
typing.Annotated
+pydantic.PlainValidator(func, json_schema_input_type=OtherType)
syntax :TypeAdapter.json_schema
, as soon asOtherType
is a pydantic type (e.g. a pydantic dataclass in my below example).Full stack trace from example
Example Code
Python, Pydantic & OS Version