fix: allow null contact first_name and last_name on webhook events - #1073
fix: allow null contact first_name and last_name on webhook events#1073gabrielmfern wants to merge 2 commits into
Conversation
first_name?: string said the key may be absent while still promising a string when present. The payload can omit the key and can send null. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
commit: |
There was a problem hiding this comment.
cubic analysis
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Linked issue analysis
Linked issue: DEV-1625: Allow nullable contact first and last names in OpenAPI
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Contact first_name allows null | The webhook event interface changes first_name from optional string to optional string | null. |
| ✅ | Contact last_name allows null | The webhook event interface changes last_name from optional string to optional string | null. |
Auto-approved: Type-only fix aligning webhook contact first_name/last_name with the API's nullable payload; no runtime, operational, or behavioral change, and it matches existing nullable fields in the same file.
Re-trigger cubic
Approval not submitted
This repository is configured to approve as @klotty, but that approval identity is unavailable.
The refresh token passed is incorrect or expired.
cubic left this as a normal review comment instead of falling back to a Cubic App approval.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Type-only fix aligning webhook event fields with the API's null payloads; no runtime or operational change. Version bump is a routine patch release. No human tradeoff remains.
Re-trigger cubic
Approval not submitted
This repository is configured to approve as @klotty, but that approval identity is unavailable.
Reconnect or verify the approval identity in repository settings.
cubic left this as a normal review comment instead of falling back to a Cubic App approval.
The response types are already right.
Contactincontacts/interfaces/contact.tsusesstring | null, fixed in #757. Only the webhook payload lagged, whereContactEventDatahad:?is the wrong axis on its own. It says the key may be absent, while still promising astringwhenever the key is there. The API sendsnull, which is the case that type rules out, soevent.data.first_namenarrows tostringafter a truthiness check but can holdnullat runtime.Changed to
first_name?: string | null, keeping both halves, because for this payload both are real:contact.createdfixture in resend-dotnet has adataobject with onlyid,created_at,updated_at,email, andunsubscribed. The OpenAPIrequiredlist agrees.nullfor a contact with no name. This repo's own__recordings__carry"first_name":nullin 12 HAR fixtures, though those are the REST endpoints rather than webhook deliveries.string | nullis already used for nullable fields in this same file, onfilename,content_disposition,content_id, andsource_id.Verification
tsc --noEmitis clean and the 80 tests acrosssrc/webhooksandsrc/contactspass.Related
Spec fix in resend/resend-openapi#91, which makes
ContactEventData.first_namenullable there too.Ref DEV-1625
Summary by cubic
Allow webhook contact fields first_name and last_name to be nullable as well as optional to match the API and DEV-1625. Previously they were optional but non-nullable; now both can be absent or null, preventing incorrect string narrowing when the API returns null. No runtime behavior change.
ContactEventDatainsrc/webhooks/interfaces/webhook-event.interface.tstofirst_name?: string | nullandlast_name?: string | null(aligns with existingContacttypes and OpenAPI).resendto6.20.1.Written for commit 3abf777. Summary will update on new commits.
Version bump
Includes a patch bump to
6.20.1inpackage.json. This repo normally bumps in a separatechore:PR, so drop that commit if you would rather keep the split.