fix: safely convert random_user_agent to bool for Pydantic 2.13#506
fix: safely convert random_user_agent to bool for Pydantic 2.13#506Watermelcn wants to merge 2 commits into
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughCoerce ChangesBoolean normalization for random_user_agent field & XHTTP validator
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

Fixes #504
Problem: Pydantic 2.13 strict mode converts
Falseto0(int), and when apatternconstraint is applied to a non-string field, it throwsTypeError.Previous approach (#505): Changed
random_user_agentfrombooltostr.This fix: Keeps
random_user_agent: boolas the maintainer intended. Instead, safely converts the database value toboolbefore passing it to the Pydantic model constructor usingbool(value) if value is not None else False.Summary by CodeRabbit