Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create encoders and expose TomlInlineTable's element list * Add a convenience "encode" function and clarify docs * Hook encoding into Toml and TomlFileWriter classes * Add a test and fix errors - Map keys and values weren't being differentiated - currentKey wasn't set for elements within non-class structures - Any element except classes, maps, and lists was throwing an "Unknown kind" exception - TomlArrayEncoder had two incomplete paths for table array elements * Add "type" target to annotations * Add the rest of the tests * Specify the default parameters explicitly for annotations A strange compiler error is thrown otherwise: ERROR_EXPR 'Stub expression for default value of inline' I'll have to file an issue on YouTrack, but in the meantime this works. * Fix import ordering... again * Fix test failures - TomlArrayEncoder.values was never initialized - Non-table-arrays were treated as inline table arrays, leading to an exception - Table entries in table arrays didn't include the parent table array in their keys - Annotations weren't detected on property types The comment annotation tests have been commented out temporarily due to a ClassCastException in the data class. A string array is being cast to a string in the serializer. Is this a bug in kotlinx.serialization? * Clarify the note on TomlComments with an issue ID * Start encoder rewrite * Add output config options for ignoring null and default values * Rewrite encoders and correct some minor test errors * Fix double indentation on dotted table elements * Fix date time and annotation tests - Remove currently unsupported @TomlMultiline from a date time test property - Remove test properties of the form `val x: @annotation X`. This annotation is inaccessible - Disable comment tests pending KT-53235 - Remove offset instants from the date time test, since LocalDateTimes are offset to UTC when converted to instants regardless of the time zone specified * Cleanup and document encoders * Add a SerializersModule property to TomlOutputConfig * Use the serializersModule property in Toml instead * Add a more comprehensive test set and fix errors Polymorphic array elements were being wrongly treated as inline tables; these are now written as nested arrays (i.e. `[ "typeName", value ]`). "Escapes" were rejected in literal strings during writing, a behavior inconsistent with the spec. Null values were encoded regardless of the ignoreNullValues config property. * Fix encoders and writing, and clean up Keys with invalid characters were not promoted to basic or literal keys. Table parents were being explicitly defined; a config property was added for this behavior. Empty tables would fail to write due to a missing stub node. Tables nested more than one level in a table array element were missing the table array key in their headers. Nested inline tables with a single pair are now converted to dotted pairs. Escapes were erroneously rejected in literal strings. In-place serialized primitive lists in polymorphic classes (i.e. sealedTableArrayTest) were serialized as array tables, causing an exception. * Make Diktat happy and clean up dead code * Fix last double indent bug (hopefully) * Move Attributes to its own file * Add a test for string examples from the TOML docs * Explicitly mark enums as @serializable for Native * fixing diktat issues * skipping problematic part of test for js: temp_targets = { cpu = 79.5, case = 72.0 } Co-authored-by: Andrey Kuleshov <andrewkuleshov7@gmail.com>
- Loading branch information