Repository navigation
Add Wire's google.rpc error details - #3759
Merged
Merged
Conversation
oldergod
marked this pull request as ready for review
November 10, 2026 14:47
oldergod
force-pushed
the
bquenaudon/rpc-status
branch
from
November 20, 2026 15:37
924d317 to
fc75fbb
Compare
oldergod
force-pushed
the
bquenaudon/rpc-error-details
branch
from
November 20, 2026 15:37
9c4c3a4 to
627c078
Compare
Wire now bundles google/rpc/error_details.proto and ships its types in com.squareup.wire.rpc: ErrorInfo, RetryInfo, DebugInfo, QuotaFailure, PreconditionFailure, BadRequest, RequestInfo, ResourceInfo, Help and LocalizedMessage. These are the usual payloads of RpcStatus.details. The classes are Wire's Kotlin output for the proto with java_package set to com.squareup.wire.rpc. Type URLs stay google.rpc. The Kotlin and Java generators map the google.rpc types to these classes, so generated code never makes its own copy.
Wire's Kotlin generator now defers merges of singular message fields and sanitizes map fields in toString(). This commit regenerates the checked-in error details classes so that they match that output.
oldergod
force-pushed
the
bquenaudon/rpc-error-details
branch
from
November 23, 2026 13:40
627c078 to
2a318e1
Compare
The generated files imported Wire's internal JvmField, which gives no static field inside wire-runtime. ProtoAdapter.get and the adapter strings in @WireField look up a static ADAPTER, so they failed for these types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3758.
google.rpc.Status.detailsusually carries the standard payloads fromgoogle/rpc/error_details.proto.Without them, users who want to read an
ErrorInfofrom aGrpcExceptionmust generate that file.That brings back the
com.google.rpcclasspath conflict which #3758 fixes forStatus.wire-runtime: addErrorInfo,RetryInfo,DebugInfo,QuotaFailure,PreconditionFailure,BadRequest,RequestInfo,ResourceInfo,HelpandLocalizedMessagetocom.squareup.wire.rpc, next toRpcStatus. The files are Wire's Kotlin output forerror_details.protowithjava_packageset tocom.squareup.wire.rpc. They importkotlin.jvm.JvmFieldinstead of Wire's internalJvmField, so thatADAPTERis a static field on the JVM, as inAnyMessage. Type URLs staytype.googleapis.com/google.rpc.*.wire-schema: bundlegoogle/rpc/error_details.protoand list its 14 types (nested types included) inGOOGLE_RPC_ERROR_DETAILS_TYPES. A test checks this list against the bundled proto, and checks that each runtime class has a staticADAPTERwith the right type URL.To regenerate the runtime classes, copy
error_details.protoand setpackage google.rpcx;andoption java_package = "com.squareup.wire.rpc";in the copy.Wire skips the built-in
google.rpctypes, so the copy needs another package.Then run:
Replace
google.rpcxwithgoogle.rpcin the output, and replace Wire's internalJvmFieldimport withimport kotlin.jvm.JvmField.Then copy the files to
wire-runtime/src/commonMain/kotlin/com/squareup/wire/rpc.Open questions:
wire-runtime. R8 removes them when unused, but a separate artifact is also possible.google.rpc.Codeis not included, becauseGrpcStatusalready covers the codes.Release note: ⚠ Breaking: Wire no longer generates the types of
google/rpc/error_details.proto.Fields of those types now use the classes in
com.squareup.wire.rpc, such asErrorInfoandBadRequest.FieldViolation.Replace
com.google.rpc.ErrorInfoand the other types, or your ownjava_packageclasses, with thecom.squareup.wire.rpcclasses.The Proto target no longer emits
google/rpc/error_details.proto.