-
Notifications
You must be signed in to change notification settings - Fork 372
Update services based on v1941 of Stripe OpenApi SDK #874
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
base: main
Are you sure you want to change the base?
Conversation
* Updated Phases.Compile to properly sanitize generated type names that collide with reserved words * Updated Phases.Compile operations to be compatible with the OpenApi SDK * Updated default @api_version to 2025-08-27.basil Reference: https://github.com/stripe/openapi/releases/tag/v1941
|
@alolis btw, if the tests fail, the intent is to "try" to keep the existing APIs without breaking changes, if possible, as much as we can |
Ι will have a look and try to understand what is failing and try to fix it. I will get back to you soon. |
|
the idea of that ugly mapping was to power-up thru manual work to make sure the mapping is fixing the breaking change |
…o Subscription struct The OpenAPI spec v1941 merged from PR beam-community#874 is missing current_period_end and current_period_start fields in the subscription schema. These are core fields that Stripe returns in subscription objects. This fix manually adds: - current_period_end: integer - End of current billing period - current_period_start: integer - Start of current billing period Both to the defstruct, @type spec, and @TypeDoc documentation.
|
This pull request has been automatically marked as "stale:discard". If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated!. |
|
bump |
|
@alolis are you waiting for me btw? |
My apologies, no, I just I had an extremely huge workload and that's why I never pushed. I will deal with it soon. |
|
Can we have any update on this? |
I could help out @alolis if you are time limited. |
|
I have finally found some time to deal with this. Give me until Wednesday to try and push updates and If i need help I will let you know no matter what. |
|
@yordis , so, there are 13 tests failing and I have been trying to figure out what is going on. I will just give you one example to make things a bit simpler in order for you to guide me a bit if you can. This PR, from my understanding, has generated the modules for Stripe API version v1941 (aka 2025-08-27.basil) as also indicated in spec3.sdk.json, line 77309 I run the following test:
and I get The reason is that in the generated BankAccount, if you search for Any idea why this might be happening so I can check it out? |
|
@yordis I think I have used an older release tag for the basil version. Checking and I will get back to you shortly. |
@alolis
|
* Updated generated files * Updated compile phase to properly escape operation definitions
|
@Xunjin I updated it anyway but I do not think that's the issue after all. It probably needs some further patching in |
|
@alolis the people had deep knowledge are gone by now, so you and I are left to figure out things together. I added the ugly mapping stripity-stripe/lib/openapi/phases/compile.ex Lines 517 to 525 in 0549d75
Simply to manually remap what suppose to be the non-breaking change version since some operations overlap now, and decide a new name for the new operation. Sadly, the Stripe SDK has these polymorphic endpoints that they decided based on the inputs or something like that, which we aren't following. |
Ohh ok, maybe the mapping would solve the issue that we have right now? While I'm LF a new job I could try to figure out these deep/hard parts? Tbh I'm not an expert in metaprogramming Elixir, however this can be a good opportunity to learn more 😅 |
|
That ugly mapping is so that we map to the existing operation back to what was there before, a lot of grunt work, 😭 stripity-stripe/lib/openapi/phases/compile.ex Lines 1179 to 1204 in 0549d75
That is intentionally forcing us to figure out the backwards compatible, we can not rely on the order or whatever it is in the OpenAPI spec since it wouldn't guarantee the correctness sadly |
|
@yordis I took a more aggressive approach :)
It needs further checks of course but I do not think that it's possible to keep everything backwards compatible. Stripe keeps changing things and tests will keep failing. I would probably solve this by changing the major version of the library every time a new major Stripe version was released. Anything else is probably pain. What do you think? @Xunjin The map was ok with the previous version, I did have to update it now that i have done the above. |
|
@alolis let me rephrase it, the existing functions must point to what was there before, we can not call a new endpoint. My intent is to try* to avoid breaking changes as much as we can so upgrading isn't as painful, but I can't guarantee anything if Stripe changed things for sure |
Based on this approach, which I do agree with, we will never really ditch the mapping, ugly or not, is honest work ™. Therefore, to keep the library up to date would require being some versions behind and deciding case by case, which would require the mapping for backwards compatibility reasons. However, this requires (already) a ton of work. Maybe it's time to test moving forward with all that's discussed here: #869 wdyt? @yordis |
|
I understand @yordis but I do not think the current approach is viable. The latest version of the library is basically not working at the moment since Stripe API has moved miles and miles ahead since v755. I agree with @Xunjin. The proposed approach in #869 is the way forward and from what I am reading in the comments, you agree. From what I understand the other communities are doing the same approach as well (e.g. stripe-ruby). A little bit of breakage now to ensure that the library will be easily maintainable in the future does not sound bad to me. Besides, no matter what you do, 100% backwards compatibility is not possible, even if you pin the API version. You will have to pin the library version as well. At some point, as a Striper API consumer, you will have to deal with Stripe API changes no matter what. What was the reason you never moved forward with it back then? Time or you just wanted to keep the backwards compatibility as long as possible? If you do move forward with the OpenAPI generator I believe this PR should be closed. |
I do not disagree here for sure. I do not feel strong about anything, if we are gonna reset the situation, I am all for it. I am not sure about open_api_generator as the solution neither. After I have written so many OpenAPI codegen, I have few strong opinions that I need to validate before, personally, I would be onboard with that package. |
|
Hello, It feels like a big part of the delay is trying to keep full backward compatibility with the older behavior. Just a suggestion — since this is already a major upgrade, it might be worth reconsidering how much compatibility we actually need to preserve. Allowing some breaking changes might help unblock this and get the newer Stripe API support merged sooner. Pushing this forward is more valuable than keeping an aging compatibility layer alive, just wanted to share that perspective in case it helps move things forward |
|
Hello, Just following up on this. Do we have any update on this? |
Reference: https://github.com/stripe/openapi/releases/tag/v1941