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

Incorrect return type annotations for batch requests #179

Open
marekdedic opened this issue Aug 26, 2019 · 5 comments
Open

Incorrect return type annotations for batch requests #179

marekdedic opened this issue Aug 26, 2019 · 5 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@marekdedic
Copy link

marekdedic commented Aug 26, 2019

Environment details

  • OS: Debian testing
  • PHP version: 7.3.8

The return type of many API functions is incorrect, missing the option that many functions can return Request, if batch requests are enabled.

For example, the function Google_Service_Drive_Resource_Files::get() normally returns a Google_Service_Drive_DriveFile, as is written in the doc comment.

However, if batch requests are turned on, this function won't return the actual file, but instead a GuzzleHttp\Psr7\Request. This is because the function Google_Service_Drive_Resource_Files::get() calls Google_Service_Resource::call(), which (if batching is enabled) returns the request instead of the response (source).

So the correct PHPDoc return signature for Google_Service_Drive_Resource_Files::get() should be

/**
 * ...
 *
 * @return Google_Service_Drive_DriveFile|Request
 */

Of course, this applies to many more functions than just this one - possibly to all of them, but I am not really sure.

@marekdedic marekdedic changed the title Incorrect return type annotation for batch requests Incorrect return type annotations for batch requests Aug 26, 2019
@jdpedrie jdpedrie added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Aug 26, 2019
@marekdedic
Copy link
Author

This is IMHO not a feature request - the type annotations exist and are incorrect - as far as I see it, that makes this a bug report ;)

@dwsupplee dwsupplee added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Oct 28, 2019
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Feb 22, 2020
@dwsupplee dwsupplee added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 26, 2020
@bshaffer bshaffer self-assigned this Feb 26, 2020
@bshaffer
Copy link
Contributor

We are changing this back to feature request because "bug" implies a bug in the library. We are working on rolling out a fix, however!

@marekdedic
Copy link
Author

Hi,
is there any way I could help? As far as I understand, this repo is auto-generated - is the generating code somewhere? I would submit a PR if it were...

@marekdedic
Copy link
Author

marekdedic commented Mar 16, 2021

Ok, looked at it once more, found the generator (was that in the repo the whole time?). However, it uses Python 2, which is not supported by my distro any more :/ (and managing python versions and dependencies is something I never quite grokked)

@devbanana
Copy link

Also following this as I noticed the same issue. Many methods are also missing phpdoc comments altogether. For instance, Google\Service\Drive\DriveFile has almost no phpdoc comments at all, which plays havoc with my IDE.

If I get the time perhaps I can look at the generator code, but I'm not very good at python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

6 participants