Skip to content

The 2.0.0 version seems broken, every api call returns a ValidationError #133

@Fastjur

Description

@Fastjur

Bug description

The SDK seems to be broken in version 2.0.0. Or, the examples should be updated if there are major changes, as they're currently not working.

Is reproducible

Yes

To reproduce

Executing the following example:

import { TodoistApi } from '@doist/todoist-api-typescript'
import * as dotenv from 'dotenv';

dotenv.config();

if (!process.env.TODOIST_API_TOKEN) {
    throw new Error('Missing TODOIST_API_TOKEN environment variable')
}

const api = new TodoistApi(process.env.TODOIST_API_TOKEN)

api.getProjects()
    .then((projects) => console.log(projects))
    .catch((error) => console.error(error));

Results in the following error:

ValidationError: Validation failed:
{
  "parentId": "Expected string, but was null"
}.
Object should match { parentId?: string; }
    at new ValidationError (project/node_modules/runtypes/lib/errors.js:22:28)
    at Object.check (project/node_modules/runtypes/lib/runtype.js:37:19)
    at validateProject (project/node_modules/@doist/todoist-api-typescript/dist/utils/validators.js:14:28)
    at Array.map (<anonymous>)
    at validateProjectArray (project/node_modules/@doist/todoist-api-typescript/dist/utils/validators.js:18:18)
    at TodoistApi.<anonymous> (project/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:201:85)
    at step (project/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:33:23)
    at Object.next (project/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:14:53)
    at fulfilled (project/node_modules/@doist/todoist-api-typescript/dist/TodoistApi.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  code: 'CONTENT_INCORRECT',
  details: { parentId: 'Expected string, but was null' }
}

Version information:

  • Package version: 2.0.0

Additional information

Downgrading to 1.7.0, the SDK works fine.

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