fix: allow null contact first_name and last_name - #255
Conversation
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.
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 correction of contact name fields to accurately reflect nullable API responses; no runtime or operational tradeoff, version bump is trivial.
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.
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>
bbbbeb8 to
5bb8baa
Compare
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
Allow null contact first_name and last_name in response and webhook types to match API behavior and address DEV-1625. Previously the types allowed missing keys but not nulls; now REST
ContactusesOptional[str]and webhookContactEventDatausesNotRequired[Optional[str]].Contact.first_name/last_nameas optional and possiblyNone; in webhooks these keys may be absent and, if present, may beNone. No changes to request params or runtime behavior.Written for commit 5bb8baa. Summary will update on new commits.
Version bump
Includes a patch bump to
2.36.1inresend/version.py. This repo normally bumps in a separatechore:PR, so drop that commit if you would rather keep the split.