Hi,
can you provide the Graphql command for sending a comment?
Should I make a commit in order to send the comment?
To which element is Comment attached ? Object id?
Best,
Dimitrios
Hi,
can you provide the Graphql command for sending a comment?
Should I make a commit in order to send the comment?
To which element is Comment attached ? Object id?
Best,
Dimitrios
Nominally, you can comment on Streams, Commits, Objects or other Comments
mutation CommentCreateInput {
commentCreate(
input: {
streamId: STREAM_ID,
resources: [
{
resourceType: RESOURCE_TYPE
resourceId: RESOURCE_ID,
}
],
text: "🍌 Bananagram 🍌",
data: {
location: {
x: MODELSPACE_X (float),
y: MODELSPACE_Y (float),
z: MODELSPACE_Z (float)
}
}
}
)
}
These are all mandatory fields.
The data
object is critical to not breaking the web viewer. There are other fields, the GraphQL docs don’t list them, but make a comment and query it). but I have found that if you do not include the location
object, the viewer will become unresponsive as the code is specifically looking for this to render. (I should probably file this as a bug)
resourceId
is straightforward, but the resourceType is an enum and not a string, values are: comment
, object
, commit
, stream
I’ve only really had success with objects
and commits
, and again, only with that minimum data
object but that could be me not forming the mutation correctly ???
Hi Jonathon,
thanks! I have tried the way below and it seems to work although I get an error as return.
mutation {
commentCreate(
input: {
streamId: "98fa53b0a6",
resources: [{resourceId: "2bbd7caeaf"
resourceType: commit
}],
text: "just another comment"
data: {location:{x: 0.0, y: 0.0, z: 0.0}},
screenshot: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAAaSURBVDhPY3gro0ISGtVADBrVQAwadBpkVADPEy0Q0V9lSAAAAABJRU5ErkJggg=="
}
)
}
return output
{
"errors": [
{
"message": "Cannot convert object to primitive value",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"commentCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}
Also, after inserting this comment, the web interface seems broken. I can not do any more comments with the web interface. Probably a bug @AlanRynne tested with Chrome and Firefox
I should have said, I always get that error too. But, I have only had the viewer break if the location was missing.
ok, initially I have omitted the location. This might triggered the issue which I figured much afterwards.
Hey @Dimitrios.Ververidis and @jonathon
sorry for the breakages around our fairly unformalized comments API, this is def the result of us moving quickly and not being ready to formalize a schema around the comment.data
object.
The issue will be tracked in Malformed comments raised on Commits or Objects crash the viewer · Issue #806 · specklesystems/speckle-server · GitHub
Hi,
I’m getting this same error respons, what am I missing or is it the current status?
Ie posting the comment works and the viewer is not broken, though I’m getting the error response from this request:
mutation CommentCreateInput{
commentCreate(input: {
streamId: "streamId"
resources: [{resourceType: commit, resourceId: "resourceId"}]
blobIds: []
screenshot: null
text: {
type: "doc"
content: [{
type: "paragraph"
content: [{
type: "text"
text: "text"
}]
}]
}
data: {
location: {
x: -12.714323814046612
y: 8.734966716089001
z: 0.1666666716337204
}
}
})
}
Response:
{
"errors": [
{
"message": "Cannot convert object to primitive value",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"commentCreate"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
}
}
],
"data": null
}