Skip to content

feat: Add domain claims endpoints#110

Open
kewynakshlley wants to merge 1 commit into
mainfrom
feat/domain-claims
Open

feat: Add domain claims endpoints#110
kewynakshlley wants to merge 1 commit into
mainfrom
feat/domain-claims

Conversation

@kewynakshlley

Copy link
Copy Markdown
Collaborator

No description provided.

@kewynakshlley kewynakshlley requested a review from joaopcm June 29, 2026 01:05

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 7 files

Confidence score: 3/5

  • In src/main/java/com/resend/services/domains/DomainClaims.java (create()), a null claimDomainOptions is 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 mock DomainClaims itself, 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 real DomainClaims logic against HTTP interactions.
  • In src/main/java/com/resend/services/domains/model/DomainClaimResponseSuccess.java, duplicating id, name, status, region, and createdAt instead of extending AbstractDomain increases drift risk if shared domain fields evolve, which can cause inconsistent serialization/deserialization over time — refactor to inherit from AbstractDomain before 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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant