zendesk-java-client icon indicating copy to clipboard operation
zendesk-java-client copied to clipboard

Add TpeVoiceComment to CommentType enum

Open diendanyoi54 opened this issue 1 year ago • 0 comments

I recently attempted to upgrade our Java client from 0.13.0 to 0.25.0 because of the Cursor-based pagination update on May 20, 2024 but after making the switch, errors occurred when getTicketComments was called. We have comments that implement Talk Partner Edition which saves the comment type as TpeVoiceComment but the Comment object's type field of CommentType only has VoiceComment and Comment available so when deserializing the comment it throws an error.

package org.zendesk.client.v2.model;

public enum CommentType {
    COMMENT("Comment"),
    VOICE_COMMENT("VoiceComment");

    private final String name;

    private CommentType(String name) {
        this.name = name;
    }

    public String toString() {
        return this.name;
    }
}

Steps to reproduce the behavior:

  1. Create a comment either with the API or in the GUI with type TpeVoiceComment
  2. Retrieve comment with the Cloudbees Java client using the getTicketComments method
  3. See the error:
org.zendesk.client.v2.ZendeskException: java.lang.IllegalArgumentException: Cannot deserialize value of type org.zendesk.client.v2.model.CommentType from String "TpeVoiceComment": not one of the values accepted for Enum class: [VoiceComment, Comment]
 at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: org.zendesk.client.v2.model.Comment["type"])

When Cloudbees getTicketComments method is called, the expectation is that it will be able to properly deserialize TpeVoiceComment so it will not throw an error and instead properly return the comment.

  • Java Temurin 17.0.10
  • Version 0.25.0

diendanyoi54 avatar Apr 30 '24 13:04 diendanyoi54