|
| 1 | +1.4.0-RC / 2022-07-20 |
| 2 | +================== |
| 3 | + |
| 4 | +This is a candidate for the next big release with many new exciting features to try. |
| 5 | +It uses Kotlin 1.7.10 by default. |
| 6 | + |
| 7 | +### Integration with Okio's BufferedSource and BufferedSink |
| 8 | + |
| 9 | +[Okio library by Square](https://square.github.io/okio/) is a popular solution for fast and efficient IO operations on JVM, K/N and K/JS. |
| 10 | +In this version, we have added functions that parse/write JSON directly to Okio's input/output classes, saving you the overhead of copying data to `String` beforehand. |
| 11 | +These functions are called `Json.decodeFromBufferedSource` and `Json.encodeToBufferedSink`, respectively. |
| 12 | +There's also `decodeBufferedSourceToSequence` that behaves similarly to `decodeToSequence` from Java streams integration, so you can lazily decode multiple objects the same way as before. |
| 13 | + |
| 14 | +Note that these functions are located in a separate new artifact, so users who don't need them wouldn't find themselves dependent on Okio. |
| 15 | +To include this artifact in your project, use the same group id `org.jetbrains.kotlinx` and artifact id `kotlinx-serialization-json-okio`. |
| 16 | +To find out more about this integration, check new functions' documentation and corresponding pull requests: |
| 17 | +[#1901](https://github.com/Kotlin/kotlinx.serialization/pull/1901) and [#1982](https://github.com/Kotlin/kotlinx.serialization/pull/1982). |
| 18 | + |
| 19 | +### Inline classes and unsigned numbers do not require experimental annotations anymore |
| 20 | + |
| 21 | +Inline classes and unsigned number types have been promoted to a Stable feature in Kotlin 1.5, |
| 22 | +and now we are promoting support for them in kotlinx.serialization to Stable status, too. |
| 23 | +To be precise, [we've removed all](https://github.com/Kotlin/kotlinx.serialization/pull/1963) `@ExperimentalSerializationApi` annotations from functions related to inline classes encoding and decoding, |
| 24 | +namely `SerialDescriptor.isInline`, `Encoder.encodeInline`, and some others. We've also updated related [documentation article](docs/value-classes.md). |
| 25 | + |
| 26 | +Additionally, all `@ExperimentalUnsignedTypes` annotations [were removed](https://github.com/Kotlin/kotlinx.serialization/pull/1962) completely, |
| 27 | +so you can freely use types such as `UInt` and their respective serializers as a stable feature |
| 28 | +without opt-in requirement. |
| 29 | + |
| 30 | +### Part of SerializationException's hierarchy is public now |
| 31 | + |
| 32 | +When kotlinx.serialization 1.0 was released, all subclasses of `SerializationException` were made internal, |
| 33 | +since they didn't provide helpful information besides the standard message. |
| 34 | +Since then, we've received a lot of feature requests with compelling use-cases for exposing some of these internal types to the public. |
| 35 | +In this release, we are starting to fulfilling these requests by making `MissingFieldException` public. |
| 36 | +One can use it in the `catch` clause to better understand the reasons of failure — for example, to return 400 instead of 500 from an HTTP server — |
| 37 | +and then use its `fields` property to communicate the message better. |
| 38 | +See the details in the corresponding [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1983). |
| 39 | + |
| 40 | +In future releases, we'll continue work in this direction, and we aim to provide more useful public exception types & properties. |
| 41 | +In the meantime, we've [revamped KDoc](https://github.com/Kotlin/kotlinx.serialization/pull/1980) for some methods regarding the exceptions — all of them now properly declare which exception types are allowed to be thrown. |
| 42 | +For example, `KSerializer.deserialize` is documented to throw `IllegalStateException` to indicate problems unrelated to serialization, such as data validation in classes' constructors. |
| 43 | + |
| 44 | +### @MetaSerializable annotation |
| 45 | + |
| 46 | +This release introduces a new `@MetaSerializable` annotation that adds `@Serializable` behavior to user-defined annotations — i.e., those annotations would also instruct the compiler plugin to generate a serializer for class. In addition, all annotations marked with `@MetaSerializable` are saved in the generated `@SerialDescriptor` |
| 47 | +as if they are annotated with `@SerialInfo`. |
| 48 | + |
| 49 | +This annotation will be particularly useful for various format authors who require adding some metadata to the serializable class — this can now be done using a single annotation instead of two, and without the risk of forgetting `@Serializable`. Check out details & examples in the KDoc and corresponding [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1979). |
| 50 | + |
| 51 | +> Note: Kotlin 1.7.0 or higher is required for this feature to work. |
| 52 | +
|
| 53 | +### Moving documentation from GitHub pages to kotlinlang.org |
| 54 | + |
| 55 | +As a part of a coordinated effort to unify kotlinx libraries users' experience, Dokka-generated documentation pages (KDoc) were moved from https://kotlin.github.io/kotlinx.serialization/ to https://kotlinlang.org/api/kotlinx.serialization/. No action from you is required — there are proper redirects at the former address, so there is no need to worry about links in your blogpost getting obsolete or broken. |
| 56 | + |
| 57 | +Note that this move does not affect guides written in Markdown in the `docs` folder. We aim to move them later, enriching text with runnable examples as in the Kotlin language guides. |
| 58 | + |
| 59 | +### Other improvements |
| 60 | + |
| 61 | + * Allow Kotlin's null literal in JSON DSL (#1907) (thanks to [Lukellmann](https://github.com/Lukellmann)) |
| 62 | + * Stabilize EmptySerializersModule (#1921) |
| 63 | + * Boost performance of polymorphic deserialization in optimistic scenario (#1919) |
| 64 | + * Added serializer for the `kotlin.time.Duration` class (plugin support comes in Kotlin 1.7.20) (#1960) |
| 65 | + * Support tagged not null marks in TaggedEncoder/Decoder (#1954) (thanks to [EdwarDDay](https://github.com/EdwarDDay)) |
| 66 | + |
| 67 | +### Bugfixes |
| 68 | + |
| 69 | + * Support quoting unsigned integers when used as map keys (#1969) |
| 70 | + * Fix protocol buffer enum schema generation (#1967) (thanks to [mogud](https://github.com/mogud)) |
| 71 | + * Support diamond inheritance of sealed interfaces in SealedClassSerializer (#1958) |
| 72 | + * Support retrieving serializer for sealed interface (#1968) |
| 73 | + * Fix misleading token description in JSON errors (#1941) (thanks to [TheMrMilchmann](https://github.com/TheMrMilchmann)) |
| 74 | + |
1 | 75 | 1.3.3 / 2022-05-11
|
2 | 76 | ==================
|
3 | 77 |
|
@@ -26,7 +100,7 @@ Many thanks to [Paul de Vrieze](https://github.com/pdvrieze) for his valuable co
|
26 | 100 | * Iterate over element indices in ObjectSerializer in order to let the format skip unknown keys (#1916)
|
27 | 101 | * Correctly support registering both default polymorphic serializer & deserializer (#1849)
|
28 | 102 | * Make error message for captured generic type parameters much more straightforward (#1863)
|
29 |
| - |
| 103 | + |
30 | 104 | 1.3.2 / 2021-12-23
|
31 | 105 | ==================
|
32 | 106 |
|
|
0 commit comments