I am trying to create issue comments through the v3 cloud API.
I am using the Atlassian Document Format builder NPM package (version 3.3.0).
Most comments seem to get posted just fine through an Axios rest call, however one type of comment seems to get rejected with the error "Comment body is not valid".
This is surprising since usually if your comment is invalid, the adf-builder library will throw the error before it gets to the rest call to POST the comment.
Does anyone have an idea as to what I might be doing wrong?
const doc = new Document();
if (this.isMerge) {
// clipped for brevity
} else {
doc
.panel("info")
.paragraph()
.strong(`PR Created by ${this.props.author} `)
.hardBreak()
.hardBreak()
.link(`View Pull Request`, this.props.url)
.hardBreak()
.hardBreak()
.text(this.props.title)
.hardBreak()
.hardBreak()
.strong("Source Branch: ")
.text(`${this.props.source}`)
.hardBreak()
.strong("Target Branch: ")
.text(` ${this.props.target}`);
}
return doc.toJSON();
And here is the output
{
"body":{
"type":"doc",
"content":[
{
"type":"panel",
"content":[
{
"type":"paragraph",
"content":[
{
"type":"text",
"text":"PR Created by Taylor Ackley ",
"marks":[
{
"type":"strong"
}
]
},
{
"type":"hardBreak",
"attrs":{
"text":"\\n"
}
},
{
"type":"hardBreak",
"attrs":{
"text":"\\n"
}
},
{
"type":"text",
"text":"View Pull Request",
"marks":[
{
"type":"link",
"attrs":{
"href":"some branch"
}
}
]
},
{
"type":"hardBreak",
"attrs":{
"text":"\\n"
}
},
{
"type":"hardBreak",
"attrs":{
"text":"\\n"
}
},
{
"type":"text",
"text":"some ticket"
},
{
"type":"hardBreak",
"attrs":{
"text":"\\n"
}
},
{
"type":"hardBreak",
"attrs":{
"text":"\\n"
}
},
{
"type":"text",
"text":"Source Branch: ",
"marks":[
{
"type":"strong"
}
]
},
{
"type":"text",
"text":"users/taylor/xxxx-xxx"
},
{
"type":"hardBreak",
"attrs":{
"text":"\\n"
}
},
{
"type":"text",
"text":"Target Branch: ",
"marks":[
{
"type":"strong"
}
]
},
{
"type":"text",
"text":" support-20190702"
}
]
}
],
"attrs":{
"panelType":"success"
}
}
],
"version":1
}
}