Skip to content

Fix ProtoBuf schema generation for value classes in collections - #3206

Open
saar wants to merge 1 commit into
Kotlin:devfrom
saar:fix/protobuf-schema-value-class-in-collections
Open

Fix ProtoBuf schema generation for value classes in collections#3206
saar wants to merge 1 commit into
Kotlin:devfrom
saar:fix/protobuf-schema-value-class-in-collections

Conversation

@saar

@saar saar commented Jun 6, 2026

Copy link
Copy Markdown

The schema generator only unwrapped @JvmInline value classes for plain message fields. Inside a List, Array, or as a Map value the value class was left wrapped, so the schema used the wrapper type and added an extra message for it.

Unwrapping is now shared in a small unwrapInlineType helper and applied in generateListType and generateMapType. Packed repeated fields and map keys are unchanged.

Added InlineClassesInCollections to the schema generation test, covering a value class in a List, an Array, and a Map value.

Fixes #3205

The schema generator only unwrapped `@JvmInline` value classes for plain
message fields. Inside a `List`, `Array`, or as a `Map` value the value class
was left wrapped, so the schema used the wrapper type and added an extra
message for it.

Unwrapping is now shared in a small `unwrapInlineType` helper and applied in
`generateListType` and `generateMapType`. Packed repeated fields and map keys
are unchanged.

Fixes Kotlin#3205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant