fix: allow null contact first_name and last_name - #255
Draft
gabrielmfern wants to merge 1 commit into
Draft
Conversation
NotRequired[str] said the key may be absent but promised a real str when present. The API returns null, which is the case that type ruled out. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
cubic analysis
No issues found across 2 files
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 and last_name allow null values in retrieve/list response types. | The Contact TypedDict fields changed from NotRequired[str] to Optional[str]. |
| ✅ | Webhook contact first_name and last_name allow both missing keys and null values. | The webhook fields retain NotRequired while adding Optional[str] for their values. |
Auto-approved: Corrects TypedDict types to match actual API behavior (null names), supported by live fixtures and existing Optional convention. Pure type-contract fix with no runtime or operational impact.
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.
gabrielmfern
marked this pull request as ready for review
August 17, 2026 20:23
gabrielmfern
marked this pull request as draft
August 17, 2026 20:27
pedroimpulcetto
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The API returns
nullfor a contact with no name, but both fields were typedNotRequired[str]. That is the wrong axis:NotRequiredsays the key may be absent, while still promising that if the key is there the value is a realstr.nullis precisely the case it ruled out, so a type checker would blesscontact["first_name"].upper()on a value that isNoneat runtime.resend-node's recorded live responses carry
"first_name":nullin 12 separate fixtures, so this is the normal shape for a contact with no name, not an edge case.The two types differ on purpose
Contact(retrieve and list) →Optional[str]. The key is always present in real responses, carryingnullwhen there is no name.ContactEventData(webhook) →NotRequired[Optional[str]]. Here the key really can be missing. Thecontact.createdfixture in resend-dotnet omitsfirst_nameandlast_namefromdataentirely, and the OpenAPI schema'srequiredlist agrees, covering onlyid,created_at,updated_at,email, andunsubscribed. So the webhook needs both "may be absent" and "may be null", while the REST types only need the latter.Optional[str]is already the convention here for nullable response fields, matchingApiKey.last_used_atand theDomainClaimfields.Request types (
CreateParams,UpdateParams) are untouched, since those are inputs.Verification
mypy is clean on both changed files. The only errors it reports are the pre-existing missing stubs for
httpxandrequests, which are unrelated.No test added. These are
TypedDicts with no runtime validation, so a test here could only assert thatjson.loadsreturnsNonefornull, which restates the language rather than the contract. Happy to add one if you would rather have the documentation value.Related
Spec fix in resend/resend-openapi#91, which makes the same correction to
GetContactResponseSuccess,ListContactsResponseSuccess, andContactEventData.Ref DEV-1625
Summary by cubic
Aligns contact name types with actual API behavior to prevent type-checked code from assuming strings when
nullis returned (DEV-1625). Previouslyfirst_name/last_namewereNotRequired[str]; now RESTContactusesOptional[str], and webhookContactEventDatausesNotRequired[Optional[str]].Contact.first_nameorContact.last_name, handleNonebefore calling string methods.Nonewhen keys exist.Written for commit 08b6d5e. Summary will update on new commits.