node-bitbucket
node-bitbucket copied to clipboard
Bitbucket API and Typescript Type Mismatch
I am fairly new to node and typescript, so it might very well be a developer error :)
Issue am facing is that I am forced to include "type" as a required attribute in my requests which bitbucket api is complaining.
I believe its due to "object" being included as base extension and definition of "object" has "type" as required attribute.
And interface object has type as required attribute
The types are auto generated from BitBucket's API Specification:
- https://api.bitbucket.org/swagger.json
- https://github.com/MunifTanjim/node-bitbucket/blob/dba6ff4/scripts/generate-types.js
What problem are you facing, btw? Are you having trouble calling any API? Is TypeScript complaining when you try to call the endpoint method?
Am trying to post a comment to PR inline

Typescript is complaining that "type" is a required attribute.
error TS2322: Type '{ content: { raw: string; }; inline: { path: string; to: number; }; }' is not assignable to type 'PullrequestComment'. Property 'type' is missing in type '{ content: { raw: string; }; inline: { path: string; to: number; }; }' but required in type 'Object'.
Now when I add type attribute

Bitbucket API complain bad request.
When I update schema and make Type as optional and send the request without it, voila.. it works.
Yeah, those specification are definitely wrong. BitBucket's API specification has way too many incorrect info.
Since this whole library is auto-generated from those specification, it's affected by it. It's very hard for me to know which part of the speification is correct and which part is wrong, so it's not possible for me to patch definitions for each endpoint.
Unless BitBucket fixes those, I'm afraid I can't be of much help here.
I understand, thank you for prompt responses, went ahead with direct integration using node-fetch.