Skip to content
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

Problems handling :: for string without quote #66

Open
MarcinMoskala opened this issue Jan 31, 2024 · 0 comments
Open

Problems handling :: for string without quote #66

MarcinMoskala opened this issue Jan 31, 2024 · 0 comments

Comments

@MarcinMoskala
Copy link

This code demonstrates the problem:

@Serializable
class HeaderConfig(
    val deckName: String,
    val articleFileName: String? = null,
    val packageDestination: String? = null,
)
val headerContent = """
    deckName: Aktywne::Zasady
    articleFileName: this/is/some/file.md
""".trimIndent()

suspend fun main() = coroutineScope<Unit> {
    val yaml by lazy {
        Yaml {
            encodeDefaultValues = false
            stringSerialization = YamlBuilder.StringSerialization.DOUBLE_QUOTATION
        }
    }
    val headerConfig = yaml.decodeFromString(HeaderConfig.serializer(), headerContent)
    println(headerConfig.deckName) // Aktywne
    println(headerConfig.articleFileName) // null
}

The result is:

Aktywne
null

Where it should be:

Aktywne::Zasady
this/is/some/file.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant