Skip to content

Quick add task returns a validation error #146

@thomaslombart

Description

@thomaslombart

Bug description

I've tried the quickAddTask method by doing the following call:

const { url, id } = await todoist.quickAddTask({
  text: "Do something p1 tom",
});

But I got a ValidationError:

08:55:40.489 /Users/thomas/extensions/extensions/todoist/node_modules/runtypes/lib/errors.js:22
        var _this = _super.call(this, failure.message) || this;
                           ^

ValidationError: Validation failed:
{
  "createdAt": "Expected string, but was undefined"
}.
Object should match { id: string; order: number; content: string; description: string; projectId: string; isCompleted: boolean; labels: string[]; priority: number; commentCount: number; createdAt: string; url: string; creatorId: string; }
    at null.ValidationError2 (/Users/thomas/extensions/extensions/todoist/node_modules/runtypes/lib/errors.js:22:28)
    at Object.check (/Users/thomas/extensions/extensions/todoist/node_modules/runtypes/lib/runtype.js:37:19)
    at null.validateTask (/Users/thomas/extensions/extensions/todoist/node_modules/@doist/todoist-api-typescript/dist/utils/validators.js:6:25)
    at TodoistApi3.<anonymous> (/Users/thomas/extensions/extensions/todoist/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:113:64)
    at null.step (/Users/thomas/extensions/extensions/todoist/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:33:23)
    at Object.next (/Users/thomas/extensions/extensions/todoist/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:14:53)
    at null.fulfilled (/Users/thomas/extensions/extensions/todoist/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'CONTENT_INCORRECT',
  details: { createdAt: 'Expected string, but was undefined' }
}

Expected behaviour

The call should work just fine.

Is reproducible

Yes

To reproduce

Make a call with the quickAddTask method.

Version information:

  • Package version: 2.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions