-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quilt Config via Kotlinx Serialization #13
Comments
This issue is a bit to vague ihmo. What exactly is the goal? |
The goal is to be able to use a preexisting serializable class with the quilt config system |
In what sense? Do you think you could give an example? |
@Serializable
class SerializableClass {
var name: String = "Name" // Will be serialized into a string
var custom: Custom = Custom.apply {
name = "Test"
}
}
@Serializable
@SerialName("Custom")
class Custom {
var name: String
}
class CustomSerializaer : KSerializer<Custom> {
override fun serialize(encoder: Encoder, value: Custom) {
val string = value.name
encoder.encodeString(string)
}
override fun deserialize(decoder: Decoder): Custom {
val string = decoder.decodeString()
return Custom().apply {
name = string
}
}
} This would get serialized into this (Assuming JSON5) {
name: "Name",
custom: "Test!"
} It can get more complex that that, though, with multiple properties in custom serializers |
@NoComment1105 has more experience with kotlinx serialization, so they might be able to help more with this |
ok that is the Kotlinx serialization part, but how does it "connect" to configs?
(Also fyi: custom serializers don't automatically get used like that) |
Intro:
Jetbrains has a Kotlinx library that handles serialization of classes for config and other stuff. A bridge between this and Quilt Config would be beneficial to modders who are already familiar with Kotlinx Serialization
Existing Work:
Not any that I can find, mostly because Quilt Config is relatively new
The text was updated successfully, but these errors were encountered: