mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
JSON encode defaults
This commit is contained in:
parent
02345597ac
commit
b3b34c19d1
@ -39,9 +39,12 @@ public open class AutoSavePluginData private constructor(
|
||||
public final override val saveName: String
|
||||
get() = _saveName
|
||||
|
||||
private var _saveName: String = saveName
|
||||
@Suppress("JoinDeclarationAndAssignment") // bug
|
||||
private lateinit var _saveName: String
|
||||
|
||||
public constructor(saveName: String) : this(null)
|
||||
public constructor(saveName: String) : this(null) {
|
||||
_saveName = saveName
|
||||
}
|
||||
|
||||
@ConsoleExperimentalApi
|
||||
override fun onInit(owner: PluginDataHolder, storage: PluginDataStorage) {
|
||||
|
@ -65,6 +65,7 @@ internal open class MultiFilePluginDataStorageImpl(
|
||||
ignoreUnknownKeys = true
|
||||
isLenient = true
|
||||
allowStructuredMapKeys = true
|
||||
encodeDefaults = true
|
||||
}
|
||||
|
||||
private val yaml = Yaml.default
|
||||
|
@ -24,8 +24,11 @@ internal class PluginDataTest {
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
private val jsonPrettyPrint = Json { prettyPrint = true }
|
||||
private val json = Json {}
|
||||
private val jsonPrettyPrint = Json {
|
||||
prettyPrint = true
|
||||
encodeDefaults = true
|
||||
}
|
||||
private val json = Json { encodeDefaults = true }
|
||||
|
||||
@Test
|
||||
fun testStringify() {
|
||||
|
@ -10,6 +10,6 @@
|
||||
package net.mamoe.mirai.console.gradle
|
||||
|
||||
internal object VersionConstants {
|
||||
const val CONSOLE_VERSION = "2.0-M1" // value is written here automatically during build
|
||||
const val CONSOLE_VERSION = "2.0-M1-dev-1" // value is written here automatically during build
|
||||
const val CORE_VERSION = "2.0-M1-dev-3" // value is written here automatically during build
|
||||
}
|
Loading…
Reference in New Issue
Block a user