Skip to content

Commit

Permalink
MINOR backport syntax normalization to 7.0.x (#2380)
Browse files Browse the repository at this point in the history
* MINOR backport syntax normalization to 7.0.x

* MINOR backport syntax normalization from 7.3
  • Loading branch information
rayokota authored Sep 15, 2022
1 parent b14aae7 commit 0ed50cd
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.protobuf.Message;
import com.google.protobuf.util.JsonFormat;

import com.squareup.wire.Syntax;
import com.squareup.wire.schema.Field.Label;
import com.squareup.wire.schema.ProtoType;
import com.squareup.wire.schema.internal.parser.EnumConstantElement;
Expand Down Expand Up @@ -110,9 +111,11 @@ protected static String toString(ProtoFileElement protoFile) {
private static String toString(Context ctx, ProtoFileElement protoFile, boolean normalize) {
StringBuilder sb = new StringBuilder();
if (protoFile.getSyntax() != null) {
sb.append("syntax = \"");
sb.append(protoFile.getSyntax());
sb.append("\";\n");
if (!normalize || protoFile.getSyntax() == Syntax.PROTO_3) {
sb.append("syntax = \"");
sb.append(protoFile.getSyntax());
sb.append("\";\n");
}
}
if (protoFile.getPackageName() != null) {
sb.append("package ");
Expand Down

0 comments on commit 0ed50cd

Please sign in to comment.