mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 12:57:29 +01:00
Unifying the parser for the tag array
This commit is contained in:
@@ -32,10 +32,7 @@ class EventManualDeserializer {
|
||||
pubKey = jsonObject.get("pubkey").asText().intern(),
|
||||
createdAt = jsonObject.get("created_at").asLong(),
|
||||
kind = jsonObject.get("kind").asInt(),
|
||||
tags =
|
||||
jsonObject.get("tags").toTypedArray {
|
||||
it.toTypedArray { s -> if (s.isNull) "" else s.asText().intern() }
|
||||
},
|
||||
tags = TagArrayManualDeserializer.fromJson(jsonObject.get("tags")),
|
||||
content = jsonObject.get("content").asText(),
|
||||
sig = jsonObject.get("sig").asText(),
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.vitorpamplona.quartz.nip01Core.signers
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode
|
||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.jackson.toTypedArray
|
||||
import com.vitorpamplona.quartz.nip01Core.jackson.TagArrayManualDeserializer
|
||||
|
||||
class EventTemplateManualDeserializer {
|
||||
companion object {
|
||||
@@ -30,10 +30,7 @@ class EventTemplateManualDeserializer {
|
||||
EventTemplate(
|
||||
createdAt = jsonObject.get("created_at").asLong(),
|
||||
kind = jsonObject.get("kind").asInt(),
|
||||
tags =
|
||||
jsonObject.get("tags").toTypedArray {
|
||||
it.toTypedArray { s -> if (s.isNull) "" else s.asText().intern() }
|
||||
},
|
||||
tags = TagArrayManualDeserializer.fromJson(jsonObject.get("tags")),
|
||||
content = jsonObject.get("content").asText(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.fasterxml.jackson.core.JsonParser
|
||||
import com.fasterxml.jackson.databind.DeserializationContext
|
||||
import com.fasterxml.jackson.databind.JsonNode
|
||||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
|
||||
import com.vitorpamplona.quartz.nip01Core.jackson.toTypedArray
|
||||
import com.vitorpamplona.quartz.nip01Core.jackson.TagArrayManualDeserializer
|
||||
import com.vitorpamplona.quartz.nip59Giftwrap.rumors.Rumor
|
||||
|
||||
class RumorDeserializer : StdDeserializer<Rumor>(Rumor::class.java) {
|
||||
@@ -38,10 +38,7 @@ class RumorDeserializer : StdDeserializer<Rumor>(Rumor::class.java) {
|
||||
pubKey = jsonObject.get("pubkey")?.asText()?.intern(),
|
||||
createdAt = jsonObject.get("created_at")?.asLong(),
|
||||
kind = jsonObject.get("kind")?.asInt(),
|
||||
tags =
|
||||
jsonObject.get("tags").toTypedArray {
|
||||
it.toTypedArray { s -> if (s.isNull) "" else s.asText().intern() }
|
||||
},
|
||||
tags = TagArrayManualDeserializer.fromJson(jsonObject.get("tags")),
|
||||
content = jsonObject.get("content")?.asText(),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user