Skip to content

Fix comment parsing without an explicit type present#817

Merged
PierreBtz merged 4 commits intocloudbees-oss:masterfrom
aleksei-averchenko-wise:comment-parsing-fix
May 5, 2026
Merged

Fix comment parsing without an explicit type present#817
PierreBtz merged 4 commits intocloudbees-oss:masterfrom
aleksei-averchenko-wise:comment-parsing-fix

Conversation

@aleksei-averchenko-wise
Copy link
Copy Markdown
Contributor

The type field is not mandatory for comments as per https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/#json-format

Normally, that doesn't matter for parsing because the type is always there - except when dry running a macro: https://developer.zendesk.com/api-reference/ticketing/business-rules/macros/#show-ticket-after-changes

I don't know why, but I did encounter this problem in production after having updated from a very ancient version that didn't use to annotate Comment with @JsonTypeInfo.

This PR fixes the problem by adding defaultImpl = Comment.class to the annotation, which makes Jackson use the base class by default when no type is given. I also added unit tests to verify this behaviour.

Copy link
Copy Markdown
Collaborator

@PierreBtz PierreBtz left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@PierreBtz PierreBtz merged commit 13c5f63 into cloudbees-oss:master May 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants