-
Notifications
You must be signed in to change notification settings - Fork 33
feat(generated): OrganizationMembership (batch 4a353f07) #504
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 @@ | ||
| * [#504](https://github.com/workos/workos-ruby/pull/504) 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 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -75,6 +75,12 @@ module WorkOS | |||||||||||||||||||||
| sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } | ||||||||||||||||||||||
| def role=(value); end | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| sig { returns(T::Array[WorkOS::SlimRole]) } | ||||||||||||||||||||||
| def roles; end | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| sig { params(value: T::Array[WorkOS::SlimRole]).returns(T::Array[WorkOS::SlimRole]) } | ||||||||||||||||||||||
| def roles=(value); end | ||||||||||||||||||||||
|
Comment on lines
+78
to
+82
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 Ruby model keeps
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: rbi/workos/user_organization_membership.rbi
Line: 78-82
Comment:
**Nullable Roles Type Mismatch**
The Ruby model keeps `nil` entries in `roles`, but this RBI tells Sorbet callers every element is a `WorkOS::SlimRole`. When the API returns `roles: [null]`, typed callers can safely compile code like `membership.roles.each { |role| role.slug }` and then crash at runtime.
```suggestion
sig { returns(T::Array[T.nilable(WorkOS::SlimRole)]) }
def roles; end
sig { params(value: T::Array[T.nilable(WorkOS::SlimRole)]).returns(T::Array[T.nilable(WorkOS::SlimRole)]) }
def roles=(value); end
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| sig { returns(WorkOS::User) } | ||||||||||||||||||||||
| def user; end | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1099,39 +1099,6 @@ def test_object_metadata_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
|
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. This deletion removes round-trip coverage for still-existing public models such as Prompt To Fix With AIThis is a comment left during a code review.
Path: test/workos/test_model_round_trip.rb
Line: 1099
Comment:
**Public Models Lose Coverage**
This deletion removes round-trip coverage for still-existing public models such as `WorkOS::ObjectSummary`, `WorkOS::ObjectVersion`, and `WorkOS::EventSchema`. A later regeneration can now drop or mis-key fields like `etag`, `size`, `data`, or `context` while this model round-trip suite still passes.
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| end | ||
|
|
||
| def test_object_summary_round_trip | ||
| fixture = { | ||
| "id" => "stub", | ||
| "name" => "stub", | ||
| "updated_at" => nil | ||
| } | ||
| model = WorkOS::ObjectSummary.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| assert_equal fixture["name"], json[:name] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_object_version_round_trip | ||
| fixture = { | ||
| "created_at" => "stub", | ||
| "current_version" => true, | ||
| "etag" => "stub", | ||
| "id" => "stub", | ||
| "size" => 1 | ||
| } | ||
| model = WorkOS::ObjectVersion.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["created_at"], json[:created_at] | ||
| assert_equal fixture["current_version"], json[:current_version] | ||
| assert_equal fixture["etag"], json[:etag] | ||
| assert_equal fixture["id"], json[:id] | ||
| assert_equal fixture["size"], json[:size] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_object_without_value_round_trip | ||
| fixture = { | ||
| "id" => "stub", | ||
|
|
@@ -1926,24 +1893,6 @@ def test_waitlist_user_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_event_schema_round_trip | ||
| fixture = { | ||
| "object" => "event", | ||
| "id" => "stub", | ||
| "event" => "stub", | ||
| "data" => {}, | ||
| "created_at" => "stub", | ||
| "context" => {} | ||
| } | ||
| model = WorkOS::EventSchema.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| assert_equal fixture["event"], json[:event] | ||
| assert_equal fixture["created_at"], json[:created_at] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_action_authentication_denied_round_trip | ||
| fixture = { | ||
| "object" => "event", | ||
|
|
@@ -6181,30 +6130,6 @@ def test_waitlist_user_denied_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_organization_domain_stand_alone_round_trip | ||
| fixture = { | ||
| "object" => "organization_domain", | ||
| "id" => "stub", | ||
| "organization_id" => "stub", | ||
| "domain" => "stub", | ||
| "state" => "stub", | ||
| "verification_prefix" => "stub", | ||
| "verification_token" => "stub", | ||
| "verification_strategy" => "stub", | ||
| "created_at" => "stub", | ||
| "updated_at" => "stub" | ||
| } | ||
| model = WorkOS::OrganizationDomainStandAlone.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| assert_equal fixture["organization_id"], json[:organization_id] | ||
| assert_equal fixture["domain"], json[:domain] | ||
| assert_equal fixture["created_at"], json[:created_at] | ||
| assert_equal fixture["updated_at"], json[:updated_at] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_flag_round_trip | ||
| fixture = { | ||
| "object" => "feature_flag", | ||
|
|
@@ -6233,32 +6158,6 @@ def test_flag_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_organization_api_key_round_trip | ||
| fixture = { | ||
| "object" => "api_key", | ||
| "id" => "stub", | ||
| "owner" => {}, | ||
| "name" => "stub", | ||
| "obfuscated_value" => "stub", | ||
| "last_used_at" => nil, | ||
| "expires_at" => nil, | ||
| "permissions" => [], | ||
| "created_at" => "stub", | ||
| "updated_at" => "stub" | ||
| } | ||
| model = WorkOS::OrganizationApiKey.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| assert_equal fixture["name"], json[:name] | ||
| assert_equal fixture["obfuscated_value"], json[:obfuscated_value] | ||
| assert_nil json[:last_used_at] | ||
| assert_nil json[:expires_at] | ||
| assert_equal fixture["created_at"], json[:created_at] | ||
| assert_equal fixture["updated_at"], json[:updated_at] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_organization_api_key_with_value_round_trip | ||
| fixture = { | ||
| "object" => "api_key", | ||
|
|
@@ -6595,6 +6494,7 @@ def test_user_organization_membership_round_trip | |
| "created_at" => "stub", | ||
| "updated_at" => "stub", | ||
| "role" => {}, | ||
| "roles" => [], | ||
| "user" => {} | ||
| } | ||
| model = WorkOS::UserOrganizationMembership.new(fixture.to_json) | ||
|
|
@@ -6938,6 +6838,30 @@ def test_jwt_template_response_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_organization_domain_round_trip | ||
| fixture = { | ||
| "object" => "organization_domain", | ||
| "id" => "stub", | ||
| "organization_id" => "stub", | ||
| "domain" => "stub", | ||
| "state" => "stub", | ||
| "verification_prefix" => "stub", | ||
| "verification_token" => "stub", | ||
| "verification_strategy" => "stub", | ||
| "created_at" => "stub", | ||
| "updated_at" => "stub" | ||
| } | ||
| model = WorkOS::OrganizationDomain.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| assert_equal fixture["organization_id"], json[:organization_id] | ||
| assert_equal fixture["domain"], json[:domain] | ||
| assert_equal fixture["created_at"], json[:created_at] | ||
| assert_equal fixture["updated_at"], json[:updated_at] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_jwks_response_keys_round_trip | ||
| fixture = { | ||
| "alg" => "RS256", | ||
|
|
@@ -7099,30 +7023,6 @@ def test_audit_log_configuration_log_stream_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_organization_domain_round_trip | ||
| fixture = { | ||
| "object" => "organization_domain", | ||
| "id" => "stub", | ||
| "organization_id" => "stub", | ||
| "domain" => "stub", | ||
| "state" => "stub", | ||
| "verification_prefix" => "stub", | ||
| "verification_token" => "stub", | ||
| "verification_strategy" => "stub", | ||
| "created_at" => "stub", | ||
| "updated_at" => "stub" | ||
| } | ||
| model = WorkOS::OrganizationDomain.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| assert_equal fixture["organization_id"], json[:organization_id] | ||
| assert_equal fixture["domain"], json[:domain] | ||
| assert_equal fixture["created_at"], json[:created_at] | ||
| assert_equal fixture["updated_at"], json[:updated_at] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_organization_api_key_with_value_owner_round_trip | ||
| fixture = { | ||
| "type" => "organization", | ||
|
|
@@ -7135,18 +7035,6 @@ def test_organization_api_key_with_value_owner_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_organization_api_key_owner_round_trip | ||
| fixture = { | ||
| "type" => "organization", | ||
| "id" => "stub" | ||
| } | ||
| model = WorkOS::OrganizationApiKeyOwner.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_flag_owner_round_trip | ||
| fixture = { | ||
| "email" => "stub", | ||
|
|
@@ -7162,17 +7050,6 @@ def test_flag_owner_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_event_list_list_metadata_round_trip | ||
| fixture = { | ||
| "after" => nil | ||
| } | ||
| model = WorkOS::EventListListMetadata.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_nil json[:after] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_directory_user_email_round_trip | ||
| fixture = { | ||
| "primary" => true, | ||
|
|
@@ -7379,21 +7256,6 @@ def test_audit_log_schema_target_round_trip | |
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_authorized_connect_application_list_data_round_trip | ||
| fixture = { | ||
| "object" => "authorized_connect_application", | ||
| "id" => "stub", | ||
| "granted_scopes" => [], | ||
| "oauth_resource" => "stub", | ||
| "application" => {} | ||
| } | ||
| model = WorkOS::AuthorizedConnectApplicationListData.new(fixture.to_json) | ||
| json = model.to_h | ||
| assert_kind_of Hash, json | ||
| assert_equal fixture["id"], json[:id] | ||
| fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } | ||
| end | ||
|
|
||
| def test_api_key_owner_round_trip | ||
| fixture = { | ||
| "type" => "organization", | ||
|
|
@@ -7831,6 +7693,7 @@ def test_organization_membership_round_trip | |
| "created_at" => "stub", | ||
| "updated_at" => "stub", | ||
| "role" => {}, | ||
| "roles" => [], | ||
| "user" => {} | ||
| } | ||
| model = WorkOS::OrganizationMembership.new(fixture.to_json) | ||
|
|
||
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.
The Ruby model keeps
nilentries inroles, but this RBI tells Sorbet callers every element is aWorkOS::SlimRole. When the API returnsroles: [null], typed callers can safely compile code likemembership.roles.each { |role| role.slug }and then crash at runtime.Prompt To Fix With AI