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

Timestamp as URL param causes bad request error #260

Closed
philipithomas opened this issue Nov 16, 2016 · 4 comments
Closed

Timestamp as URL param causes bad request error #260

philipithomas opened this issue Nov 16, 2016 · 4 comments

Comments

@philipithomas
Copy link
Contributor

philipithomas commented Nov 16, 2016

We have an endpoint where we need to query a date range. Here's the proto3:

message ShiftListRequest {
    string company_uuid = 1;
    string team_uuid = 2;
    google.protobuf.Timestamp shift_start_after = 3;
    google.protobuf.Timestamp shift_start_before = 4 ;
}

And the gateway spec:

	rpc ListShifts(ShiftListRequest) returns (ShiftList) {
		option (google.api.http) = {
			get: "/v1/companies/{company_uuid}/teams/{team_uuid}/shifts"
		};
	}

When we query it with no filter params, it defaults to null values and is fine.

When we add query values, it returns an error.

Query with the zero-value datetime (but others have same issue):

GET /companies/e3bde7d9-0526-4830-6073-bcfe9999c528/teams/aade4334-61c2-4c85-6c8e-98e8fa4e99ad/shifts?shift_start_after=0001-01-01T00:00:00.000Z

Error:

{"error":"unsupported field type reflect.Value","code":3}
@tmc
Copy link
Collaborator

tmc commented Nov 20, 2016

@philipithomas thanks for the report -- think you could demonstrate this in a failing test?

@johansja
Copy link
Contributor

Ran into similar issue today. Added the failing test case at #281 . It seems that PopulateQueryParams needs some update to fix this. Might need some guidance on how this could possibly be solved elegantly.

@johansja
Copy link
Contributor

Have a quick look at how jsonpb handle those WellKnownTypes. Added a fix for Timestamp support at URL param.

@tmc
Copy link
Collaborator

tmc commented Jan 7, 2017

superseded by #281

@tmc tmc closed this as completed Jan 7, 2017
@tamalsaha tamalsaha mentioned this issue Mar 30, 2017
1 task
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