Skip to content

Fix manager_user_id ValidationError by changing field type from StrictInt to StrictStr#102

Merged
Subterrane merged 2 commits intomainfrom
copilot/fix-100
Sep 2, 2025
Merged

Fix manager_user_id ValidationError by changing field type from StrictInt to StrictStr#102
Subterrane merged 2 commits intomainfrom
copilot/fix-100

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 2, 2025

The manager_user_id field in the User model was causing Pydantic ValidationErrors when calling list_users2_with_http_info with manager_user_id included in the fields parameter.

Problem

The OneLogin API returns manager_user_id values as strings (e.g., "252462756"), but the Pydantic model was defined to expect integers (StrictInt), causing validation errors during API response deserialization:

pydantic_core._pydantic_core.ValidationError: 1 validation error for User
manager_user_id
  Input should be a valid string [type=string_type, input_value=252462756, input_type=int]

Solution

Changed the field definition in onelogin/models/user.py from:

manager_user_id: Optional[StrictInt] = Field(None, description="The OneLogin User ID for the user's manager.")

to:

manager_user_id: Optional[StrictStr] = Field(None, description="The OneLogin User ID for the user's manager.")

This aligns the model definition with the actual API behavior where manager_user_id is returned as a string value.

Testing

  • Added comprehensive test suite covering string values, None values, missing fields, and serialization
  • Verified all existing tests continue to pass (38 user-related tests)
  • Confirmed the original error scenario now works correctly
  • Maintains backward compatibility for edge cases

Fixes #100.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 2, 2025

@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>
Copilot AI changed the title [WIP] list_users2: Pydantic ValidationError when manager_user_id field is required Fix manager_user_id ValidationError by changing field type from StrictInt to StrictStr Sep 2, 2025
Copilot AI requested a review from Subterrane September 2, 2025 12:53
@Subterrane Subterrane marked this pull request as ready for review September 2, 2025 13:00
@Subterrane Subterrane requested a review from Copilot September 2, 2025 13:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_id field type from StrictInt to StrictStr in 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.

Comment thread test/test_user_manager_user_id_fix.py
@Subterrane Subterrane merged commit 1540f07 into main Sep 2, 2025
7 checks passed
@Subterrane Subterrane deleted the copilot/fix-100 branch September 2, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list_users2: Pydantic ValidationError when manager_user_id field is required

3 participants