-
Notifications
You must be signed in to change notification settings - Fork 24
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
encodeToString produces wrong indentation for case when there are nested List among the tree #254
Comments
In case you wonder, @Serializable
data class Wrapper(
val elements: List<Element>
)
@Serializable
data class Element(
val name: String,
val subElements: List<SubElement>
)
@Serializable
data class SubElement(
val name: String,
val description: String,
val subSubElements: List<SubSubElement>,
)
@Serializable
data class SubSubElement(
val name: String,
val description: String,
) with val data = Wrapper(
elements = listOf(
Element(
name = "element 1",
subElements = listOf(
SubElement(
"1.1", "d1.1",
subSubElements =
listOf(
SubSubElement("1.1.1", "d1.1.1"),
SubSubElement("1.1.2", "d1.1.2")
)
),
SubElement(
"1.2", "d1.2",
subSubElements =
listOf(
SubSubElement("1.2.1", "d1.2.1"),
SubSubElement("1.2.2", "d1.2.2"),
)
),
)
),
Element(
name = "element 2",
subElements = listOf(
SubElement(
"2.1", "d2.1",
subSubElements =
listOf(
SubSubElement("2.1.1", "d2.1.1"),
SubSubElement("2.1.2", "d2.1.2"),
)
),
SubElement(
"2.2", "d2.2",
subSubElements =
listOf(
SubSubElement("2.2.1", "d2.2.1"),
SubSubElement("2.2.2", "d2.2.2"),
)
),
)
),
)
) yields [[elements]]
name = "element 1"
[[elements.subElements]]
name = "1.1"
description = "d1.1"
[[elements.subElements.subSubElements]]
name = "1.1.1"
description = "d1.1.1"
[[elements.subElements.subSubElements]]
name = "1.1.2"
description = "d1.1.2"
[[elements.subElements]]
name = "1.2"
description = "d1.2"
[[elements.subElements.subSubElements]]
name = "1.2.1"
description = "d1.2.1"
[[elements.subElements.subSubElements]]
name = "1.2.2"
description = "d1.2.2"
[[elements]]
name = "element 2"
[[elements.subElements]]
name = "2.1"
description = "d2.1"
[[elements.subElements.subSubElements]]
name = "2.1.1"
description = "d2.1.1"
[[elements.subElements.subSubElements]]
name = "2.1.2"
description = "d2.1.2"
[[elements.subElements]]
name = "2.2"
description = "d2.2"
[[elements.subElements.subSubElements]]
name = "2.2.1"
description = "d2.2.1"
[[elements.subElements.subSubElements]]
name = "2.2.2"
description = "d2.2.2" |
Decoding fails due to ArrayOfTables https://toml.io/en/v1.0.0#array-of-tables . It has mostly a zero support in our lib. But spacing should be fixed, definitely |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
com.akuleshov7:ktoml-core:0.5.1
yieldsThe generated TOML does not parse. It would be nice if the error message included the problematic field name or something like that. Currently the error message provides little to no clue on why the parsing went wrong:
The text was updated successfully, but these errors were encountered: