Skip to content

Commit

Permalink
fix: Allow unknown properties from the API (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
kewynakshlley authored Jan 15, 2024
1 parent fd74b37 commit f3e5655
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/resend/core/mapper/ResendMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
Expand All @@ -17,6 +18,7 @@ public class ResendMapper implements IMapper {
public ResendMapper() {
this.mapper = new ObjectMapper();
this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
this.mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class RemoveContactResponseSuccess extends BaseContact {
@JsonProperty("deleted")
private boolean deleted;

@JsonProperty("contact")
private String contact;

/**
* Default constructor
*/
Expand All @@ -23,8 +26,9 @@ public RemoveContactResponseSuccess() {
* @param id The ID of the removed contact.
* @param object The object of the removed contact.
* @param deleted The state of the removed contact.
* @param contact The contact of the removed contact.
*/
public RemoveContactResponseSuccess(final String id, final String object, final boolean deleted) {
public RemoveContactResponseSuccess(final String id, final String object, final boolean deleted, final String contact) {
super(id, object);
this.deleted = deleted;
}
Expand All @@ -37,4 +41,13 @@ public RemoveContactResponseSuccess(final String id, final String object, final
public boolean getRemoved() {
return deleted;
}

/**
* Gets the contact of the removed item.
*
* @return The contact of the removed item.
*/
public String getContact() {
return contact;
}
}
2 changes: 1 addition & 1 deletion src/test/java/com/resend/services/util/ContactsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static CreateContactResponseSuccess createContactResponseSuccess() {
}

public static RemoveContactResponseSuccess removeContactResponseSuccess() {
return new RemoveContactResponseSuccess("123", "contact", true);
return new RemoveContactResponseSuccess("123", "contact", true, "contact");
}

public static ListContactsResponseSuccess createContactsListResponse() {
Expand Down

0 comments on commit f3e5655

Please sign in to comment.