-
Notifications
You must be signed in to change notification settings - Fork 30
feat(generated): OrganizationMembership (batch e471ddef) #675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| * [#675](https://github.com/workos/workos-python/pull/675) fix(generated): regenerate from spec | ||
|
|
||
| **Fixes** | ||
| * **[organization_membership](https://workos.com/docs/reference/authkit/organization-membership)**: | ||
| * Added `roles` to organization membership models |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| b6a68da8bd60c1478e0a86ca97c75448677e8871 | ||
| 1a2f47b20f63f2c8f0eb56bbd2adb3b5947d693a |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,6 +206,9 @@ | |
| from .authentication_sso_timed_out_data_sso import ( | ||
| AuthenticationSSOTimedOutDataSSO as AuthenticationSSOTimedOutDataSSO, | ||
| ) | ||
| from .auth_method_mismatch_error import ( | ||
| AuthMethodMismatchError as AuthMethodMismatchError, | ||
| ) | ||
|
Comment on lines
+209
to
+211
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These new re-exports import modules that are not included in the PR, starting with Prompt To Fix With AIThis is a comment left during a code review.
Path: src/workos/common/models/__init__.py
Line: 209-211
Comment:
**Missing Generated Model Modules**
These new re-exports import modules that are not included in the PR, starting with `auth_method_mismatch_error.py` and continuing with the new pipes and session models below. Any import of `workos.common.models` now fails at module load with `ModuleNotFoundError`, so the SDK and the new round-trip tests cannot load.
How can I resolve this? If you propose a fix, please make it concise.
Comment on lines
+209
to
+211
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 New model classes are imported but their source files are missing, preventing the SDK from loading Six new model classes are imported in the package init ( Impact: Any application that imports the Missing source files for newly added importsThe PR adds imports in
None of these Since Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| from .authorization_permission import AuthorizationPermission as AuthorizationPermission | ||
| from .connect_application import ConnectApplication as ConnectApplication | ||
| from .connect_application_m2m import ConnectApplicationM2M as ConnectApplicationM2M | ||
|
|
@@ -459,12 +462,6 @@ | |
| from .organization_domain_deleted_data import ( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The standalone organization-domain state and verification-strategy alias modules still exist, but this change removes their public re-exports from Prompt To Fix With AIThis is a comment left during a code review.
Path: src/workos/common/models/__init__.py
Line: 462
Comment:
**Removed Public Alias Exports**
The standalone organization-domain state and verification-strategy alias modules still exist, but this change removes their public re-exports from `workos.common.models` and `workos.common`. Existing SDK users that import `OrganizationDomainStandAloneState` or `OrganizationDomainStandAloneVerificationStrategy` from those public package surfaces now get `ImportError` even though the underlying aliases were not removed.
How can I resolve this? If you propose a fix, please make it concise. |
||
| OrganizationDomainDeletedData as OrganizationDomainDeletedData, | ||
| ) | ||
| from .organization_domain_stand_alone_state import ( | ||
| OrganizationDomainStandAloneState as OrganizationDomainStandAloneState, | ||
| ) | ||
| from .organization_domain_stand_alone_verification_strategy import ( | ||
| OrganizationDomainStandAloneVerificationStrategy as OrganizationDomainStandAloneVerificationStrategy, | ||
| ) | ||
| from .organization_domain_state import ( | ||
| OrganizationDomainState as OrganizationDomainState, | ||
| ) | ||
|
|
@@ -557,6 +554,12 @@ | |
| from .pipes_connected_account_connected import ( | ||
| PipesConnectedAccountConnected as PipesConnectedAccountConnected, | ||
| ) | ||
| from .pipes_connected_account_connection_failed import ( | ||
| PipesConnectedAccountConnectionFailed as PipesConnectedAccountConnectionFailed, | ||
| ) | ||
| from .pipes_connected_account_connection_failed_data import ( | ||
| PipesConnectedAccountConnectionFailedData as PipesConnectedAccountConnectionFailedData, | ||
| ) | ||
| from .pipes_connected_account_disconnected import ( | ||
| PipesConnectedAccountDisconnected as PipesConnectedAccountDisconnected, | ||
| ) | ||
|
|
@@ -594,6 +597,13 @@ | |
| from .session_created_data_impersonator import ( | ||
| SessionCreatedDataImpersonator as SessionCreatedDataImpersonator, | ||
| ) | ||
| from .session_reauthenticated import SessionReauthenticated as SessionReauthenticated | ||
| from .session_reauthenticated_data import ( | ||
| SessionReauthenticatedData as SessionReauthenticatedData, | ||
| ) | ||
| from .session_reauthenticated_data_impersonator import ( | ||
| SessionReauthenticatedDataImpersonator as SessionReauthenticatedDataImpersonator, | ||
| ) | ||
| from .session_revoked import SessionRevoked as SessionRevoked | ||
| from .session_revoked_data import SessionRevokedData as SessionRevokedData | ||
| from .session_revoked_data_impersonator import ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,3 @@ | |
| from workos.common.models.organization_domain import ( | ||
| OrganizationDomain as OrganizationDomain, | ||
| ) | ||
| from .organization_domain_stand_alone import ( | ||
| OrganizationDomainStandAlone as OrganizationDomainStandAlone, | ||
| ) | ||
|
Comment on lines
-9
to
-11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Removing a model re-export breaks the organization domains feature entirely The re-export of Impact: Calling Incomplete removal: re-export deleted but consumers not updatedThe PR removes the re-export from from .models import OrganizationDomainStandAloneThis import resolves against The resource module uses Additionally, Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| from datetime import datetime | ||
| from enum import Enum | ||
| from typing import cast | ||
| from typing import Any, Dict, Literal, Optional | ||
| from typing import Any, Dict, List, Literal, Optional | ||
| from workos._types import _raise_deserialize_error | ||
| from workos._types import _format_datetime, _parse_datetime | ||
|
|
||
|
|
@@ -39,6 +39,8 @@ class OrganizationMembership: | |
| """An ISO 8601 timestamp.""" | ||
| role: "SlimRole" | ||
| """The primary role assigned to the user within the organization.""" | ||
| roles: List["SlimRole"] | ||
| """The list of roles assigned to the user within the organization.""" | ||
|
Comment on lines
+42
to
+43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 New required The Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| user: "User" | ||
| """The user that belongs to the organization through this membership.""" | ||
| organization_name: Optional[str] = None | ||
|
|
@@ -60,6 +62,10 @@ def from_dict(cls, data: Dict[str, Any]) -> "OrganizationMembership": | |
| created_at=_parse_datetime(data["created_at"]), | ||
| updated_at=_parse_datetime(data["updated_at"]), | ||
| role=SlimRole.from_dict(cast(Dict[str, Any], data["role"])), | ||
| roles=[ | ||
| SlimRole.from_dict(cast(Dict[str, Any], item)) | ||
| for item in cast(list[Any], data["roles"]) | ||
| ], | ||
| user=User.from_dict(cast(Dict[str, Any], data["user"])), | ||
| organization_name=data.get("organization_name"), | ||
| custom_attributes=data.get("custom_attributes"), | ||
|
|
@@ -81,6 +87,7 @@ def to_dict(self) -> Dict[str, Any]: | |
| result["created_at"] = _format_datetime(self.created_at) | ||
| result["updated_at"] = _format_datetime(self.updated_at) | ||
| result["role"] = self.role.to_dict() | ||
| result["roles"] = [item.to_dict() for item in self.roles] | ||
| result["user"] = self.user.to_dict() | ||
| if self.organization_name is not None: | ||
| result["organization_name"] = self.organization_name | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "code": "auth_method_mismatch", | ||
| "message": "This installation uses oauth authentication. Use the POST /:slug/token endpoint instead." | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "object": "event", | ||
| "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "event": "pipes.connected_account.connection_failed", | ||
| "data": { | ||
| "object": "connection_failed", | ||
| "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "provider_slug": "github", | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "error_code": "authorization_code_exchange_error", | ||
| "error_reason": "The authorization code has expired.", | ||
| "provider_error": "access_denied", | ||
| "provider_error_description": "The user denied the authorization request.", | ||
| "created_at": "2026-01-15T12:00:00.000Z" | ||
| }, | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "context": { | ||
| "google_analytics_client_id": "GA1.2.1234567890.1234567890", | ||
| "google_analytics_sessions": [ | ||
| { | ||
| "containerId": "GTM-ABCDEF", | ||
| "sessionId": "1234567890", | ||
| "sessionNumber": "1" | ||
| } | ||
| ], | ||
| "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "actor": { | ||
| "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "source": "api", | ||
| "name": "Jane Doe" | ||
| }, | ||
| "previous_attributes": { | ||
| "key": {} | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "object": "connection_failed", | ||
| "data_integration_id": "data_integration_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "provider_slug": "github", | ||
| "user_id": "user_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "organization_id": "org_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "error_code": "authorization_code_exchange_error", | ||
| "error_reason": "The authorization code has expired.", | ||
| "provider_error": "access_denied", | ||
| "provider_error_description": "The user denied the authorization request.", | ||
| "created_at": "2026-01-15T12:00:00.000Z" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "object": "event", | ||
| "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", | ||
| "event": "session.reauthenticated", | ||
| "data": { | ||
| "object": "session", | ||
| "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", | ||
| "impersonator": { | ||
| "email": "admin@foocorp.com", | ||
| "reason": "Investigating an issue with the customer's account." | ||
| }, | ||
| "ip_address": "198.51.100.42", | ||
| "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", | ||
| "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", | ||
| "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", | ||
| "auth_method": "sso", | ||
| "status": "active", | ||
| "expires_at": "2026-01-15T12:00:00.000Z", | ||
| "ended_at": null, | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z" | ||
| }, | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "context": { | ||
| "google_analytics_client_id": "GA1.2.1234567890.1234567890", | ||
| "google_analytics_sessions": [ | ||
| { | ||
| "containerId": "GTM-ABCDEF", | ||
| "sessionId": "1234567890", | ||
| "sessionNumber": "1" | ||
| } | ||
| ], | ||
| "ajs_anonymous_id": "ajs_anon_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "client_id": "client_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "actor": { | ||
| "id": "user_01EHWNCE74X7JSDV0X3SZ3KJNY", | ||
| "source": "api", | ||
| "name": "Jane Doe" | ||
| }, | ||
| "previous_attributes": { | ||
| "key": {} | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "object": "session", | ||
| "id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", | ||
| "impersonator": { | ||
| "email": "admin@foocorp.com", | ||
| "reason": "Investigating an issue with the customer's account." | ||
| }, | ||
| "ip_address": "198.51.100.42", | ||
| "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", | ||
| "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", | ||
| "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", | ||
| "auth_method": "sso", | ||
| "status": "active", | ||
| "expires_at": "2026-01-15T12:00:00.000Z", | ||
| "ended_at": null, | ||
| "created_at": "2026-01-15T12:00:00.000Z", | ||
| "updated_at": "2026-01-15T12:00:00.000Z" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "email": "admin@foocorp.com", | ||
| "reason": "Investigating an issue with the customer's account." | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 PR appears to be an incomplete code generation commit
The commit message is "chore(generated): shared regenerated files" which suggests this may be a partial commit of auto-generated output. The
.oagen-manifest.jsonlists test fixture files for the new models but does not list correspondingsrc/workos/common/models/source files forauth_method_mismatch_error,session_reauthenticated*, orpipes_connected_account_connection_failed*. This suggests the code generator intentionally did not produce these model files (perhaps they come from a different generation pass), yet the__init__.pyre-exports were added prematurely. Similarly, theOrganizationDomainStandAlonere-export was removed fromorganization_domains/models/__init__.pybut the consumer (_resource.py) was not updated — possibly because_resource.pyis generated by a separate pass. If this PR is meant to land alongside another PR that provides the missing pieces, they should be coordinated to avoid a broken intermediate state on the main branch.Was this helpful? React with 👍 or 👎 to provide feedback.