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

TOML Table array mapping #39

Closed
Cubxity opened this issue Aug 31, 2019 · 2 comments
Closed

TOML Table array mapping #39

Cubxity opened this issue Aug 31, 2019 · 2 comments

Comments

@Cubxity
Copy link

Cubxity commented Aug 31, 2019

Hey, I've been trying to map toml table array but it returns an empty list.

TOML:

[[editors]]
id = "bytespy.jvm.bytecode.editor"
impl = "dev.cubxity.bytespy.jvm.impl.editor.BytecodeContentEditor"
content = "org.objectweb.asm.tree.ClassNode"
description = "JVM Bytecode editor"

[[editors]]
id = "bytespy.jvm.bytecode.decompiler"
impl = "dev.cubxity.bytespy.jvm.impl.editor.DecompiledContentEditor"
content = "org.objectweb.asm.tree.ClassNode"
description = "JVM Bytecode decompiler"

ConfigSpec:

object ManifestSpec : ConfigSpec() {
    val editors by optional(listOf<Editor>())
}

Editor:

data class Editor (
     val id: String,
     val impl: String,
     val content: String,
     val description: String
)

Any help would be appreciated :)

@Cubxity
Copy link
Author

Cubxity commented Sep 2, 2019

@uchuhimo

@uchuhimo
Copy link
Owner

uchuhimo commented Sep 2, 2019

@Cubxity Konf infers prefix from the name of spec. For ManifestSpec, it will infer that the prefix is "manifest". Therefore, either change the ConfigSpec to disable the inference mechanism:

object ManifestSpec : ConfigSpec("") {
    val editors by optional(listOf<Editor>())
}

or change the TOML file:

[[manifest.editors]]
id = "bytespy.jvm.bytecode.editor"
impl = "dev.cubxity.bytespy.jvm.impl.editor.BytecodeContentEditor"
content = "org.objectweb.asm.tree.ClassNode"
description = "JVM Bytecode editor"

[[manifest.editors]]
id = "bytespy.jvm.bytecode.decompiler"
impl = "dev.cubxity.bytespy.jvm.impl.editor.DecompiledContentEditor"
content = "org.objectweb.asm.tree.ClassNode"
description = "JVM Bytecode decompiler"

@uchuhimo uchuhimo closed this as completed Sep 2, 2019
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

2 participants