feat: Add domain claims endpoints#110
Conversation
There was a problem hiding this comment.
3 issues found across 7 files
Confidence score: 3/5
- In
src/main/java/com/resend/services/domains/DomainClaims.java(create()), a nullclaimDomainOptionsis serialized as the literal string "null", which can send malformed payloads and cause avoidable API failures for callers — add explicit null validation (and fail fast with a clear exception) before merging. - In
src/test/java/com/resend/services/domains/DomainClaimsTest.java, the tests mockDomainClaimsitself, so they don’t verify request path/method construction or error handling; this leaves regression risk in the client behavior despite “passing” tests — replace/add tests that exercise the realDomainClaimslogic against HTTP interactions. - In
src/main/java/com/resend/services/domains/model/DomainClaimResponseSuccess.java, duplicatingid,name,status,region, andcreatedAtinstead of extendingAbstractDomainincreases drift risk if shared domain fields evolve, which can cause inconsistent serialization/deserialization over time — refactor to inherit fromAbstractDomainbefore merging or track it as immediate follow-up.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/main/java/com/resend/services/domains/model/DomainClaimResponseSuccess.java">
<violation number="1" location="src/main/java/com/resend/services/domains/model/DomainClaimResponseSuccess.java:8">
P2: DomainClaimResponseSuccess duplicates fields (id, name, status, region, createdAt) already defined in AbstractDomain. Should extend AbstractDomain instead of defining them all inline.</violation>
</file>
<file name="src/main/java/com/resend/services/domains/DomainClaims.java">
<violation number="1" location="src/main/java/com/resend/services/domains/DomainClaims.java:32">
P2: Missing null validation on `claimDomainOptions` parameter in `create()`. Passing null serializes to the string `"null"`, producing a malformed request body.</violation>
</file>
<file name="src/test/java/com/resend/services/domains/DomainClaimsTest.java">
<violation number="1" location="src/test/java/com/resend/services/domains/DomainClaimsTest.java:25">
P2: The new tests are tautological because they mock `DomainClaims` itself and assert mocked return values, so endpoint paths, HTTP methods, and error handling are never tested.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| /** | ||
| * Represents a domain claim response returned by the claim, get, and verify claim endpoints. | ||
| */ | ||
| public class DomainClaimResponseSuccess { |
There was a problem hiding this comment.
P2: DomainClaimResponseSuccess duplicates fields (id, name, status, region, createdAt) already defined in AbstractDomain. Should extend AbstractDomain instead of defining them all inline.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/java/com/resend/services/domains/model/DomainClaimResponseSuccess.java, line 8:
<comment>DomainClaimResponseSuccess duplicates fields (id, name, status, region, createdAt) already defined in AbstractDomain. Should extend AbstractDomain instead of defining them all inline.</comment>
<file context>
@@ -0,0 +1,186 @@
+/**
+ * Represents a domain claim response returned by the claim, get, and verify claim endpoints.
+ */
+public class DomainClaimResponseSuccess {
+
+ @JsonProperty("object")
</file context>
| * @return A DomainClaimResponseSuccess representing the created claim. | ||
| * @throws ResendException If an error occurs during the domain claim process. | ||
| */ | ||
| public DomainClaimResponseSuccess create(ClaimDomainOptions claimDomainOptions) throws ResendException { |
There was a problem hiding this comment.
P2: Missing null validation on claimDomainOptions parameter in create(). Passing null serializes to the string "null", producing a malformed request body.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/main/java/com/resend/services/domains/DomainClaims.java, line 32:
<comment>Missing null validation on `claimDomainOptions` parameter in `create()`. Passing null serializes to the string `"null"`, producing a malformed request body.</comment>
<file context>
@@ -0,0 +1,79 @@
+ * @return A DomainClaimResponseSuccess representing the created claim.
+ * @throws ResendException If an error occurs during the domain claim process.
+ */
+ public DomainClaimResponseSuccess create(ClaimDomainOptions claimDomainOptions) throws ResendException {
+ String payload = super.resendMapper.writeValue(claimDomainOptions);
+ AbstractHttpResponse<String> response = httpClient.perform("/domains/claim", super.apiKey, HttpMethod.POST, payload, MediaType.get("application/json"));
</file context>
| @BeforeEach | ||
| public void setUp() { | ||
| MockitoAnnotations.openMocks(this); | ||
| domainClaims = mock(DomainClaims.class); |
There was a problem hiding this comment.
P2: The new tests are tautological because they mock DomainClaims itself and assert mocked return values, so endpoint paths, HTTP methods, and error handling are never tested.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/test/java/com/resend/services/domains/DomainClaimsTest.java, line 25:
<comment>The new tests are tautological because they mock `DomainClaims` itself and assert mocked return values, so endpoint paths, HTTP methods, and error handling are never tested.</comment>
<file context>
@@ -0,0 +1,73 @@
+ @BeforeEach
+ public void setUp() {
+ MockitoAnnotations.openMocks(this);
+ domainClaims = mock(DomainClaims.class);
+ }
+
</file context>
No description provided.