Age | Commit message (Collapse) | Author |
|
|
|
Implement ClassDiscriminatorMode.ALL, .NONE, and .POLYMORPHIC
As a part of the solution for #1247
|
|
Do not try to coerce input values for properties that do not have default values.
Trying so leads to confusing errors about missing values despite a json key actually
present in the input.
Fixes #2529
|
|
because it is a widespread convention.
Fixes #2502
|
|
Make the TaggedDecoder.decodeNullableSerializableElement implementation consistent with AbstractDecoder,
so it is possible to differentiate nullable and non-nullable serializers.
Fixes #2455
|
|
Being thrown on an attempt to retrieve serializer for some private implementation classes from stdlib.
Fixes #2449
|
|
Previously, when discriminator was found as the first key in Json, but there was no deserializer for it, we still fell back to a slow path with JsonTree.
It was actually meaningless because a slow path always throws exception when a serializer is not found.
Such behavior led to unnecessary memory pressure & consumption in exceptional cases (see linked ticket for details).
Also make polymorphic deserialization exception messages more meaningful and make them more consistent with serialization ones.
Also fix behavior when the actual discriminator value is JsonNull (it should be treated as missing, not as "null" string).
Fixes #2478
|
|
This is one of the popular community requests and one of the main reasons people ask for Json5 support.
Implementing this flag separately will allow for alleviating large paint points quickly without waiting for full Json5 support.
Fixes #1812
Relates to: #797, #2221
|
|
(#2473)
* Build improvements: Kotlin 1.9.20-RC, default target hierarchy, bump Okio
Updated to Kotlin 1.9.20-RC:
- Kotlin 1.9.0/10 had some blockers in XCode 15 support.
- Simplify WASM setup (it has been changed in 1.9.20).
- Drop obsolete Native targets
Apply default target hierarchy:
- Greatly simplified buildscript for native targets.
- Supported targets are now runnable from gutter in the IDE.
- Now all possible targets are built by default (without -Pnative.deploy flag), resulting in less confusion for contributors and CI (but longer local `check` times).
- Publishing library with K2 should be possible now, no more incorrect `publishNativeKotlinMetadata` failing task.
- More targets available in integration-test project.
Updated Okio for:
- linuxArm64 target support
|
|
declarations (#2444)
* Introduce additional internal opt-in annotation to hide declarations even more
* Rename JsonWriter and SerialReader to something more internal-ish
* Refactor internal extensions on Json into top-level functions to remove them from completion (because even optable-in declarations are shown in completion for all users)
* Propagate opt-ins to verifyKotlinModule task
Related: https://youtrack.jetbrains.com/issue/KTIJ-27132
|
|
We ignore quoted/unquoted state when decoding maps with number keys, so it is logical to do the same for boolean maps.
Fixes #2438
|
|
* Implement wasm target
* Slightly fix test data to suite wasm fp parser
Wasm fp parser has a different algorithm, so fix the tests to have similar results for all platforms
* Update okio version to 3.5.0
* Kotlin 1.9.30+ support
|
|
To avoid cryptic and incorrect ones, such as `Expected quotation mark '"', but had '"' instead` or `unexpected token: 10`.
Fixes #2360
Fixes #2399
Also remove @PublishedApi from BATCH_SIZE to remove it from public API dump.
|
|
The annotation will be added to the named companion class by the compiler starting from 1.9.20
|
|
- Apply @ExperimentalNativeApi on WeakReference usages
- Drop Legacy JS compiler as it is deprecated
- Update API Dump with .entries enum properties
- Update yarn.lock
|
|
|
|
parsing optimization: (#2362)
In case of an empty object, no exception should be thrown, it should be treated as missing class discriminator.
peekString() correctly handles this case.
Also fixes misplaced calls in lenient vs non-lenient mode.
Fixes #2353
|
|
It allows decoding enum values in a case-insensitive manner. It does not affect CLASS kinds or encoding. It is one of the most-voted feature requests.
Also enhance JsonNamingStrategy documentation.
Fixes #209
|
|
same as outer (#2346)
Instead of returning the same instance of decoder (with invalid position) a new instance is created, and polyDiscriminator and polyDescriptor are passed to the new instance.
This way check for unknown keys in endStructure can properly filter out polymorphic discriminator (by default "type) from potential unknown keys.
Fixes #2343
|
|
* Remove @SharedImmutable usages
The annotation is deprecated and has no effect.
* Suppress animal sniffer error in a data class with boolean property
The error is a result of changes in data class hashCode generation.
The generated code now uses the static Boolean.hashCode() to calculate hash code of boolean properties. The static function is available only since Java 1.8.
|
|
types (#2331)
Fixes #2323
In the current implementation of serializer lookup caching, if the serializer for the parameter was not found, the `serializerOrNull` function always returned null, without further searching for contextual serializers in the current SerializersModule.
|
|
Fixes #2078
|
|
Fixes #2127
|
|
- Move meta-serializable annotations to top-level.
- Specify argument for `@Serializable` when companion serializer is used.
|
|
- Value class is located at top-level, but wraps non-primitive and thus does not fall in 'primitive on top-level' branch
- Value class is a subclass in a polymorphic hierarchy, but either is primitive or explicitly recorded without type info
Note that type info is omitted in the latter case and 'can't add type info to primitive' error is not thrown deliberately, as
there seems to be use-cases for that.
Fixes #1774
Fixes #2159
|
|
inputs: (#2268)
hasNext() shouldn't throw exception if it was called more than once
after the stream has ended.
Fixes #2267
|
|
|
|
Fixes #2212
|
|
If all KSerializer members are overridden in custom serializer, then the annotation '@Serializer' is not needed
|
|
Added stream-friendly version of decodeString for new ChunkedDecoder interface.
Fixes #1987
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
|
|
Fixed #2170
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
|
|
|
|
names. (#2111)
Provide a basic implementation of SnakeCase strategy
Fixes #33
|
|
|
|
for the same KClass in SealedClassSerializer.
Previous fix supported only equal serializers.
Fixes #2110
Fixes #1937
|
|
* Add benchmark
* Introduce pooling of CharArray for InputStream decoding: by default, 16k buffer is allocated for char-related operations, and it may create a non-trivial GC pressure for small objects decoding
* The estimated performance improvement is tens of percents, reaching 70% on our ASCII benchmarks
Fixes #1893
|
|
Fixes #2065
PR #2070
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|
|
As it is needed for third-part converter libraries.
Revamp docs for all overloads of serializer().
|
|
This PR provides a new function for encoding raw JSON content, without quoting it as a string. This allows for encoding JSON numbers of any size or precision, so BigDecimal and BigInteger can be supported.
Fixes #1051
Fixes #1405
The implementation is similar to how unsigned numbers are handled.
JsonUnquotedLiteral() is a new function that allows creating literal JSON content.
Added val coerceToInlineType to JsonLiteral, so that JsonUnquotedLiteral could use encodeInline()
Defined val jsonUnquotedLiteralDescriptor as a 'marker', for use with encodeInline()
ComposerForUnquotedLiterals (based on ComposerForUnsignedNumbers) will 'override' the encoder when a JsonLiteral has the jsonUnquotedLiteralDescriptor marker, and will encode the content as a string without surrounding quotes.
|
|
This makes test failures easier to see, because when the test fails IntelliJ will generate a 'click to see difference' link that opens the IntelliJ comparison editor, with the two strings provided.
https://stackoverflow.com/q/10934743/4161471
|
|
Also add tests on various `@Serializable` applications
Apply suggestions from code review
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|
|
Fixes #1745
Fixes #1480
Resolves #1989
|
|
Resolves #683 #1372
|
|
|
|
Fixes #2030
|
|
For fix of issues #1705 KT-50764 KT-50718
|
|
Fixes #2006
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
|
|
|
|
Fixes #1266
|
|
Co-authored-by: rsinukov <rxsinukov@gmail.com>
Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
|