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

Pubsub subscription delete - Incorrect response type #16

Open
binarybana opened this issue Sep 20, 2019 · 3 comments
Open

Pubsub subscription delete - Incorrect response type #16

binarybana opened this issue Sep 20, 2019 · 3 comments

Comments

@binarybana
Copy link
Contributor

When trying to delete a pubsub subscription using latest master of the generated/gen/pubsub/v1/lib crate:

client
            .projects()
            .subscriptions()
            .delete(SUBSCRIPTION_NAME)
            .execute_with_default_fields()?;

Returns an error like this:

'Couldn't convert to json: Error(Json(Error("invalid type: map, expected unit struct Empty", line: 1, column: 0)))'

With a snipped stack trace of:

  10: core::result::unwrap_failed
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/macros.rs:18
  11: core::result::Result<T,E>::expect
             at /rustc/eae3437dfe991621e8afdc82734f4a172d7ddf9b/src/libcore/result.rs:827
  12: google_pubsub1::resources::projects::subscriptions::DeleteRequestBuilder::_execute
             at /Users/jason/src/generated/gen/pubsub/v1/lib/src/lib.rs:3863
  13: google_pubsub1::resources::projects::subscriptions::DeleteRequestBuilder::execute_with_fields
             at /Users/jason/src/generated/gen/pubsub/v1/lib/src/lib.rs:3853
  14: google_pubsub1::resources::projects::subscriptions::DeleteRequestBuilder::execute_with_default_fields
             at /Users/jason/src/generated/gen/pubsub/v1/lib/src/lib.rs:3830
  15: gcp_utils::pubsub::tests::init
             at gcp-utils/src/pubsub.rs:21

(the line numbers may not match exactly because I inserted a few lines of debugging help)

Whereas the actual reqwest response that comes back is successful:

Response { url: "https://pubsub.googleapis.com/v1/projects/octomizer/subscriptions/test-subscription-21990", status: 200, headers: {"content-type": "application/json; charset=UTF-8", "vary": "Origin", "vary": "X-Origin", "vary": "Referer", "transfer-encoding": "chunked", "date": "Fri, 20 Sep 2019 17:20:57 GMT", "server": "ESF", "cache-control": "private", "x-xss-protection": "0", "x-frame-options": "SAMEORIGIN", "x-content-type-options": "nosniff", "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,43,39\""} }test pubsub::tests::publish_and_poll_message

It looks like the Ok variant return type of pubsub::v1::lib::DeleteRequestBuilder::execute_with_default_fields is wrongly set to Empty:

                pub fn execute_with_default_fields(
                    self,
                ) -> Result<crate::schemas::Empty, crate::Error> {

But I'm not sure what it should be set to?

If I instead use execute_with_fields(Some("*")) instead of execute_with_default_fields I can work around it, but I need to add an extra .map(|_: serde_json::Value| ()); on the end to help type inference (I'm assuming).

@binarybana
Copy link
Contributor Author

I also just hit this for client.projects().subscriptions().acknowledge(... as well.

@ggriffiniii
Copy link
Contributor

I pushed aa08905, which should fix the generator if I understand the issue correctly. I'm not very familiar with how to regenerate the apis in the generated directory unfortunately. I just tried a number of things, but they failed with errors (which sadly matches all my previous experiences). @Byron will know how to regenerate those libs when he sees this.

@Byron
Copy link
Contributor

Byron commented Sep 20, 2019

I have regenerated all APIs with just refresh-all, and I hope it helps, @binarybana .

Besides that, maybe @ggriffiniii could give me a hint to be able to fix whatever issue is preventing you from doing the same.

Thanks everyone for the enthusiasm :), I can't wait to see this iteration of google-apis-rs in its full async glory!

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