jira.js icon indicating copy to clipboard operation
jira.js copied to clipboard

Support for threaded comment replies

Open lukiffer opened this issue 1 month ago • 0 comments

I'm trying to use issueComments.addComment() to reply to an existing comment. However, it's not readily apparent how to supply the required parentId property.

The official documentation seems to call this out via "Additional Properties; Extra properties of any type may be provided to this object." https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post

I've tried supplying parentId in the entity properties, but it returns a 400 INVALID_INPUT.

What does work is supplying it in the request body and calling the API directly:

await this._request.post(`${ this.baseUrl }/rest/api/3/issue/${ issueIdOrKey }/comment`, {
  body: {
    content: [{
      content: [{
        text: 'This is a test.',
        type: 'text',
      }],
      type: 'paragraph',
    }],
    type: 'doc',
    version: 1,
  },
  parentId: 330796, // The numeric ID of the comment to which you're replying.
}, {
  headers: this._getHeaders(),
});

So I suppose this boils down to two questions:

  1. Is there a way to supply arbitrary properties for objects that support "Extra properties of any type may be provided to this object."?
  2. For issue comments specifically, would it make sense to add parentId as an optional field on the model as a convenience?

lukiffer avatar Dec 10 '25 14:12 lukiffer