Skip to content

refactor(express): add union operationId types to handleDecrypt and h…#8631

Merged
rishikeshdadam136 merged 1 commit intomasterfrom
WCI-234
Apr 27, 2026
Merged

refactor(express): add union operationId types to handleDecrypt and h…#8631
rishikeshdadam136 merged 1 commit intomasterfrom
WCI-234

Conversation

@rishikeshdadam136
Copy link
Copy Markdown
Contributor

TICKET-234

Context - https://bitgo.slack.com/archives/C057BHBRG4B/p1764020095794829?thread_ts=1764018507.602879&cid=C057BHBRG4B

Summary

  1. handleDecrypt and handleEncrypt in clientRoutes.ts are each registered for both v1 and v2 routes (express.v1.decrypt/express.decrypt and express.v1.encrypt/express.encrypt), but their parameter types previously only referenced the v2 operationId.
  2. Updated both handlers to use the union type ('express.v1.decrypt' | 'express.decrypt' and 'express.v1.encrypt' | 'express.encrypt') so the TypeScript type accurately reflects both route registrations.

Why this matters
Without the union type, TypeScript only validates the handler against the v2 schema. If v1 and v2 schemas ever diverge (e.g. different request body fields), the v1 registration would silently accept a handler that is only type-safe for v2, leading to potential runtime bugs with no compile-time warning.

Both the end points are splitted in these pr's:#8560
#8553

@linear
Copy link
Copy Markdown

linear Bot commented Apr 27, 2026

@rishikeshdadam136 rishikeshdadam136 marked this pull request as ready for review April 27, 2026 04:05
@rishikeshdadam136 rishikeshdadam136 requested review from a team as code owners April 27, 2026 04:05
Copy link
Copy Markdown
Contributor

@lokesh-bitgo lokesh-bitgo left a comment

Choose a reason for hiding this comment

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

looks good

@rishikeshdadam136 rishikeshdadam136 merged commit 259de64 into master Apr 27, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants