Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refining how we validate flow parameters under Pydantic 1 versus 2
We have seen a few edge cases popping up where we're trying to use the pydantic v2 validator to validate v1 models as flow function arguments. This leads to the opaque error: ``` TypeError: BaseModel.validate() takes 2 positional arguments but 3 were given ``` Examples: * PrefectHQ/prefect-airbyte#61 * https://github.com/PrefectHQ/prefect-kubernetes/actions/runs/6628004996/job/18004160832?pr=92 The issue here is that we were trying to use our custom v2 port of the v1 `ValidatedFunction`, without inspecting the types of models involved. Here, we are looking at the types of the passed arguments, validating that they aren't mixing v1 and v2 models, and then choosing the right validation implementation from there.
- Loading branch information