Skip to content

Commit

Permalink
feat: add support for proto3 optional tag (#2295)
Browse files Browse the repository at this point in the history
  • Loading branch information
agrawal-siddharth committed Oct 31, 2023
1 parent fd8aaae commit bc88aa5
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -102,6 +102,17 @@ private static ProtoSchema convertInternal(
enumTypes.add(enumFullName);
}
}
// The protobuf payload will be decoded as proto2 on the server side. The schema is also
// specified as proto2. Hence we must clear proto3-only features. This works since proto2 and
// proto3 are binary-compatible.
if (resultField.hasProto3Optional()) {
// Clear proto3-only features
resultField.clearProto3Optional();
}
if (resultField.hasOneofIndex()) {
// Clear proto3-only features
resultField.clearOneofIndex();
}
resultProto.addField(resultField);
}
structTypes.add(protoFullName);
Expand Down

0 comments on commit bc88aa5

Please sign in to comment.