Repository navigation
MSD-15205: Review SDKs (recurring) - #146
odunayoogungbure-rgb wants to merge 5 commits into
Conversation
Fixes from an audit of every endpoint against the API docs. - Email: stop sending empty lists (`references: []` failed on Sandbox), `rcpt_to` and the extra `sendAt` key; bulk send now honours `send_at` - Bulk status: handle `validation_errors: null`, keyed `messages_id` and 404 - Users: read invite/update responses unwrapped; stop sending empty permissions/templates/domains - Async email verification: read fields from `data` - Blocklist monitoring: read the integer `blocklisted` count without crashing - SMS: don't wipe webhook events on update; don't disable inbound routes; read the `sms` array on single messages - Domains/SMTP users: send `verified` as 1/0, read `domain`, parse dates - URL-encode query values (DMARC dates, identity and blocklist queries, tags) - Add missing webhook events and WhatsApp media headers/named variables - Keep old names as deprecated aliases (e.g. `customnTrackingEnabled`) - Fixtures: match test names exactly (Linux CI is case-sensitive), replace recorded 401s, redact a token in an old recording; fix README examples Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve README conflicts with the WhatsApp read endpoints: keep main's top-level WhatsApp section and its new API sections, add the media header and named variables examples and the four sender forms for `from`, and keep the blocklist monitoring contents entry only once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep only the fixes for audit-flagged gaps and the tests that cover them. Put the case-only fixture renames back under their original names, restore deleted fixtures, and revert test restructuring, tests on unchanged code, the token name/status checks, fixes outside the audit and README polish. Keep the token redaction in the TokensTest create fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
javac warned that members with a @deprecated Javadoc tag lacked the annotation. Add it to the members this branch deprecates and to the existing Email Add* aliases in the same file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clears the last "deprecated item is not annotated" javac warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[High risk] The API-acceptance claims behind the dropped fields (rcpt_to, inbound address and subdomain, forward secret, editable, auto_generate, subject) rest on the author's audit and the description, and the review's only outside source was a PHP SDK code search, so nothing it read confirms them. The risk is high because the change alters public SDK surfaces (deprecated and transient fields, the SmsInboundRouteBuilderBody.enabled type, and bulkSend now scheduling emails that previously went out … Findings
SummaryFixes SDK request and response gaps found by auditing endpoints against the API reference Request bodies are trimmed so the API no longer sees fields it rejects. Empty lists, What's good
Review context · 1 source · 3/5 commands
Reviewed in 4 parts, each by an agent of its own. Reviews (1) · Last reviewed commit: "MSD-15205: Annotate the deprecated dkim..." · claude-sonnet-5-5 |
| */ | ||
| protected void postDeserialize() { | ||
|
|
||
| for (InboundRoute route : routes) { |
There was a problem hiding this comment.
postDeserialize dereferences routes without a null guard · reliability
getRoutes() now calls response.postDeserialize(), which loops over routes. If a 2xx response has no data array, this throws a NullPointerException, where before the call returned the list with routes == null. The sibling SuppressionList, BlocklistListResponse and SmtpUsersList added in this PR all guard against null.
Suggested fix
Add if (routes == null) { return; } at the start of postDeserialize().
Prompt for a coding agent
In src/main/java/com/mailersend/sdk/inboundroutes/InboundRoutesList.java, add a null guard at the start of postDeserialize(): if routes == null, return, before the for loop.
| private Date parseDate(String date) { | ||
|
|
||
| if (date == null || date.isBlank()) { | ||
|
|
There was a problem hiding this comment.
Private parseDate duplicates the new DateParser utility · maintainability
This PR adds com.mailersend.sdk.util.DateParser and moves the recipients classes to it. TemplateTranslation adds a fourth private copy of the same ISO-instant parsing. It also differs in behaviour: it throws on a malformed or space-separated date, while DateParser returns null or parses the space format.
Suggested fix
Replace the four parseDate(...) calls in postDeserialize() with DateParser.parse(...), delete the private parseDate method, and drop the unused java.time imports.
Prompt for a coding agent
In src/main/java/com/mailersend/sdk/templates/TemplateTranslation.java, import com.mailersend.sdk.util.DateParser, replace parseDate(x) calls in postDeserialize() with DateParser.parse(x), delete the private parseDate method and the now-unused java.time imports.
Summary
Fixes for the gaps an audit of every endpoint against the API reference found. Only the fixes and the tests that cover them.
Changes
references: []was rejected on the Sandbox plan), norrcpt_toor the extrasendAtkeybulkSend()sendssend_at; bulk status handlesvalidation_errors: null, keyedmessages_idand 404data; the verification builder clears its emails aftercreate()blocklistedcount no longer crashes Gson (blocklistedCountadded,blocklistedkept)smsarrayverifiedsent as 1/0, SMTP userdomainread correctly, date fields parsedsubjectno longer sent,auto_generatenot sent on create, missing model fields added,getTemplate()no longer crashes ontotals: []catch_type/match_typereaddomainand the missing create fieldsgetActivities(domainId)requests the last 7 days instead of always throwingcustomnTrackingEnabled→customTrackingEnabled)Risks
bulkSend()withsetSendAt()now schedules the emails; before, they went out immediately.enabled()are now enabled (the API default)SmsInboundRouteBuilderBody.enabledis nowBoolean, which only affects code compiled against that fieldNotes
Dropping
rcpt_tois safe. The API has norcpt_tofield (it only reads camelCasercptTo, and that is for SMTP relay), so validation discarded the value and those addresses never received anything. Removing it doesn't change who an email reaches.How to QA
mvn test: the 45 tests this PR adds pass. On Linux,mainalready has 114 failing tests because fixture file names differ from test names only in letter case, andtestFailureIgnorehides them. This PR leaves that as it is.