when doing a POST to
/projects/{projectId}/tasks/
the body must contain a
projectId
and a
placement
or a
HTTP: 500
is returned, which I deduce is a serialization error, expecting something that's not there, which I'll walk you through:
Sending a request that's like what's documented at https://developers.taskade.com/docs/api/tasks/create:
curl -X 'POST' \ 'https://www.taskade.com/api/v1/projects/REDACTED/tasks/' \
-H 'accept: application/json' \
-H 'Authorization: Bearer REDACTED' \
-H 'Content-Type: application/json' \
-d '{
"tasks": [
{
"contentType": "text/markdown",
"content": "test 4"
}
]
}'
returning:
{
"statusCode": 500,
"code": "FST_ERR_FAILED_ERROR_SERIALIZATION",
"message": "Failed to serialize an error. Error: [\n {\n \"code\": \"invalid_literal\",\n \"expected\": false,\n \"path\": [\n \"ok\"\n ],\n \"message\": \"Invalid literal value, expected false\"\n },\n {\n \"code\": \"invalid_type\",\n \"expected\": \"string\",\n \"received\": \"undefined\",\n \"path\": [\n \"code\"\n ],\n \"message\": \"Required\"\n },\n {\n \"code\": \"invalid_type\",\n \"expected\": \"string\",\n \"received\": \"undefined\",\n \"path\": [\n \"statusMessage\"\n ],\n \"message\": \"Required\"\n }\n]. Original error: [\n {\n \"code\": \"invalid_type\",\n \"expected\": \"string\",\n \"received\": \"undefined\",\n \"path\": [\n \"message\"\n ],\n \"message\": \"Required\"\n },\n {\n \"code\": \"invalid_type\",\n \"expected\": \"string\",\n \"received\": \"undefined\",\n \"path\": [\n \"statusMessage\"\n ],\n \"message\": \"Required\"\n }\n]"
}
the expanded
.message
:
"Failed to serialize an error. Error: [
{
"code": "invalid_literal",
"expected": false,
"path": [
"ok"
],
"message": "Invalid literal value, expected false"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"code"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"statusMessage"
],
"message": "Required"
}
]. Original error: [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"message"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"statusMessage"
],
"message": "Required"
}
]"
I was looking at the schema, trying to understand why this would be the case and I'm not sure how concrete it is, but I thought maybe the
allOf
was a requirement, meaning it necessarily needed the
projectId
and
placement
fields to be included (see images, which are from https://developers.taskade.com/docs/api/tasks/create)
a successful request is like:
curl -X 'POST' \
'https://www.taskade.com/api/v1/projects/REDACTED/tasks/' \
-H 'accept: application/json' \
-H 'Authorization: Bearer REDACTED' \
-H 'Content-Type: application/json' \
-d '{
"tasks": [
{
"taskId": "REDACTED",
"placement": "afterbegin",
"contentType": "text/markdown",
"content": "test 4"
}
]
}'
Maybe a potential bug, with the raw schema showing an
allOf
,
anyOf
logic requiring something different than what is documented. This is a presumption of mine, I presume this is from code generation and the schema logic is exposing what the serializer is
actually
expecting - a reference to
"code": "FST_ERR_FAILED_ERROR_SERIALIZATION"
.