Skip to content

Conversation

@Mr3zee
Copy link
Member

@Mr3zee Mr3zee commented Apr 24, 2025

Subsystem
gRPC

Solution
Support for repeated types in the Protobuf plugin

@Mr3zee Mr3zee added the feature New feature or request label Apr 24, 2025
@Mr3zee Mr3zee requested a review from e5l April 24, 2025 14:52
@Mr3zee Mr3zee self-assigned this Apr 24, 2025
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, lgtm

@e5l e5l requested a review from Copilot April 30, 2025 06:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for repeated types in the Protobuf plugin to extend gRPC functionality. Key changes include the addition of a new proto file (repeated.proto), updates to the gRPC service and corresponding tests, and modifications to the model and code generators to properly handle repeated fields.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
protobuf-plugin/src/test/proto/repeated.proto Added a new message with repeated fields for testing
protobuf-plugin/src/test/proto/reference_service.proto Updated service to include a new RPC for repeated types
protobuf-plugin/src/test/kotlin/kotlinx/rpc/protobuf/test/TestReferenceService.kt Added test cases for the new repeated type functionality
protobuf-plugin/src/main/kotlin/kotlinx/rpc/protobuf/model/FieldDeclaration.kt Modified the repeated field type representation
protobuf-plugin/src/main/kotlin/kotlinx/rpc/protobuf/ProtoToModelInterpreter.kt Changed the wrapping logic for field type references
protobuf-plugin/src/main/kotlin/kotlinx/rpc/protobuf/ModelToKotlinGenerator.kt Updated getter/setter generation and type casting for repeated fields
Comments suppressed due to low confidence (2)

protobuf-plugin/src/main/kotlin/kotlinx/rpc/protobuf/model/FieldDeclaration.kt:18

  • [nitpick] Consider renaming the 'List' data class to avoid confusion with Kotlin's standard List type. A name like 'RepeatedField' might convey its purpose more clearly.
data class List(val value: FieldType) : FieldType {

protobuf-plugin/src/main/kotlin/kotlinx/rpc/protobuf/ModelToKotlinGenerator.kt:203

  • [nitpick] Ensure that appending 'List' to the field name for repeated fields aligns with the expected accessor naming conventions in the generated code, as the tests refer to properties without the 'List' suffix.
val javaName = when (field.type) { is FieldType.List -> "${field.name}List" else -> field.name }

val fq by value.value
importRootDeclarationIfNeeded(fq, "toPlatform", true)
}
is FieldType.IntegralType -> ""
Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Double-check that numeric list elements do not require any platform-specific casting. If new numeric types are added in the future, consider handling them explicitly.

Suggested change
is FieldType.IntegralType -> ""
is FieldType.IntegralType -> ".map { it }"

Copilot uses AI. Check for mistakes.
@Mr3zee Mr3zee merged commit a91b13e into grpc-release Apr 30, 2025
2 checks passed
@Mr3zee Mr3zee deleted the grpc/repeated branch April 30, 2025 07:49
Mr3zee added a commit that referenced this pull request May 8, 2025
Mr3zee added a commit that referenced this pull request May 14, 2025
Mr3zee added a commit that referenced this pull request Jun 30, 2025
Mr3zee added a commit that referenced this pull request Jul 9, 2025
Mr3zee added a commit that referenced this pull request Jul 9, 2025
Mr3zee added a commit that referenced this pull request Jul 24, 2025
Mr3zee added a commit that referenced this pull request Aug 1, 2025
Mr3zee added a commit that referenced this pull request Aug 8, 2025
Mr3zee added a commit that referenced this pull request Aug 21, 2025
Mr3zee added a commit that referenced this pull request Oct 27, 2025
Mr3zee added a commit that referenced this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants