Skip to content

Commit 9852a2f

Browse files
Update docs
1 parent f6cd5de commit 9852a2f

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

docs/formats.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ import kotlinx.serialization.protobuf.*
475475
@Serializable
476476
data class Data(
477477
@ProtoNumber(1) val name: String,
478-
@ProtoOneOf val phone: IPhoneType,
478+
@ProtoOneOf val phone: IPhoneType?,
479479
)
480480

481481
// The oneof interface
@@ -526,7 +526,7 @@ You don't always need to apply the `@ProtoOneOf` form in your class for messages
526526

527527
For example, the following class
528528

529-
```kotlin
529+
```
530530
@Serializable
531531
data class Data2(
532532
@ProtoNumber(1) val name: String,
@@ -535,7 +535,7 @@ data class Data2(
535535
)
536536
```
537537

538-
can also be a valid deserialize target for the message given above, if you don't need polymorphism here.
538+
has binary campatibility with the message given above, which means it can also be a valid deserialize target, if you don't need polymorphism here.
539539

540540
But please note that, if an instance of `Data2` with both `homeNumber` and `workNumber` assigned is serialized in proto wire, and send to another parser, one of the field may be omitted and lead to unknown issue.
541541

guide/example/example-formats-08.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import kotlinx.serialization.protobuf.*
88
@Serializable
99
data class Data(
1010
@ProtoNumber(1) val name: String,
11-
@ProtoOneOf val phone: IPhoneType,
11+
@ProtoOneOf val phone: IPhoneType?,
1212
)
1313

1414
// The oneof interface

guide/example/example-formats-09.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
// This file was automatically generated from formats.md by Knit tool. Do not edit.
22
package example.exampleFormats09
33

4-
@Serializable
5-
data class Data2(
6-
@ProtoNumber(1) val name: String,
7-
@ProtoNumber(2) val homeNumber: String? = null,
8-
@ProtoNumber(3) val workNumber: String? = null,
9-
)
104
import kotlinx.serialization.*
115
import kotlinx.serialization.protobuf.*
126
import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator

0 commit comments

Comments
 (0)