fix(tools): unwrap FieldInfo default to avoid pydantic warning#2955
Open
chaynabors wants to merge 1 commit into
Open
fix(tools): unwrap FieldInfo default to avoid pydantic warning#2955chaynabors wants to merge 1 commit into
chaynabors wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
615a22f to
c72df41
Compare
c72df41 to
2ba90ca
Compare
Contributor
|
/strands review |
Contributor
|
Assessment: Comment (minor changes suggested) The fix is correct and well-targeted. I verified that Review themes
Nice, minimal fix that cleanly resolves the warning without changing the happy path. |
2ba90ca to
828ceef
Compare
Contributor
|
/strands review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The @tool decorator emitted a PydanticJsonSchemaWarning whenever a parameter used Field(default_factory=...) because _extract_annotated_metadata rebuilt the field with Field(default=param_default, ...), nesting the original FieldInfo as the default value. The fix detects when param_default is already a FieldInfo and rebuilds from its default, default_factory, and validation kwargs so constraints like ge, le, and pattern are preserved.
Fixes #1914.