Fix manager_user_id ValidationError by changing field type from StrictInt to StrictStr#102
Fix manager_user_id ValidationError by changing field type from StrictInt to StrictStr#102Subterrane merged 2 commits intomainfrom
Conversation
|
@Subterrane 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
…to StrictStr Co-authored-by: Subterrane <5290140+Subterrane@users.noreply.github.com>
manager_user_id field is requiredThere was a problem hiding this comment.
Pull Request Overview
This PR fixes a Pydantic ValidationError that occurs when the OneLogin API returns manager_user_id values as strings, but the model expected integers. The fix changes the field type from StrictInt to StrictStr to align with the actual API behavior.
- Changes the
manager_user_idfield type fromStrictInttoStrictStrin the User model - Adds comprehensive test coverage for the field with string values, None values, missing fields, and serialization scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| onelogin/models/user.py | Updates manager_user_id field type from StrictInt to StrictStr to match API response format |
| test/test_user_manager_user_id_fix.py | Adds comprehensive test suite covering various scenarios for the manager_user_id field fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
The
manager_user_idfield in the User model was causing Pydantic ValidationErrors when callinglist_users2_with_http_infowithmanager_user_idincluded in the fields parameter.Problem
The OneLogin API returns
manager_user_idvalues as strings (e.g.,"252462756"), but the Pydantic model was defined to expect integers (StrictInt), causing validation errors during API response deserialization:Solution
Changed the field definition in
onelogin/models/user.pyfrom:to:
This aligns the model definition with the actual API behavior where
manager_user_idis returned as a string value.Testing
Fixes #100.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.