Skip to content

fix(backend): Align EnterpriseConnection resource with the Backend API response#9156

Open
manovotny wants to merge 2 commits into
manovotny/amazing-lalande-e031c2from
manovotny/enterprise-connection-response-alignment
Open

fix(backend): Align EnterpriseConnection resource with the Backend API response#9156
manovotny wants to merge 2 commits into
manovotny/amazing-lalande-e031c2from
manovotny/enterprise-connection-response-alignment

Conversation

@manovotny

@manovotny manovotny commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description

Stacked on #9155. The EnterpriseConnection resource classes and JSON types drifted from what BAPI's serializer returns (clerk_go api/serialize/enterprise_connection.go). Some properties read fields BAPI never sends — typed string/boolean but always undefined at runtime — and several returned fields were missing from the SDK.

What changed:

  • EnterpriseConnection now exposes provider, logoPublicUrl, allowOrganizationAccountLinking, authenticatable, disableJitProvisioning, and customAttributes.
  • EnterpriseConnectionSamlConnection now exposes active, forceAuthn, and loginHint (required and non-null — BAPI's serializer always sends it).
  • EnterpriseConnectionOauthConfig now exposes providerKey, authUrl, tokenUrl, userInfoUrl, and requiresPkce.
  • Phantom fields are deprecated, not removed: top-level allowSubdomains (only exists on the nested SAML connection) and nested idpMetadata/syncUserAttributes. Removing them would break positional constructor callers, so they keep their slots and gain @deprecated notices pointing at the real field.
  • organizationId is normalized to null when BAPI omits the key, making the declared string | null true at runtime.
  • Fields backed by pointer+omitempty in Go (oauthConfig.clientId, the SAML idp_* fields, certificate timestamps) are retyped | undefined to 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 hasImage mid-constructor as a minor); this ships as a minor for the same reason.

One review call worth a second opinion: the | undefined retyping is a compile-time change for consumers with strict null checks. It converts silent runtime undefineds into visible type errors, but it will surface in downstream builds on upgrade.

Note

Review surfaced an upstream gap: BAPI's EnterpriseConnectionResponse is missing the object discriminator its sibling serializers all send, so the SDK's deserializer (which switches on object) currently returns raw snake_case JSON for enterprise connection responses in production — fromJSON only runs in tests, where the mock supplies object. The mock keeps object deliberately: it exercises the SDK path that the existing ObjectType.EnterpriseConnection deserializer 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 test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f55c1e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@clerk/backend Minor
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

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

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jul 14, 2026 5:32am
swingset Ready Ready Preview, Comment Jul 14, 2026 5:32am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 97415ce9-bdd8-4c82-ba42-a492fde40354

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

…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>
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant