mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50: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
|
public final override val saveName: String
|
||||||
get() = _saveName
|
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
|
@ConsoleExperimentalApi
|
||||||
override fun onInit(owner: PluginDataHolder, storage: PluginDataStorage) {
|
override fun onInit(owner: PluginDataHolder, storage: PluginDataStorage) {
|
||||||
|
@ -65,6 +65,7 @@ internal open class MultiFilePluginDataStorageImpl(
|
|||||||
ignoreUnknownKeys = true
|
ignoreUnknownKeys = true
|
||||||
isLenient = true
|
isLenient = true
|
||||||
allowStructuredMapKeys = true
|
allowStructuredMapKeys = true
|
||||||
|
encodeDefaults = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private val yaml = Yaml.default
|
private val yaml = Yaml.default
|
||||||
|
@ -24,8 +24,11 @@ internal class PluginDataTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
private val jsonPrettyPrint = Json { prettyPrint = true }
|
private val jsonPrettyPrint = Json {
|
||||||
private val json = Json {}
|
prettyPrint = true
|
||||||
|
encodeDefaults = true
|
||||||
|
}
|
||||||
|
private val json = Json { encodeDefaults = true }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testStringify() {
|
fun testStringify() {
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
package net.mamoe.mirai.console.gradle
|
package net.mamoe.mirai.console.gradle
|
||||||
|
|
||||||
internal object VersionConstants {
|
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
|
const val CORE_VERSION = "2.0-M1-dev-3" // value is written here automatically during build
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user