-
Notifications
You must be signed in to change notification settings - Fork 848
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
Wrong php-doc types for Subscriptions properties #656
Comments
Also seems like |
Just a note -- I believe the special value |
But we can set property value and then call save() https://github.com/stripe/stripe-php/blob/master/lib/ApiOperations/Update.php#L36 This is used in Laravel Cashier https://github.com/laravel/cashier/blob/9.0/src/Subscription.php#L371 |
This is a bit tricky. We're trying to move away from the "update properties then call The now recommended way to update resources is to use the static method My gut feel is that the PHPDoc should only describe the properties of the resource, not the possible update parameters, but I understand that this is a bit confusing because in many cases, resource properties and update parameters have the same names and types. cc @brandur-stripe @nickdnk Do you have an opinion on this? |
Oh crazy, I hadn't thought of that particular situation at all. My preference would be what you said @ob-stripe in keeping the docs for actual properties only so as not to confuse things too much (also, in an auto-generated world I think it'd be a little unusual/complicated to have to pull properties out of a resource and then mix in some parameters as well). I say that though understanding that there's a definite usability trade off — once you introduce something like PHPDoc users will expect it to be correct, and especially if you're using an IDE to assist it can be a little disorienting when it's not entirely accurate. |
My hope is that once we move to an autogenerated world, we would document update parameters in the PHPDoc of the |
Oh yep, totally — that's the optimal option. I was thinking if did end up putting parameters in the PHPDoc list and then wanted to try for perfect compatibility when porting from hand-maintained to generated. |
I'd have to agree that in order to be consistent ... the properties on the objects should be for reading only. I think we should move that direction and mark the Doing this would allow for consistent type hints for properties for objects that would improve static analysis. |
Also @property-read may be used for properties and @deprecated for |
Tagging this as We're not going to tackle stripe-php immediately, but should hopefully get to it in a few weeks. Thanks everyone for your feedback and your patience! |
@ob-stripe Can you clarify from a development/tooling perspective. Just curious -- Are you guys going to try to roll out changes such that all client-side libraries (by language) are able to receive changes somewhat simultaneously? Pretty cool, as I'm sure 99% of issues found in one client side lib are applicable in all the others. If this is the case ... I'm curious how the [ repo(s) structure / layout / build / process ] will work ... if you can share somewhat top-level details that would be awesome. |
@virgofx The project is still in a very early phase so I don't have much concrete information to share yet, but yes, the idea is that we would use the OpenAPI specification for Stripe's API (https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml) to generate the models and methods for all API resources, in all of our client libraries. (Technically, it would be an "augmented" version of the spec -- the general spec I linked above doesn't have all the information we need.) We're already doing this for our Java library (e.g. stripe/stripe-java#777). The current implementation is specific to Java, but we're in the process of porting it to a more generic tool that would work for any language. This is what Brandur and I were referring to when we mentioned "auto-generated" in our earlier comments in this thread. This change should be transparent to end-users of the library, but once it's live it will enable us to make wide-scope changes that are currently impossible because they would be too difficult to maintain manually -- up-to-date PHPDoc for every specific API method being one of them :) |
Can't wait -- Seems like every large org is playing catch up with every lang as they try to support the major 5-8 languages for all API-based projects. If designed generic enough ... could be used as an open-source framework for designing APIs that are cross platform. |
\Stripe\Subscription have
* @property int $trial_end
but according to api documentation this can benow
.Same with
* @property int $billing_cycle_anchor
(it's also can benow
) and* @property Plan $plan
(it`s can accept hash string).Maybe replace with
int|string
andPlan|string
?The text was updated successfully, but these errors were encountered: