You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+88-31Lines changed: 88 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,60 @@
1
+
1.2.0 / 2021-04-27
2
+
==================
3
+
4
+
This release contains a lot of new features and important improvements listed below;
5
+
Kotlin 1.5.0 is used as a default compiler and language version.
6
+
7
+
### JSON performance improvements
8
+
9
+
JSON encoder and decoder were revisited and significantly rewritten,
10
+
which lead us to up to 2-3x times speedup in certain cases.
11
+
Additional details can be found in the corresponding issues: [[1]](https://github.com/Kotlin/kotlinx.serialization/pull/1343), [[2]](https://github.com/Kotlin/kotlinx.serialization/pull/1354).
12
+
13
+
### Ability to specify alternative names during JSON decoding
14
+
15
+
[The one of the most voted issues](https://github.com/Kotlin/kotlinx.serialization/issues/203) is fixed now — it is possible to specify multiple names for one property
16
+
using new `@JsonNames` annotation.
17
+
Unlike `@SerialName`, it only affects JSON decoding, so it is useful when dealing with different versions of the API.
18
+
We've prepared a [documentation](https://github.com/Kotlin/kotlinx.serialization/blob/dev/docs/json.md#alternative-json-names) for you about it.
19
+
20
+
### JsonConfiguration in public API
21
+
22
+
`JsonConfiguration` is exposed as a property of `Json` instance. You can use it to adjust behavior in
23
+
your [custom serializers](https://github.com/Kotlin/kotlinx.serialization/blob/dev/docs/json.md#maintaining-custom-json-attributes).
24
+
Check out more in the corresponding [issue](https://github.com/Kotlin/kotlinx.serialization/issues/1361) and the [PR](https://github.com/Kotlin/kotlinx.serialization/pull/1409).
25
+
26
+
### Generator for .proto files based on serializable Kotlin classes
27
+
28
+
Our implementation of Protocol Buffers format uses `@Serializable` Kotlin classes as a source of schema.
29
+
This is very convenient for Kotlin-to-Kotlin communication, but makes interoperability between languages complicated.
30
+
To resolve this [issue](https://github.com/Kotlin/kotlinx.serialization/issues/34), we now have a
31
+
schema generator that can produce .proto files out of Kotlin classes. Using it, you can keep Kotlin
32
+
classes as a source of truth and use traditional protoc compilers for other languages at the same time.
33
+
To learn more, check out the documentation for the new `ProtoBufSchemaGenerator` class or
34
+
visit the [corresponding PR](https://github.com/Kotlin/kotlinx.serialization/pull/1255).
35
+
36
+
>Note: this generator is on its experimental stage and any feedback is very welcomed.
37
+
38
+
### Contextual serialization of generic classes
39
+
40
+
Before 1.2.0, it was [impossible](https://github.com/Kotlin/kotlinx.serialization/issues/1407) to register context serializer for generic class,
41
+
because `contextual` function accepted a single serializer.
42
+
Now it is possible to register a provider — lambda that allows to construct a serializer for generic class
43
+
out of its type arguments serializers. See the details in the [documentation](https://github.com/Kotlin/kotlinx.serialization/blob/dev/docs/serializers.md#contextual-serialization-and-generic-classes).
44
+
45
+
### Other features
46
+
47
+
* Support for watchosX64 target (#1366).
48
+
* Introduce kotlinx-serialization-bom (#1356).
49
+
* Support serializer<T> on JS IR when T is an interface (#1431).
50
+
51
+
### Bugfixes
52
+
53
+
* Fix serializer lookup by KType for third party classes (#1397) (thanks to [mvdbos](https://github.com/mvdbos)).
54
+
* Fix inability to encode/decode inline class with string to JsonElement (#1408).
55
+
* Throw SerializationException instead of AIOB in ProtoBuf (#1373).
56
+
* Fix numeric overflow in JsonLexer (#1367) (thanks to [EdwarDDay](https://github.com/EdwarDDay)).
57
+
1
58
2
59
1.1.0 / 2021-02-17
3
60
==================
@@ -12,19 +69,19 @@ We suggest you to remove `jcenter()` and other kotlin bintray repositories from
12
69
1.1.0-RC / 2021-02-03
13
70
==================
14
71
15
-
This is a release candidate of 1.1.0 version. Note that final 1.1.0 version may include more features and bugfixes,
72
+
This is a release candidate of 1.1.0 version. Note that final 1.1.0 version may include more features and bugfixes,
16
73
which would be listed in the corresponding changelog.
17
74
18
75
### Kotlin version requirement updated
19
76
20
-
Due to changes in calling conventions between compiler plugin and serialization core runtime, this release requires
77
+
Due to changes in calling conventions between compiler plugin and serialization core runtime, this release requires
21
78
Kotlin version at least 1.4.30-M1. However, this changes should not affect your code,
22
79
because only deprecated functions were removed from public API.
23
80
See [corresponding PR](https://github.com/Kotlin/kotlinx.serialization/pull/1260) for the details.
24
81
25
82
### Experimental support for inline classes (IR only)
26
83
27
-
Using 1.1.0-RC, you can mark inline classes as `@Serializable` and use them in other serializable classes.
84
+
Using 1.1.0-RC, you can mark inline classes as `@Serializable` and use them in other serializable classes.
28
85
Unsigned integer types (`UByte`, `UShort`, `UInt` and `ULong`) are serializable as well and have special support in JSON.
29
86
This feature requires Kotlin compiler 1.4.30-RC and enabling new IR compilers for [JS](https://kotlinlang.org/docs/reference/js-ir-compiler.html) and [JVM](https://kotlinlang.org/docs/reference/whatsnew14.html#new-jvm-ir-backend).
30
87
@@ -36,7 +93,7 @@ and corresponding [pull request](https://github.com/Kotlin/kotlinx.serialization
36
93
* Add `serializerOrNull` function for `KType` and `Type` arguments (#1164)
37
94
* Allow shared prefix names in `Properties` (#1183) (thanks to [TorRanfelt](https://github.com/TorRanfelt))
38
95
* Add support for encoding/decoding `Properties` values as Strings (#1158) (thanks to [daniel-jasinski](https://github.com/daniel-jasinski))
39
-
96
+
40
97
### Bugfixes and performance improvements
41
98
42
99
* Support contextual serialization for derived classes (#1277) (thanks to [Martin Raison](https://github.com/martinraison))
@@ -62,30 +119,30 @@ This patch release contains several feature improvements as well as bugfixes and
62
119
* Add object-based serialization and deserialization of polymorphic types for `dynamic` conversions on JS platform (#1122)
63
120
* Add support for object polymorphism in HOCON decoder (#1136)
64
121
* Add support of decoding map in the root of HOCON config (#1106)
65
-
122
+
66
123
### Bugfixes
67
124
* Properly cache generated serializers in PluginGeneratedSerialDescriptor (#1159)
68
125
* Add Pair and Triple to serializer resolving from Java type token (#1160)
69
126
* Fix deserialization of half-precision, float and double types in CBOR (#1112)
70
127
* Fix ByteString annotation detection when ByteArray is nullable (#1139)
71
-
128
+
72
129
1.0.0 / 2020-10-08
73
130
==================
74
131
75
132
The first public stable release, yay!
76
133
The definitions of stability and backwards compatibility guarantees are located in the [corresponding document](docs/compatibility.md).
77
134
We now also have a GitHub Pages site with [full API reference](https://kotlin.github.io/kotlinx.serialization/).
78
135
79
-
Compared to RC2, no new features apart from #947 were added and all previously deprecated declarations and migrations were deleted.
136
+
Compared to RC2, no new features apart from #947 were added and all previously deprecated declarations and migrations were deleted.
80
137
If you are using RC/RC2 along with deprecated declarations, please, migrate before updating to 1.0.0.
81
138
In case you are using pre-1.0 versions (e.g. 0.20.0), please refer to our [migration guide](docs/migration.md).
82
-
139
+
83
140
### Bugfixes and improvements
84
141
85
142
* Support nullable types at top-level for JsonElement decoding (#1117)
86
143
* Add CBOR ignoreUnknownKeys option (#947) (thanks to [Travis Wyatt](https://github.com/twyatt))
87
144
* Fix incorrect documentation of `encodeDefaults` (#1108) (thanks to [Anders Carling](https://github.com/anderscarling))
88
-
145
+
89
146
1.0.0-RC2 / 2020-09-21
90
147
==================
91
148
@@ -110,7 +167,7 @@ writing a library that depends on kotlinx.serialization in a format-agnostic way
110
167
*`encodeDefaults` flag is now set to `false` in the default configuration for JSON, CBOR and Protocol Buffers.
111
168
112
169
The change is motivated by the fact that in most real-life scenarios, this flag is set to `false` anyway,
113
-
because such configuration reduces visual clutter and saves amount of data being serialized.
170
+
because such configuration reduces visual clutter and saves amount of data being serialized.
114
171
Other libraries, like GSON and Moshi, also have this behavior by default.
115
172
116
173
This may change how your serialized data looks like, if you have not set value for `encodeDefaults` flag explicitly.
@@ -144,8 +201,8 @@ To migrate, simply add `import kotlinx.serialization.json.*` to your files.
144
201
Release candidate for 1.0.0 version. The goal of RC release is to collect feedback from users
145
202
and provide 1.0.0 release with bug fixes and improvements based on that feedback.
146
203
147
-
While working on 1.0.0 version, we carefully examined every public API declaration of the library and
148
-
split it to stable API, that we promise to be source and binary-compatible,
204
+
While working on 1.0.0 version, we carefully examined every public API declaration of the library and
205
+
split it to stable API, that we promise to be source and binary-compatible,
149
206
and experimental API, that may be changed in the future.
150
207
Experimental API is annotated with `@ExperimentalSerializationApi` annotation, which requires opt-in.
151
208
For a more detailed description of the guarantees, please refer to the [compatibility guide](docs/compatibility.md).
@@ -180,7 +237,7 @@ of `Json {}` builder
180
237
* Redundant members of `JsonElement` API are deprecated or extracted to extensions
181
238
* Potential error-prone API is removed
182
239
*`JsonLiteral` is deprecated in favor of `JsonPrimitive` constructors with nullable parameter
183
-
240
+
184
241
*`JsonElement` builders rework to be aligned with stdlib collection builders (#418, #627)
185
242
* Deprecated infix `to` and unaryPlus in JSON DSL in favor of `put`/`add` functions
186
243
*`jsonObject {}` and `json {}` builders are renamed to `buildJsonObject {}` and `buildJsonArray {}`
@@ -195,20 +252,20 @@ of `Json {}` builder
195
252
* Methods in `JsonTransformingSerializer` are renamed to `transformSerialize` and `transformDeserialize`
196
253
*`JsonParametricSerializer` is renamed to `JsonContentPolymorphicSerializer`
197
254
*`JsonEncodingException` and `JsonDecodingException` are made internal
198
-
255
+
199
256
* Bug fixes
200
257
*`IllegalStateException` when `null` occurs in JSON input in the place of an expected non-null object (#816)
201
258
* java.util.NoSuchElementException when deserializing twice from the same JsonElement (#807)
202
259
203
-
#### Core API for format authoring
260
+
#### Core API for format authoring
204
261
205
262
* The new naming scheme for `SerialFormats`
206
263
* Core functions in `StringFormat` and `BinaryFormat` are renamed and now follow the same naming scheme
207
264
*`stringify`/`parse` are renamed to `encodeToString`/`decodeFromString`
208
265
*`encodeToByteArray`/`encodeToHexString`/`decodeFromByteArray`/`decodeFromHexString` in `BinaryFormat` are introduced instead of `dump`/`dumps`/`load`/`loads`
209
266
210
267
* New format instances building convention
211
-
* Constructors replaced with builder-function with the same name to have the ability to add new configuration parameters,
268
+
* Constructors replaced with builder-function with the same name to have the ability to add new configuration parameters,
212
269
while preserving both source and binary compatibility
213
270
* Format's companion objects now extend format class and can be used interchangeably
214
271
@@ -231,15 +288,15 @@ of `Json {}` builder
231
288
* Contextual serialization
232
289
*`@ContextualSerialization` is split into two annotations: `@Contextual` to use on properties and `@UseContextualSerialization` to use on file
233
290
* New `SerialDescriptor.capturedKClass` API to introspect SerializersModule-based contextual and polymorphic kinds (#515, #595)
234
-
291
+
235
292
* Encoding-related API
236
293
* Encoding-related classes (`Encoder`, `Decoder`, `AbstractEncoder`, `AbstractDecoder`) are moved to a separate `kotlinx.serialization.encoding` package
237
294
* Deprecated `typeParameters` argument in `beginStructure`/`beginCollectio`n methods
238
295
* Deprecated `updateSerializableValue` and similar methods and `UpdateMode` enum
239
-
* Renamed `READ_DONE` to `DECODE_DONE`
296
+
* Renamed `READ_DONE` to `DECODE_DONE`
240
297
* Make extensions `inline` where applicable
241
298
*`kotlinx.io` mockery (`InputStream`, `ByteArrayInput`, etc) is removed
242
-
299
+
243
300
* Serializer-related API
244
301
*`UnitSerializer` is replaced with `Unit.serializer()`
245
302
* All methods for serializers retrieval are renamed to `serializer`
@@ -249,7 +306,7 @@ of `Json {}` builder
249
306
* Support of custom serializers for nullable types is added (#824)
250
307
251
308
#### ProtoBuf
252
-
309
+
253
310
*`ProtoBuf` constructor is replaced with `ProtoBuf {}` builder function
254
311
*`ProtoBuf` companion object now extends `ProtoBuf`
255
312
*`ProtoId` is renamed to `ProtoNumber`, `ProtoNumberType` to `ProtoIntegerType` to be consistent with ProtoBuf specification
@@ -261,7 +318,7 @@ of `Json {}` builder
261
318
#### Other formats
262
319
* All format constructors are migrated to builder scheme
263
320
* Properties serialize and deserialize enums as strings (#818)
264
-
* CBOR major type 2 (byte string) support (#842)
321
+
* CBOR major type 2 (byte string) support (#842)
265
322
*`ConfigParser` is renamed to `Hocon`, `kotlinx-serialization-runtime-configparser` artifact is renamed to `kotlinx-serialization-hocon`
266
323
* Do not write/read size of collection into Properties' map (#743)
267
324
@@ -270,18 +327,18 @@ of `Json {}` builder
270
327
271
328
### Release notes
272
329
273
-
0.20.0 release is focused on giving a library its final and stable API shape.
330
+
0.20.0 release is focused on giving a library its final and stable API shape.
274
331
275
332
We have carefully evaluated every `public` declaration and
276
333
decided whether it should be publicly available. As a result, some declarations were deprecated with an intention of removing
277
-
them from public API because they are going to be replaced with others, more valuable and useful for users.
334
+
them from public API because they are going to be replaced with others, more valuable and useful for users.
278
335
279
-
Deprecated symbols include:
336
+
Deprecated symbols include:
280
337
- Pre-defined JSON instances like `nonStrict` — `strictMode` was split to 3 separate, more granular, flags.
281
-
Users are encouraged to create their own configuration;
338
+
Users are encouraged to create their own configuration;
282
339
- Top-level serializers like `IntSerializer` and `ArrayListSerializer`.
283
340
They were replaced with constructor-like factory functions.
284
-
-`SerialClassDescImpl` creation class replaced with `SerialDescriptor`
341
+
-`SerialClassDescImpl` creation class replaced with `SerialDescriptor`
285
342
builder function to ease writing of custom serializers and maintain `SerialDescriptor` contract.
286
343
- Internal utilities, like HexConverter and ByteBuffer, were deprecated as not relevant to serialization public API.
287
344
- Add-on formats like Protobuf, CBOR and Properties (formerly Mapper)
@@ -290,18 +347,18 @@ are now extracted to [separate artifacts](formats/README.md#protobuf) to keep th
290
347
We have spent a lot of effort into the quality,
291
348
documenting most of the core interfaces, establishing their contracts,
292
349
fixing numerous of bugs, and even introducing new features that may be useful for those of you who
293
-
write custom serializers — see [JsonTransformingSerializer](docs/json_transformations.md).
350
+
write custom serializers — see [JsonTransformingSerializer](docs/json_transformations.md).
294
351
295
352
Such API changes, of course, may be not backwards-compatible in some places, in particular, between compiler plugin and runtime.
296
353
Given that the library is still is in the experimental phase, we took the liberty to introduce breaking changes in order to give users
297
354
the better, more convenient API. Therefore, this release has number `0.20.0` instead of `0.15.0`;
298
355
Kotlin 1.3.70 is compatible _only_ with this release.
299
356
300
-
To migrate:
357
+
To migrate:
301
358
1. Replace `import kotlinx.serialization.internal.*` with `import kotlinx.serialization.builtins.*`.
302
359
This action is sufficient for most of the cases, except primitive serializers — instead of using `IntSerializer`, use `Int.serializer()`.
303
360
For other object-like declarations, you may need to transform it to function call: `ByteArraySerializer` => `ByteArraySerializer()`.
304
-
361
+
305
362
2. Pay attention to the changed `JsonConfiguration` constructor arguments: instead of `strictMode`,
306
363
now three different flags are available: `ignoreUnknownKeys`, `isLenient`, and `serializeSpecialFloatingPointValues`.
307
364
@@ -312,8 +369,8 @@ because now they're located outside of core module. See [formats list](formats/R
312
369
(use Alt+Enter for quickfix replacing).
313
370
314
371
### Full changelog (by commit):
315
-
316
-
* This release is compatible with Kotlin 1.3.70
372
+
373
+
* This release is compatible with Kotlin 1.3.70
317
374
* Rework polymorphic descriptors: polymorphic and sealed descriptor elements are now aligned with an actual serialization process (#731)
318
375
* Hide internal collection and map serializers
319
376
* Introduce factories for ArraySerializers as well, deprecate top-level array serializers
0 commit comments