Skip to content

Commit adf350b

Browse files
committed
Merge remote-tracking branch 'origin/master' into dev
2 parents b0189e7 + 4af0f30 commit adf350b

File tree

9 files changed

+628
-39
lines changed

9 files changed

+628
-39
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Submit issues [here](https://github.com/Kotlin/kotlinx.serialization/issues).
2222
* Use a 'feature request' template when creating a new issue.
2323
* Explain why you need the feature — what's your use-case, what's your domain.
2424
* Explaining the problem you face is more important than suggesting a solution.
25-
Report your problem even if you don't have any proposed solution.
25+
Even if you don't have a proposed solution, please report your problem.
2626
* If there is an alternative way to do what you need, then show the code of the alternative.
2727

2828
## Submitting PRs
@@ -40,7 +40,7 @@ so do familiarize yourself with the following guidelines.
4040
* If you fix documentation:
4141
* After fixing/changing code examples in the [`docs`](docs) folder or updating any references in the markdown files
4242
run the [Knit tool](#running-the-knit-tool) and commit the resulting changes as well.
43-
It will not pass the tests otherwise.
43+
Your changes will not pass the tests otherwise.
4444
* If you plan extensive rewrites/additions to the docs, then please [contact the maintainers](#contacting-maintainers)
4545
to coordinate the work in advance.
4646
* If you make any code changes:
@@ -49,7 +49,7 @@ so do familiarize yourself with the following guidelines.
4949
* Use imports with '*'.
5050
* [Build the project](#building) to make sure it all works and passes the tests.
5151
* If you fix a bug:
52-
* Write the test the reproduces the bug.
52+
* Write the test that reproduces the bug.
5353
* Fixes without tests are accepted only in exceptional circumstances if it can be shown that writing the
5454
corresponding test is too hard or otherwise impractical.
5555
* Follow the style of writing tests that is used in this project:
@@ -69,7 +69,7 @@ so do familiarize yourself with the following guidelines.
6969
* You can submit a PR to the [list of community-supported formats](formats/README.md#other-community-supported-formats)
7070
with a description of your library.
7171
* Comment on the existing issue if you want to work on it. Ensure that the issue not only describes a problem,
72-
but also describes a solution that had received a positive feedback. Propose a solution if there isn't any.
72+
but also describes a solution that has received positive feedback. Propose a solution if there isn't any.
7373

7474
## Building
7575

docs/value-classes.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ in `serialize` method:
9898

9999
```kotlin
100100
override fun serialize(encoder: Encoder, value: NamedColor) {
101-
encoder.beginStructure(descriptor) {
101+
encoder.encodeStructure(descriptor) {
102102
encodeSerializableElement(descriptor, 0, Color.serializer(), value.color)
103103
encodeStringElement(descriptor, 1, value.name)
104104
}
@@ -113,7 +113,7 @@ unboxed value:
113113

114114
```kotlin
115115
override fun serialize(encoder: Encoder, value: NamedColor) {
116-
encoder.beginStructure(descriptor) {
116+
encoder.encodeStructure(descriptor) {
117117
encodeInlineElement(descriptor, 0).encodeInt(value.color)
118118
encodeStringElement(descriptor, 1, value.name)
119119
}
@@ -123,7 +123,7 @@ override fun serialize(encoder: Encoder, value: NamedColor) {
123123
The same principle goes also with [CompositeDecoder]: it has [decodeInlineElement][CompositeDecoder.decodeInlineElement] function that returns [Decoder].
124124

125125
If your class should be represented as a primitive (as shown in [Primitive serializer](serializers.md#primitive-serializer) section),
126-
and you cannot use [beginStructure][Encoder.beginStructure] function, there is a complementary function in [Encoder] called [encodeInline][Encoder.encodeInline].
126+
and you cannot use [encodeStructure][Encoder.encodeStructure] function, there is a complementary function in [Encoder] called [encodeInline][Encoder.encodeInline].
127127
We will use it to show an example how one can represent a class as an unsigned integer.
128128

129129
Let's start with a UID class:
@@ -187,7 +187,7 @@ override fun deserialize(decoder: Decoder): UID {
187187
[CompositeDecoder]: https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization.encoding/-composite-decoder/index.html
188188
[CompositeDecoder.decodeInlineElement]: https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization.encoding/-composite-decoder/decode-inline-element.html
189189
[Decoder]: https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization.encoding/-decoder/index.html
190-
[Encoder.beginStructure]: https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization.encoding/-encoder/begin-structure.html
190+
[Encoder.encodeStructure]: https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization.encoding/encode-structure.html
191191
[Encoder.encodeInline]: https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization.encoding/-encoder/encode-inline.html
192192
[Encoder.encodeInt]: https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization.encoding/-encoder/encode-int.html
193193

dokka/moduledoc.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ format implementation.
55
# Module kotlinx-serialization-json
66
Stable and ready to use JSON format implementation, `JsonElement` API to operate with JSON trees and JSON-specific serializers.
77

8+
# Module kotlinx-serialization-json-okio
9+
Extensions for kotlinx.serialization.json.Json for integration with the popular [Okio](https://square.github.io/okio/) library.
10+
Currently experimental.
11+
812
# Module kotlinx-serialization-cbor
913
Concise Binary Object Representation (CBOR) format implementation, as per [RFC 7049](https://tools.ietf.org/html/rfc7049).
1014

@@ -17,7 +21,7 @@ You can learn about "Human-Optimized Config Object Notation" or HOCON from libra
1721
Allows converting arbitrary hierarchy of Kotlin classes to a flat key-value structure à la Java Properties.
1822

1923
# Module kotlinx-serialization-protobuf
20-
Protocol buffers serialization format implementation, mostly compliant to [proto2](https://developers.google.com/protocol-buffers/docs/proto) specification.
24+
[Protocol buffers](https://protobuf.dev/) serialization format implementation.
2125

2226
# Package kotlinx.serialization
2327
Basic core concepts and annotations that set up serialization process.
@@ -42,8 +46,14 @@ HOCON serialization format implementation for converting Kotlin classes from and
4246
JSON serialization format implementation, JSON tree data structures with builders for them,
4347
and JSON-specific serializers.
4448

49+
# Package kotlinx.serialization.json.okio
50+
Extensions for kotlinx.serialization.json.Json for integration with the popular [Okio](https://square.github.io/okio/) library.
51+
4552
# Package kotlinx.serialization.protobuf
46-
Protocol buffers serialization format implementation, mostly compliant to [proto2](https://developers.google.com/protocol-buffers/docs/proto) specification.
53+
[Protocol buffers](https://protobuf.dev/) serialization format implementation.
54+
55+
# Package kotlinx.serialization.protobuf.schema
56+
Experimental generator of ProtoBuf schema from Kotlin classes.
4757

4858
# Package kotlinx.serialization.properties
4959
Properties serialization format implementation that represents the input data as a plain map of properties.

formats/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ were not included in the core library.
55

66
For convenience, they have same `groupId`, versioning and release cycle as core library.
77

8-
| Format | Artifact id | Platform | Status | Notes |
9-
|------------|------------------------------------|-------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
10-
| JSON | `kotlinx-serialization-json` | all supported platforms | stable |
11-
| HOCON | `kotlinx-serialization-hocon` | JVM only | experimental | Allows deserialization of `Config` object from popular [lightbend/config](https://github.com/lightbend/config) library into Kotlin objects.You can learn about "Human-Optimized Config Object Notation" or HOCON from library's [readme](https://github.com/lightbend/config#using-hocon-the-json-superset). |
12-
| ProtoBuf | `kotlinx-serialization-protobuf` | all supported platforms | experimental |
13-
| CBOR | `kotlinx-serialization-cbor` | all supported platforms | experimental |
14-
| Properties | `kotlinx-serialization-properties` | all supported platforms | experimental | Allows converting arbitrary hierarchy of Kotlin classes to a flat key-value structure à la Java Properties. |
8+
| Format | Artifact id | Platform | Status | Notes |
9+
|------------|------------------------------------|---------------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
10+
| JSON | `kotlinx-serialization-json` | all supported platforms | stable | |
11+
| JSON-Okio | `kotlinx-serialization-json-okio` | all supported by Okio platforms | experimental | Extensions on Json for integration with [Okio](https://square.github.io/okio/) library. |
12+
| HOCON | `kotlinx-serialization-hocon` | JVM only | experimental | Allows deserialization of `Config` object from popular [lightbend/config](https://github.com/lightbend/config) library into Kotlin objects.You can learn about "Human-Optimized Config Object Notation" or HOCON from library's [readme](https://github.com/lightbend/config#using-hocon-the-json-superset). |
13+
| ProtoBuf | `kotlinx-serialization-protobuf` | all supported platforms | experimental | |
14+
| CBOR | `kotlinx-serialization-cbor` | all supported platforms | experimental | |
15+
| Properties | `kotlinx-serialization-properties` | all supported platforms | experimental | Allows converting arbitrary hierarchy of Kotlin classes to a flat key-value structure à la Java Properties. |
1516

1617
## Other community-supported formats
1718

formats/json-okio/build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright 2017-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
import Java9Modularity.configureJava9ModuleInfo
5+
import org.jetbrains.dokka.gradle.*
6+
import java.net.*
57

68
plugins {
79
kotlin("multiplatform")
@@ -29,3 +31,16 @@ kotlin {
2931
}
3032

3133
project.configureJava9ModuleInfo()
34+
35+
tasks.named<DokkaTaskPartial>("dokkaHtmlPartial") {
36+
dokkaSourceSets {
37+
configureEach {
38+
externalDocumentationLink {
39+
url.set(URL("https://square.github.io/okio/3.x/okio/"))
40+
packageListUrl.set(
41+
file("dokka/okio.package.list").toURI().toURL()
42+
)
43+
}
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)