File tree 2 files changed +14
-10
lines changed
runtime/src/main/scala-3/com/soundcloud/twinagle
2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -50,24 +50,22 @@ lazy val runtime = (project in file("runtime")).settings(
50
50
" com.twitter" %% " finagle-http" % " 24.2.0" cross CrossVersion .for3Use2_13,
51
51
" com.thesamet.scalapb" %% " scalapb-runtime" % " 0.11.17" ,
52
52
" com.thesamet.scalapb" %% " scalapb-json4s" % " 0.12.1" ,
53
+ " org.json4s" %% " json4s-native" % " 4.0.7" ,
53
54
" org.specs2" %% " specs2-core" % " 4.20.8" % Test cross CrossVersion .for3Use2_13
54
55
)
55
56
},
56
57
libraryDependencies ++= {
57
58
CrossVersion .partialVersion(scalaVersion.value) match {
58
59
case Some ((2 , 13 )) | Some ((2 , 12 )) =>
59
60
Seq (
60
- " org.json4s" %% " json4s-native" % " 4.0.7" ,
61
- " org.specs2" %% " specs2-mock" % " 4.20.8" % Test
61
+ " org.specs2" %% " specs2-mock" % " 4.20.8" % Test
62
62
)
63
63
case Some ((3 , 3 )) =>
64
64
Seq (
65
- " org.playframework" %% " play-json" % " 3.0.4" ,
66
65
" org.scalamock" %% " scalamock" % " 6.1.1" % Test
67
66
)
68
67
case Some ((3 , _)) =>
69
68
Seq (
70
- " org.playframework" %% " play-json" % " 3.0.4" ,
71
69
" org.scalamock" %% " scalamock" % " 7.1.0" % Test
72
70
)
73
71
case _ => Seq .empty
Original file line number Diff line number Diff line change 1
1
package com .soundcloud .twinagle
2
2
3
- import play .api .libs .json .{Json , OFormat }
4
-
5
3
/** JsonError is the JSON representation of `TwinagleException`s.
6
4
*
7
5
* If only there were some Language we could use to Define these kind of Interfaces
@@ -14,13 +12,21 @@ private[twinagle] case class JsonError(
14
12
)
15
13
16
14
private [twinagle] object JsonError {
17
- import scala .util .control .Exception .*
15
+ import org .json4s .*
16
+ import org .json4s .native .Serialization
17
+ import org .json4s .native .Serialization .{read , write }
18
18
19
- implicit val _format : OFormat [JsonError ] = Json .format[JsonError ]
19
+ import scala .annotation .nowarn
20
+ import scala .util .control .Exception .*
21
+ implicit val formats : AnyRef & Formats = Serialization .formats(NoTypeHints )
20
22
23
+ // known issue in json4s wrt Manifest usage that has been deprecated in scala3
24
+ // will suppress this deprecation warning until this is fixed
25
+ // https://github.com/json4s/json4s/issues/982
26
+ @ nowarn(" cat=deprecation" )
21
27
def fromString (str : String ): Option [JsonError ] = allCatch opt {
22
- Json .parse(str).as [JsonError ]
28
+ read [JsonError ](str)
23
29
}
24
30
25
- def toString (err : JsonError ): String = Json .stringify( Json .toJson( err) )
31
+ def toString (err : JsonError ): String = write( err)
26
32
}
You can’t perform that action at this time.
0 commit comments