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

REST-encoding of Any fields omits @type #1548

Open
vchudnov-g opened this issue Nov 19, 2024 · 0 comments
Open

REST-encoding of Any fields omits @type #1548

vchudnov-g opened this issue Nov 19, 2024 · 0 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@vchudnov-g
Copy link
Contributor

In the branch gce_error_details, Showcase populates an array of error details, These details are declared as repeated google.protobuf.Any details here, but the JSON-encoded error response does not populate the @type field of each Any-type element of details. The JSON encoding of google.protobuf.Any should include such a field (ref).

If I start the Showcase server from that branch and then I run curl, this is what I get (notice the lack of @type fields):

> curl -i -X POST -H "X-Goog-Api-Client: rest/0.0.0 gapic/0.0.0" -H 'Content-Type: application/json' http://localhost:7469/v1beta1/echo:echo  -d'{"error": {"code": 8,"message":"Main error message"}, "generateErrorDetails": true} '

HTTP/1.1 429 Too Many Requests
Date: Thu, 25 Apr 2024 23:07:46 GMT
Content-Length: 1292
Content-Type: text/plain; charset=utf-8

{"error":{"code":429,"message":"Main error message","details":[{"reason":"(showcase:ErrorInfo) RPC requested we populate all error details","domain":"googleapis.com"},{"retry_delay":{"seconds":3,"nanos":14159265}},{"stack_entries":["frame 1","frame 2","frame3"],"detail":"(showcase:DebugInfo) sample stack frames"},{"violations":[{"subject":"(showcase:QuotaFailure) showcase-testing:fake errors","description":"This is fake quota error 0"},{"subject":"(showcase:QuotaFailure) showcase-testing:more fake errors","description":"This is fake quota error 1"}]},{"violations":[{"type":"Fake Type 0","subject":"(showcase:PreconditionFailure) showcase-testing:fake errors","description":"This is fake precondition error 0"},{"type":"Fake Type 1","subject":"(showcase:PreconditionFailure) showcase-testing:fake errors","description":"This is fake precondition error 1"}]},{"field_violations":[{"field":"field 0","description":"(showcase:BadRequest) description 0"},{"field":"field 1","description":"(showcase:BadRequest) description 1"}]},{"links":[{"description":"(showcase:Help) Description 0","url":"URL 0"},{"description":"(showcase:Help) Description 1","url":"URL 1"}]},{"locale":"en-US","message":"(showcase:LocalizedMessage) Some message for the user"}],"Body":"","Header":null,"Errors":null}}%  
@vchudnov-g vchudnov-g added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 19, 2024
@vchudnov-g vchudnov-g self-assigned this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

1 participant