Skip to content

Commit

Permalink
Convert repeated type even if it contains primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
Duzhinsky committed Nov 1, 2023
1 parent 5bb4633 commit 1161372
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public RepeatedContainer getRepeatedType() {

@Override
public CodeBlock toGrpcTransformer(CodeBlock expr, Set<String> usedDefinitions) {
if (!(elementModel instanceof PrimitiveTypeModel)) {
if (!(elementModel instanceof PrimitiveTypeModel && repeatedType == RepeatedContainer.LIST)) {
String nextDefinition = nextDefinition(usedDefinitions);
CodeBlock lambdaParameter = CodeBlock.of(nextDefinition);
Set<String> newDefinitions = new HashSet<>(usedDefinitions) {{ add(nextDefinition); }};
Expand All @@ -50,7 +50,7 @@ public CodeBlock toGrpcTransformer(CodeBlock expr, Set<String> usedDefinitions)
@Override
public CodeBlock fromGrpcTransformer(CodeBlock expr, Set<String> usedDefinitions) {
expr = repeatedType.convertListToInstance(expr);
if (!(elementModel instanceof PrimitiveTypeModel)) {
if (!(elementModel instanceof PrimitiveTypeModel && repeatedType == RepeatedContainer.LIST)) {
String nextDefinition = nextDefinition(usedDefinitions);
CodeBlock lambdaParameter = CodeBlock.of(nextDefinition);
Set<String> newDefinitions = new HashSet<>(usedDefinitions) {{ add(nextDefinition); }};
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/proto/general.proto
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ message GrpcRepeatedTypes {
}

message GrpcSomeEvent {
repeated string ids = 1;
repeated string ids = 1 [(.protogen.repeated_container) = SET];
option (.protogen.topic) = "SOME_TOPIC";
}

Expand Down

0 comments on commit 1161372

Please sign in to comment.