-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Feature Request
Crates
tonic-types
Motivation
Google has updated the google.rpc.BadRequest.FieldViolation message in its error model by adding two new fields: string reason and LocalizedMessage localized_message. This feature request proposes reflecting this upstream change in the tonic-types crate.
Proposal
-
Update the
.protofiles to the latest version. -
Extend the
FieldViolationstruct to include two new fields:pub reason: Stringpub localized_message: Option<LocalizedMessage>
-
Update the following functions to accept two additional parameters (
reason: impl Into<String>andloc_message: Option<LocalizedMessage>):FieldViolation::newErrorDetails::with_bad_request_violationErrorDetails::add_bad_request_violationBadRequest::add_violation
This proposal would involve modifying existing functions and therefore introduces a breaking change.
Alternatives
This is an initial proposal, and I would like to open the discussion to consider a non-breaking alternative.
Instead of modifying existing functions, we could add new functions to support the new fields. In that case, I’d appreciate input on appropriate naming conventions.
I’m happy to contribute the implementation once a direction is agreed upon. I already have a branch prepared for the breaking-change version, if you'd like to review it to get a sense of the scope 86d1095