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

Question: Generated C# client does not work because of gRPC encoded parameter #30

Open
sommmen opened this issue May 9, 2022 · 1 comment

Comments

@sommmen
Copy link

sommmen commented May 9, 2022

Hiya,

I'm trying to list reviews via the google my business api.

I'm following this doc:
https://developers.google.com/my-business/content/review-data#list_all_reviews

Which is this api:
https://developers.google.com/my-business/reference/rest/v4/accounts.locations.reviews/list

This describes the following endpoint:
GET https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/reviews
`

Which gets translated to the following swagger definition:

  "/v4/{parent}/reviews":
    get:
      description: Returns the paginated list of reviews for the specified location. This operation is only valid if the specified location is verified.
      operationId: mybusiness.accounts.locations.reviews.list
      parameters:
        - description: The name of the location to fetch reviews for.
          in: path
          name: parent
          required: true
          schema:
            type: string

I'm using this document to genera a c# client with NSwag, but this has the issue that the parameter path gets url encoded (meaning the slashes are escaped), creating a malformed url.

My C# client now pushed out a request like so:

https://mybusiness.googleapis.com/v4/accounts%2F123456789123456789123%2Flocations%2F1234567891234567891/reviews?pageSize=50

While it should be:

https://mybusiness.googleapis.com/v4/accounts/123456789123456789123/locations/1234567891234567891/reviews?pageSize=50

Now this is not an issue with this generator, but it does make the swagger doc unusable. Does anyone know a way to specificy that the parameter should not be url encoded so that generated clients can create a proper request?

@MikeRalphson
Copy link
Collaborator

Hmm, even if we could identify that the google format path parameter was multi-segment ({...+}) OpenAPI 3.0 / 3.1 only supports the allowReserved parameter property on in:query parameters.

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

2 participants