-
Notifications
You must be signed in to change notification settings - Fork 315
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
TransitType enum not generated #4591
Comments
"transitType": {
"enum": [
"TRANSIT_TYPE_UNSPECIFIED",
"BUS",
"bus",
"RAIL",
"rail",
"TRAM",
"tram",
"FERRY",
"ferry",
"OTHER",
"other"
],
"description": "Required. The type of transit this class represents, such as \"bus\".",
"enumDeprecated": [
false,
false,
true,
false,
true,
false,
true,
false,
true,
false,
true
],
"type": "string",
"enumDescriptions": [
"",
"",
"Legacy alias for `BUS`. Deprecated.",
"",
"Legacy alias for `RAIL`. Deprecated.",
"",
"Legacy alias for `TRAM`. Deprecated.",
"",
"Legacy alias for `FERRY`. Deprecated.",
"",
"Legacy alias for `OTHER`. Deprecated."
]
}, ... but none of the enums get generated. We should also add the text descriptions as DocBlocks, would be immensely helpful for anybody using this SDK. |
Hello @razvanphp You're correct in identifying that this library does not generate enums. This was a feature request in #563, but since this library is essentially in maintenance mode, we made the decision to not merge it. |
hey @bshaffer While I understand this lib is pretty much outdated, the wallterobjects objects were added rather recently, but we cannot add those constants only for this because of the generators. Isn't there a better way to do this without creating so many files, maybe using phpdoc types at least, so IDEs can alert? This can be done in the same files probably, but I'm not familiar with how the generator works to do it myself. The use-case is obvious, makes no sense to define those in my lib, while depending on those classes anyway, everybody should use types in 2024, even in PHP 🙂 |
Hi @razvanphp , these are just strings, so extra classes or typing is not necessary. I do think adding these values to phpdoc is something we should look into. Edit: it seems like there are a lot of options for this, and we should implement one of them. |
Now that PHP 7.4 support was dropped and given that those SDKs are not going anywhere (in regards to the maintenance-mode and no alternative SDK for Wallet), can we implement the native Enums instead? We would need PHP 8.1 support for string backed enums, but for clasic ones, PHP 8.0 should be good enough. Can you please discuss internally if we can reopen a similar PR to #563? As an alternative, if you still think it’s too many new files, I propose we just add string class const’s to each respective Collection + phpdoc. I can work on this, now that I understand how the generator works. Thank you! |
There
might beare other missing enums, but this one stood out to me:https://developers.google.com/wallet/reference/rest/v1/transitclass#TransitClass.TransitType
Since I'm the maintainer of eymengunay/php-passbook project and we will have this repo as dependancy, I would love to contribute this here for the whole community.
LE: enum data type was introduced in version 8.1, so we should probably stick with class constants for now to support 7.4
But... not sure how to do it through the generator.... can I get some guidance at least? Maybe I could try it.
Also, on a more general note, it would be awesome to include those types as return types and parameter types as many other issues suggested, now that PHP 7.4 is the minimum supported version.
Thank you!
CC @bshaffer
The text was updated successfully, but these errors were encountered: