fix(backend): Align EnterpriseConnection resource with the Backend API response#9156
Conversation
🦋 Changeset detectedLatest commit: f55c1e5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository YAML (base), Repository UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ace6b49 to
7b6b5c0
Compare
1529981 to
d4534fc
Compare
…sponse The resource classes and JSON types drifted from BAPI's serializer (clerk_go api/serialize/enterprise_connection.go): several properties read fields BAPI never sends, and several returned fields were missing. New constructor params are appended to preserve positional compatibility. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d4534fc to
9d3a99e
Compare
…d bump to minor Codex review: BAPI's serializer always sends login_hint (no omitempty, never nil), so the JSON type and resource property are non-nullable. Changeset bumped to minor to match repo precedent for new resource properties (e.g. hasImage). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Description
Stacked on #9155. The
EnterpriseConnectionresource classes and JSON types drifted from what BAPI's serializer returns (clerk_goapi/serialize/enterprise_connection.go). Some properties read fields BAPI never sends — typedstring/booleanbut alwaysundefinedat runtime — and several returned fields were missing from the SDK.What changed:
EnterpriseConnectionnow exposesprovider,logoPublicUrl,allowOrganizationAccountLinking,authenticatable,disableJitProvisioning, andcustomAttributes.EnterpriseConnectionSamlConnectionnow exposesactive,forceAuthn, andloginHint(required and non-null — BAPI's serializer always sends it).EnterpriseConnectionOauthConfignow exposesproviderKey,authUrl,tokenUrl,userInfoUrl, andrequiresPkce.allowSubdomains(only exists on the nested SAML connection) and nestedidpMetadata/syncUserAttributes. Removing them would break positional constructor callers, so they keep their slots and gain@deprecatednotices pointing at the real field.organizationIdis normalized tonullwhen BAPI omits the key, making the declaredstring | nulltrue at runtime.omitemptyin Go (oauthConfig.clientId, the SAMLidp_*fields, certificate timestamps) are retyped| undefinedto match runtime behavior.New constructor params are appended after existing ones. Adding required constructor params to resource classes in a non-major release follows repo precedent (#1544 added
hasImagemid-constructor as a minor); this ships as a minor for the same reason.One review call worth a second opinion: the
| undefinedretyping is a compile-time change for consumers with strict null checks. It converts silent runtimeundefineds into visible type errors, but it will surface in downstream builds on upgrade.Note
Review surfaced an upstream gap: BAPI's
EnterpriseConnectionResponseis missing theobjectdiscriminator its sibling serializers all send, so the SDK's deserializer (which switches onobject) currently returns raw snake_case JSON for enterprise connection responses in production —fromJSONonly runs in tests, where the mock suppliesobject. The mock keepsobjectdeliberately: it exercises the SDK path that the existingObjectType.EnterpriseConnectiondeserializer case defines, and matches the contract once clerk_go adds the field. The upstream fix is filed separately.To test:
pnpm --filter @clerk/backend test— the full suite passes in both node and edge runtimes (1,349 tests each).Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
🤖 Generated with Claude Code