morphir.ir.qname.Codec.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of morphir-ir_3 Show documentation
Show all versions of morphir-ir_3 Show documentation
The morphir[3.3.4].ir.jvm.artifactName package
The newest version!
package morphir.ir.qname
/** Generated based on IR.QName
*/
object Codec{
implicit val encodeQName: io.circe.Encoder[morphir.ir.QName.QName] = ((qName: morphir.ir.QName.QName) =>
qName match {
case morphir.ir.QName.QName(arg1, arg2) =>
io.circe.Json.arr(
io.circe.Json.fromString("""QName"""),
morphir.ir.path.Codec.encodePath(arg1),
morphir.ir.name.Codec.encodeName(arg2)
)
})
implicit val decodeQName: io.circe.Decoder[morphir.ir.QName.QName] = ((c: io.circe.HCursor) =>
c.withFocus(_.withString(((str) =>
io.circe.Json.arr(io.circe.Json.fromString(str))))).downN(0).as(morphir.sdk.string.Codec.decodeString).flatMap(((tag) =>
tag match {
case """QName""" =>
for {
arg1 <- c.downN(1).as(morphir.ir.path.Codec.decodePath)
arg2 <- c.downN(2).as(morphir.ir.name.Codec.decodeName)
} yield morphir.ir.QName.QName(
arg1,
arg2
)
})))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy