Skip to content

feat(generated)!: regenerate from spec (5 changes)#397

Open
workos-sdk-automation[bot] wants to merge 7 commits into
mainfrom
oagen/spec-update-dee95fc33c4f813ac60adfa8c57d210db8183dd8
Open

feat(generated)!: regenerate from spec (5 changes)#397
workos-sdk-automation[bot] wants to merge 7 commits into
mainfrom
oagen/spec-update-dee95fc33c4f813ac60adfa8c57d210db8183dd8

Conversation

@workos-sdk-automation
Copy link
Copy Markdown
Contributor

@workos-sdk-automation workos-sdk-automation Bot commented Jun 3, 2026

Summary

feat(api_keys): Add expire API key operation and update expires_at requirement

  • Add ApiKeys.createApiKeyExpire() method to expire, schedule, or clear expiration of API keys
  • Make expires_at field required in ApiKeyCreatedData and ApiKeyRevokedData
  • Add new event models: ApiKeyUpdated, ApiKeyUpdatedData, ApiKeyUpdatedDataOwner, UserApiKeyUpdatedDataOwner, ApiKeyUpdatedDataPreviousAttribute
  • Add api_key.updated webhook event type support

feat(user_management)!: Add name field to user models and remove returnTo from revokeSession

  • Add name field (user's full name) to User, CreateUser, UpdateUser, UserObject, EmailChangeConfirmationUser models
  • Add name parameter to createUser() and updateUser() methods
  • Remove returnTo parameter from revokeSession() method (breaking change)

feat(directory_sync): Replace dsync deactivated events with token lifecycle events

  • Remove DsyncDeactivated, DsyncDeactivatedData, DsyncDeactivatedDataDomain models (breaking changes)
  • Add new token lifecycle event models: DsyncTokenCreated, DsyncTokenCreatedData, DsyncTokenRevoked, DsyncTokenRevokedData

feat(radar): Remove DOMAIN_SIGN_UP_RATE_LIMIT control type

  • Remove DOMAIN_SIGN_UP_RATE_LIMIT enum value from RadarStandaloneResponseControl

feat(audit_logs): Add Snowflake log stream type

  • Add SNOWFLAKE enum value to AuditLogConfigurationLogStreamType

Triggered by workos/openapi-spec@dee95fc

BEGIN_COMMIT_OVERRIDE
feat(api_keys): Add expire API key operation and update expires_at requirement (#397)
feat(user_management)!: Add name field to user models and remove returnTo from revokeSession (#397)
feat(directory_sync): Replace dsync deactivated events with token lifecycle events (#397)
feat(radar): Remove DOMAIN_SIGN_UP_RATE_LIMIT control type (#397)
feat(audit_logs): Add Snowflake log stream type (#397)
END_COMMIT_OVERRIDE

@workos-sdk-automation workos-sdk-automation Bot requested review from a team as code owners June 3, 2026 19:20
@workos-sdk-automation workos-sdk-automation Bot added the autogenerated Autogenerated code or content label Jun 3, 2026
@workos-sdk-automation workos-sdk-automation Bot added the autogenerated Autogenerated code or content label Jun 3, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 3, 2026

Greptile Summary

This auto-generated PR regenerates the WorkOS PHP SDK from an updated OpenAPI spec, introducing five groups of changes: a new createApiKeyExpire endpoint, a name field across user models, replacement of dsync deactivated events with token lifecycle events, removal of a Radar control type, and addition of a Snowflake audit-log stream type.

  • ApiKeys.createApiKeyExpire is added in lib/Service/ApiKeys.php but the implementation passes a raw DateTimeImmutable object directly into the Guzzle json body, which serializes as {} rather than an ISO 8601 string; additionally array_filter strips null, making it impossible to send the explicit null payload the docblock says clears a scheduled expiration.
  • User model updates (User, UserObject, CreateUser, UpdateUser, EmailChangeConfirmationUser) add a nullable name field consistently across resources, service methods, and fixtures.
  • Breaking changes (promoted expiresAt in ApiKeyCreatedData/ApiKeyRevokedData, removed returnTo from revokeSession, removed DsyncDeactivated* models and DomainSignUpRateLimit enum value) are all intentional per the PR description.

Confidence Score: 4/5

Safe to merge after fixing the createApiKeyExpire body serialization; all other changes are additive or expected breaking changes from the spec.

The createApiKeyExpire method sends the raw DateTimeImmutable object to Guzzle's json encoder, which converts it to {}, so any caller supplying a future expiry date will silently send an invalid payload. The array_filter also means the null-clear-expiration use case documented in the method's own docblock cannot actually be exercised. Everything else in the PR — new event models, user name field, enum/model removals — looks correct and consistent with the rest of the codebase.

lib/Service/ApiKeys.php — the new createApiKeyExpire method needs the date formatted before serialization.

Important Files Changed

Filename Overview
lib/Service/ApiKeys.php Adds createApiKeyExpire method, but passes a raw DateTimeImmutable to the JSON body (serializes as {}) and uses array_filter that prevents sending explicit null to clear a scheduled expiration.
lib/Resource/ApiKeyCreatedData.php Promotes expiresAt from an optional trailing parameter to a required positional parameter — intentional breaking change per spec.
lib/Resource/ApiKeyUpdatedData.php New model for api_key.updated webhook event payload; union-type owner discrimination and date handling look correct.
lib/Resource/RevokeSession.php Removes returnTo field — breaking change aligned with spec; remaining sessionId field unchanged.
lib/Service/UserManagement.php Adds name parameter to createUser/updateUser and removes returnTo from revokeSession — all changes consistent with spec and handled correctly.
lib/Resource/ExpireApiKey.php New request body resource for the expire endpoint; correctly formats DateTimeImmutable via RFC3339_EXTENDED in toArray() — the pattern the service method should have used.
tests/Service/ApiKeysTest.php Adds testCreateApiKeyExpire covering happy path; test calls with no $expiresAt so it does not exercise the DateTimeImmutable serialization path or the null-clearing semantics.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["createApiKeyExpire(id, expiresAt)"] --> B{expiresAt value?}
    B -->|"null (default)"| C["array_filter removes key\nBody: {}"]
    B -->|"DateTimeImmutable"| D["array_filter keeps key\nBody: {expires_at: {}}"]
    B -->|"null (to clear expiry)"| C

    C --> E["POST /api_keys/{id}/expire\n{} → API expires key immediately"]
    D --> F["POST /api_keys/{id}/expire\n{expires_at: {}} → API receives invalid payload"]

    subgraph Expected
        G["null → {expires_at: null} → clears expiry"]
        H["DateTimeImmutable → {expires_at: '2030-...'} → schedules expiry"]
    end

    style D fill:#f88,stroke:#c00
    style F fill:#f88,stroke:#c00
Loading

Reviews (1): Last reviewed commit: "chore(generated): add release notes frag..." | Re-trigger Greptile

Comment thread lib/Service/ApiKeys.php
Comment on lines +145 to +147
$body = array_filter([
'expires_at' => $expiresAt,
], fn ($v) => $v !== null);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 DateTimeImmutable serialized as {} in the request body

The HTTP client passes the body to Guzzle's json option (line 227 of HttpClient.php), which calls json_encode internally. DateTimeImmutable does not implement JsonSerializable, so json_encode(new \DateTimeImmutable(...)) returns {}. When a caller passes a future $expiresAt, the API receives {"expires_at":{}} — an invalid value — and will likely return a 400 or silently ignore the field.

Additionally, array_filter removes null entries, so it is impossible to send the explicit "expires_at": null payload that the docblock says clears a scheduled future expiration. Both issues are fixed by formatting the date before serialization and not filtering the field out.

Suggested change
$body = array_filter([
'expires_at' => $expiresAt,
], fn ($v) => $v !== null);
$body = [
'expires_at' => $expiresAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autogenerated Autogenerated code or content

Development

Successfully merging this pull request may close these issues.

0 participants