Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitbucket API and Typescript Type Mismatch #128

Open
forcebewithyou opened this issue Sep 9, 2022 · 4 comments
Open

Bitbucket API and Typescript Type Mismatch #128

forcebewithyou opened this issue Sep 9, 2022 · 4 comments

Comments

@forcebewithyou
Copy link

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.

image

And interface object has type as required attribute

image

@MunifTanjim
Copy link
Owner

MunifTanjim commented Sep 9, 2022

The types are auto generated from BitBucket's API Specification:

What problem are you facing, btw? Are you having trouble calling any API? Is TypeScript complaining when you try to call the endpoint method?

@forcebewithyou
Copy link
Author

Am trying to post a comment to PR inline
image

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
image

Bitbucket API complain bad request.

When I update schema and make Type as optional and send the request without it, voila.. it works.

@MunifTanjim
Copy link
Owner

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.

@forcebewithyou
Copy link
Author

I understand, thank you for prompt responses, went ahead with direct integration using node-fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants