Skip to content

Conversation

@DanChov
Copy link
Contributor

@DanChov DanChov commented Jan 5, 2026

This PR adds a small helper function to normalize role inputs so callers can pass either a role Enum instance or a string (case/whitespace-insensitive). Invalid inputs return None, allowing the caller to handle validation consistently.

solves: #265

@DanChov DanChov requested review from MarcelGeo, harminius and varmar05 and removed request for MarcelGeo and harminius January 5, 2026 15:10
Copy link
Contributor

@harminius harminius left a comment

Choose a reason for hiding this comment

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

Ellegant 👍

Copy link
Contributor

@varmar05 varmar05 left a comment

Choose a reason for hiding this comment

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

Looking good, just some minor suggestions.

"""
self.check_collaborators_members_support()

role_enum = normalize_role(workspace_role, WorkspaceRole)
Copy link
Contributor

Choose a reason for hiding this comment

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

if we want to get rid of repeated code you can try to wrap this up in some decorator which would make sure that arg would be always Enum

if expected is None:
assert result is None
else:
assert result == expected
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be enough for all cases

@DanChov DanChov requested a review from varmar05 January 12, 2026 15:11
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.

4 participants