Commits
Click on a commit to change the comparison rangeFix forward reference resolution in ValidatedFunction
Closes #19288
This PR fixes an issue where Flow.validate_parameters() fails when using
Pydantic models as parameters with `from __future__ import annotations`.
The problem occurred because the dynamically created validation model
didn't have access to the original function's namespace to resolve
forward references.
The fix adds model_rebuild() with the function's global namespace,
allowing proper resolution of forward references to Pydantic models.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com> Optimize model_rebuild to only run when forward refs detected
This commit adds a performance optimization to avoid calling
model_rebuild() when there are no forward references in the function
signature.
The optimization:
- Detects string annotations during field building
- Only calls model_rebuild() if forward references are found
- Avoids unnecessary overhead for functions without forward refs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>