Toddobryan
06/27/2019, 6:25 AMJsonPrimitive
class, which doesn't have access to isString
. I'm happy to provide a pull request, but there's more than one way to do this and I don't want to spend time and then discover I've picked a way the maintainers don't like.Toddobryan
06/27/2019, 6:26 AMJsonTreeTest
to verify the problem:Toddobryan
06/27/2019, 6:27 AM@Test
fun testParseBoolean() {
assertEquals(true, parse("true").booleanOrNull)
assertNull(parse("\"true\"").booleanOrNull) // currently fails
}
@Test
fun testParseNumeric() {
assertEquals(123, parse("123").intOrNull)
assertNull(parse("\"123\"").intOrNull) // currently fails
}
mathew murphy
07/19/2019, 4:56 PMmathew murphy
07/19/2019, 4:59 PMrrader
07/20/2019, 6:30 AMMatej Drobnič
07/28/2019, 7:00 PMNezteb
08/02/2019, 6:30 PMJeremy
08/07/2019, 2:39 AMtylerwilson
08/07/2019, 1:06 PMross_a
08/07/2019, 9:10 PM@Serializable
):
e: org.jetbrains.kotlin.util.KotlinFrontEndException: Front-end Internal error: Failed to analyze declaration ConnectionActorMessage
Cause: Recursive call in a lazy value under LockBasedStorageManager@861713f (GlobalContext)
File being compiled at position: (29,5) in C:/Users/rossd/IdeaProjects/Backlight/src/main/kotlin/com/github/rossdanderson/backlight/serial/SerialService.kt
The root cause was thrown at: LazyAnnotations.kt:-1
at org.jetbrains.kotlin.resolve.ExceptionWrappingKtVisitorVoid.visitDeclaration(ExceptionWrappingKtVisitorVoid.kt:43)
thana
08/08/2019, 4:00 PMJeremy
08/08/2019, 4:03 PMthana
08/08/2019, 4:03 PMthana
08/08/2019, 4:55 PMthana
08/08/2019, 4:55 PMJeremy
08/08/2019, 4:58 PMNikky
08/14/2019, 1:31 PMopen
and data
makes it final too right ?leandro
08/14/2019, 1:31 PMleandro
08/14/2019, 1:32 PMopen
on both the class and on the propertyDominaezzz
08/16/2019, 1:49 PMaltavir
08/17/2019, 6:55 AMankushg
08/21/2019, 9:16 PMMapper.mapNullable
not support nested `Map`s?
When I try to something like
@Serializable
data class Wrapper(val nested: Nested)
@Serializable
data class Nested(val string: String)
fun test() {
val wrapper = Wrapper(Nested("test"))
val mapped = Mapper.map(Wrapper.serializer(), wrapper)
}
I get a Map with the nested object flattened like
{
"nested.string" -> "test"
}
Instead, what I want is something like:
{
"nested" -> { // another Map<String, Any?>
"string" -> "test"
}
}
ankushg
08/22/2019, 12:50 AMString
, please let me know 🙏Fudge
08/23/2019, 10:05 AMendStructure
...ankushg
08/27/2019, 9:32 PMdynamic
into a sealed (polymorphic) class using DynamicObjectParser
, use a different mechanism than the normal classDiscriminator=SerialName
to determine which concrete type is selected?
For context, I'm consuming dynamic
json objects from an external source (which will be very very hard to change to provide a classDiscriminator
along with everything). They've got typescript definitions such as:
type AttributeContentType =
| {
word: String;
}
| {
definition: String;
};
I've represented this in Kotlin as:
sealed class AttributeContentType
data class WordAttributeContent(val word: String) : AttributeContentType()
data class DefinitionAttributeContent(val definition: String) : AttributeContentType()
In the above case, I'd want something like js("""{ word: "foo" }""")
to be deserialized into a WordAttributeContent
by (somehow) seeing that it has the word
field.kevin.cianfarini
08/28/2019, 12:50 AMkevin.cianfarini
08/28/2019, 12:52 AM{
data: {
"children": [ ... ],
"after": ...
"before": ...
}
}
kevin.cianfarini
08/28/2019, 12:52 AMkevin.cianfarini
08/28/2019, 12:53 AMdata class PaginatedResponse(
val children: List<Post>,
val after: String?,
val before: String?
)