Skip to content

Pubsub subscription delete - Incorrect response type #16

@binarybana

Description

@binarybana

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions