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

Enum values in query parameters are not properly parsed #366

Closed
charles-crain opened this issue Apr 18, 2017 · 3 comments
Closed

Enum values in query parameters are not properly parsed #366

charles-crain opened this issue Apr 18, 2017 · 3 comments
Labels

Comments

@charles-crain
Copy link

If you have an enum type in a gRPC request object, and you pass an enum value as a string as a query parameter, you get:

{
 "error": "strconv.ParseInt: parsing \"SOME_ENUM_VALUE\": invalid syntax",
 "code": 3
}

The generated Swagger passes the enum values as strings not integers, which leads to this error when using a Swagger generated client as well.

@tmc
Copy link
Collaborator

tmc commented Apr 19, 2017

@charles-crain thanks for your report. Can you supply an example request for increased clarity here? Even better could be a failing test case.

#314 is related, FWIW.

@charles-crain
Copy link
Author

Oh I think #314 is actually the same issue. That issue shows it was fixed in release 1.2.0 correct? I am using whatever the latest is from go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway ... does that lag behind?

An example request would look like this:

enum Field {
  FOO = 0;
  BAR = 1;
}

message FooRequest {
  Field which_field = 1;
}

service Foo {
  rpc FooCall (FooRequest) returns (FooResponse) {
    option (google.api.http) = {
            get: "/api/foo"
      };
  }
}

curl localhost/api/foo?which_field=BAR

@stale
Copy link

stale bot commented Sep 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 9, 2019
@stale stale bot closed this as completed Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants