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

Suggest to try Stainless-API #52

Open
johnpyp opened this issue Apr 27, 2024 · 4 comments
Open

Suggest to try Stainless-API #52

johnpyp opened this issue Apr 27, 2024 · 4 comments

Comments

@johnpyp
Copy link

johnpyp commented Apr 27, 2024

I see the chargebee SDK is clearly autogenerated. I'm just a Chargebee customer, but a lot of big companies have been picking up https://www.stainlessapi.com/ as their SDK generator of choice. It generates really high quality APIs, which can help modernize a lot of the code. I see a lot of patterns that could use some help in the various chargebee SDKs.

@cb-alish cb-alish added the enhancement New feature or request label Apr 27, 2024
@cb-sriramthiagarajan cb-sriramthiagarajan removed the enhancement New feature or request label Apr 27, 2024
@cb-sriramthiagarajan
Copy link
Collaborator

cb-sriramthiagarajan commented Apr 27, 2024

Hey @johnpyp, Sriram here from the DX team at Chargebee. Thanks for your suggestion. Appreciate you taking the time to share this.

While I can't comment on using Stainless or any 3rd party SDK generators at this time, I'd love to understand what you think could be improved in our SDKs and the patterns that you're referring to above. Please share here or feel free to send me an email (address in my profile). Thanks!

@johnpyp
Copy link
Author

johnpyp commented Apr 27, 2024

Yeah, just to name a couple:

  • Using snake_case in Typescript/JS (where camelCase is the norm), but also mixing with camel case strangely
  • Lack of API comments annotating methods or model types (even though the openapi spec does specify them)
  • Use of callback apis for asynchronous code - Promises have been the standard in JS/TS for at least 4-5 years now, so it shows a fair bit of age and is quite annoying to use in modern code.
  • Using let when const would suffice
  • Callback error types aren't actual errors, they're just objects.
  • Weird interface exports like:
  export interface payment_method_update_params {
    gateway_account_id?: string;
  }
  export interface payment_method_update_params {
    reference_id?: string;
  }
  export interface payment_method_update_params {
    tmp_token?: string;
  }
  export interface payment_method_update_params {
    issuing_country?: string;
  }
  export interface payment_method_update_params {
    additional_information?: any;

(These are all the same export, and it's relying on interface merging, which is a really strange pattern)


Now, I see Chargebee has actually relatively recently started publishing an OpenAPI spec - https://github.com/chargebee/openapi

It seems to me that this spec has everything needed to generate a great api with all the modern conventions, comments, etc.

The reason I suggest stainless is because they basically take care of everything for you, and they're trusted by some of the largest new tech companies like OpenAI, Cloudflare, Anthropic, etc. - I imagine for a company like chargebee it'd be a small cost to pilot to see if it's helpful for customers.

Of course, it would be a massive breaking change, so it'd have to be new libraries, which is probably the biggest downside I suppose. However, at least the JS SDKs seem to need significant modernization anyways, if I'm being honest.

@cb-sriramthiagarajan
Copy link
Collaborator

Thanks a lot for the detailed note, @johnpyp. Agree that these need to be fixed.

You're right, our OpenAPI spec has everything needed for the SDK and we're in the process of using it as the base without changing much in the SDK itself. We'll work on how these things can be improved without a lot of breaking changes. I'll get back with an update soon.

@cb-sriramthiagarajan
Copy link
Collaborator

cb-sriramthiagarajan commented Aug 26, 2024

Hi @johnpyp, we have released a new beta version which addresses the issues you have mentioned. It'd be great if you could try it and share your feedback.

You can install this using npm install chargebee@beta

Edit: We have a Migration guide for v3. README in the next branch also has more info on the usage.

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

3 participants