Feature Request: Update BaseModelTransform to use TypeAdapter
Pydantic's TypeAdapter has dump_python/dump_json (to serialize) and validate_python/validate_json to validate the annotations.
At the moment the BaseModelTransform/SerializationTransform only supports annotating BaseModel or list[BaseModel]. If we switch these to use TypeAdapter we could probably directly use TypeAdapter(annotation).validate_python (or validate_json) to also support validating/serializing annotations like dict[str, BaseModel], or more complicated types.
Thoughts on this suggestion? Happy to give it a attempt at a PR depending on feedback
I think that sounds like a great idea. As I understand, the resulting solution would be backward compatible, but more powerful/general?