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

Swagger generator does not convert parameters in URLs to camel case when json_names_for_fields is enable. #986

Closed
xin-au opened this issue Aug 9, 2019 · 0 comments

Comments

@xin-au
Copy link
Contributor

xin-au commented Aug 9, 2019

Hi Guys, I noticed an issue when I enable json_names_for_fields=true.
It does generate JSON camel case fields in a swagger doc, but except fields which were defined in URLs, like the following:

    rpc CreateSomething(CreateSomethingRequest) returns (CreateSomethingResponse) {
        option (google.api.http) = {
            post: "/v1/abc/{abc_id}"
            body: "*"
        };
    }

The swagger that generated by the above proto included the snake case abc_id even with enabling json_names_for_fields=true.

What did you expect to happen instead:
Expect abcId instead of abc_id in the generated swagger doc.

What's your theory on why it isn't working:
It seems the swagger generator did not convert those snake case fields when rendering the template.

adasari pushed a commit to adasari/grpc-gateway that referenced this issue Apr 9, 2020
…osystem#985)

* Use json name when GetUseJSONNamesForFields is enabled

* Optimzed an if statement

* Merge two if statements

* Convert parameters to lower camel case in url

* Revert services.go file

* Fix an unit test

* Update bazel file

* Add an unit test for testing json camel case

* Add an unit test for testing code without enabling json camel case

* Add more corner cases

Fixes grpc-ecosystem#986
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

1 participant