Skip to content

Commit

Permalink
Merge pull request #3 from jtjeferreira/no-package-issue
Browse files Browse the repository at this point in the history
Handle protos without a package
  • Loading branch information
Fadelis authored Feb 9, 2022
2 parents d5b9b50 + 80eeb68 commit 02162e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";

option java_multiple_files = true;
option java_package = "org.test.datatypes";

message NoPackageTestMessage {
message NestedTestMessage {
string string = 1;
optional string optional_string = 2;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private Stream<File> handleMessage(
String javaPackage
) {
String filePath = javaPackage.replace(".", DIR_SEPARATOR) + DIR_SEPARATOR + fileName + JAVA_EXTENSION;
String fullMethodName = protoPackage + "." + messageDescriptor.getName();
String fullMethodName = (protoPackage.isEmpty() ? "" : (protoPackage + ".")) + messageDescriptor.getName();

return Stream.concat(
handleSingleMessage(messageDescriptor, filePath, fullMethodName),
Expand Down

0 comments on commit 02162e8

Please sign in to comment.