Skip to content

Commit 971a91f

Browse files
committed
circe
1 parent b297671 commit 971a91f

22 files changed

+187
-214
lines changed

LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 - 2018 Viktor Taranenko, Kenji Yoshida and scalapb-argonaut contributors
3+
Copyright (c) 2016 - 2018 Viktor Taranenko, Kenji Yoshida and scalapb-circe contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# scalapb-argonaut [![Build Status](https://travis-ci.org/scalapb-json/scalapb-argonaut.svg?branch=master)](https://travis-ci.org/scalapb-json/scalapb-argonaut)
2-
[![scaladoc](https://javadoc-badge.appspot.com/com.github.scalapb-json/scalapb-argonaut_2.12.svg?label=scaladoc)](https://javadoc-badge.appspot.com/com.github.scalapb-json/scalapb-argonaut_2.12/scalapb_argonaut/index.html?javadocio=true)
1+
# scalapb-circe [![Build Status](https://travis-ci.org/scalapb-json/scalapb-circe.svg?branch=master)](https://travis-ci.org/scalapb-json/scalapb-circe)
2+
[![scaladoc](https://javadoc-badge.appspot.com/com.github.scalapb-json/scalapb-circe_2.12.svg?label=scaladoc)](https://javadoc-badge.appspot.com/com.github.scalapb-json/scalapb-circe_2.12/scalapb_circe/index.html?javadocio=true)
33

44
The structure of this project is hugely inspired by [scalapb-json4s](https://github.com/scalapb/scalapb-json4s)
55

@@ -8,13 +8,13 @@ The structure of this project is hugely inspired by [scalapb-json4s](https://git
88
Include in your `build.sbt` file
99

1010
```scala
11-
libraryDependencies += "io.github.scalapb-json" %% "scalapb-argonaut" % "0.1.0"
11+
libraryDependencies += "io.github.scalapb-json" %% "scalapb-circe" % "0.1.0"
1212
```
1313

1414
for scala-js
1515

1616
```scala
17-
libraryDependencies += "io.github.scalapb-json" %%% "scalapb-argonaut" % "0.1.0"
17+
libraryDependencies += "io.github.scalapb-json" %%% "scalapb-circe" % "0.1.0"
1818
```
1919

2020
## Usage

build.sbt

+10-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ val tagOrHash = Def.setting {
1515

1616
val unusedWarnings = Seq("-Ywarn-unused", "-Ywarn-unused-import")
1717

18-
val scalapbArgonaut = crossProject(JVMPlatform, JSPlatform)
18+
val scalapbCirce = crossProject(JVMPlatform, JSPlatform)
1919
.in(file("."))
2020
.settings(
2121
commonSettings
@@ -63,22 +63,22 @@ lazy val commonSettings = Seq[Def.SettingsDefinition](
6363
description := "Json/Protobuf convertors for ScalaPB",
6464
licenses += ("MIT", url("https://opensource.org/licenses/MIT")),
6565
organization := "io.github.scalapb-json",
66-
name := UpdateReadme.scalapbArgonautName,
66+
name := UpdateReadme.scalapbCirceName,
6767
Project.inConfig(Test)(sbtprotoc.ProtocPlugin.protobufConfigSettings),
6868
PB.targets in Compile := Nil,
6969
PB.protoSources in Test := Seq(file("shared/src/test/protobuf")),
7070
libraryDependencies ++= Seq(
7171
"io.github.scalapb-json" %%% "scalapb-json-common" % "0.1.0",
7272
"com.trueaccord.scalapb" %%% "scalapb-runtime" % scalapbVersion % "protobuf,test",
73-
"io.argonaut" %%% "argonaut" % "6.2.1",
73+
"io.circe" %%% "circe-parser" % "0.9.0",
7474
"org.scalatest" %%% "scalatest" % "3.0.4" % "test"
7575
),
7676
pomExtra in Global := {
77-
<url>https://github.com/scalapb-json/scalapb-argonaut</url>
77+
<url>https://github.com/scalapb-json/scalapb-circe</url>
7878
<scm>
79-
<connection>scm:git:github.com/scalapb-json/scalapb-argonaut.git</connection>
80-
<developerConnection>scm:git:git@github.com:scalapb-json/scalapb-argonaut.git</developerConnection>
81-
<url>github.com/scalapb-json/scalapb-argonaut.git</url>
79+
<connection>scm:git:github.com/scalapb-json/scalapb-circe.git</connection>
80+
<developerConnection>scm:git:git@github.com:scalapb-json/scalapb-circe.git</developerConnection>
81+
<url>github.com/scalapb-json/scalapb-circe.git</url>
8282
<tag>{tagOrHash.value}</tag>
8383
</scm>
8484
<developers>
@@ -101,7 +101,7 @@ lazy val commonSettings = Seq[Def.SettingsDefinition](
101101
"-sourcepath",
102102
(baseDirectory in LocalRootProject).value.getAbsolutePath,
103103
"-doc-source-url",
104-
s"https://github.com/scalapb-json/scalapb-argonaut/tree/${t}€{FILE_PATH}.scala"
104+
s"https://github.com/scalapb-json/scalapb-circe/tree/${t}€{FILE_PATH}.scala"
105105
)
106106
},
107107
ReleasePlugin.extraReleaseCommands,
@@ -133,5 +133,5 @@ lazy val commonSettings = Seq[Def.SettingsDefinition](
133133
)
134134
).flatMap(_.settings)
135135

136-
val scalapbArgonautJVM = scalapbArgonaut.jvm
137-
val scalapbArgonautJS = scalapbArgonaut.js
136+
val scalapbCirceJVM = scalapbCirce.jvm
137+
val scalapbCirceJS = scalapbCirce.js

js/src/main/scala/com/google/protobuf/TextFormat.scala

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
package scalapb_argonaut
1+
package scalapb_circe
22

33
trait JavaAssertionsPlatform

jvm/src/test/scala/scalapb_argonaut/AnyFormatSpecJVM.scala jvm/src/test/scala/scalapb_circe/AnyFormatSpecJVM.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scalapb_argonaut
1+
package scalapb_circe
22

33
import com.google.protobuf.any.{Any => PBAny}
44
import org.scalatest.{FlatSpec, MustMatchers}

jvm/src/test/scala/scalapb_argonaut/JavaAssertionsPlatform.scala jvm/src/test/scala/scalapb_circe/JavaAssertionsPlatform.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scalapb_argonaut
1+
package scalapb_circe
22

33
import com.google.protobuf.util.JsonFormat.{TypeRegistry => JavaTypeRegistry}
44
import com.trueaccord.scalapb.{
@@ -26,7 +26,7 @@ trait JavaAssertionsPlatform {
2626
val javaJson = JavaJsonPrinter.print(
2727
cmp.asInstanceOf[JavaProtoSupport[T, com.google.protobuf.GeneratedMessageV3]].toJavaProto(v))
2828

29-
import argonaut.JsonParser.parse
29+
import io.circe.parser.parse
3030
parse(scalaJson).isRight must be(true)
3131
parse(scalaJson) must be(parse(javaJson))
3232
ScalaJsonParser.fromJsonString[T](scalaJson) must be(v)

jvm/src/test/scala/scalapb_argonaut/JsonFormatSpecJVM.scala jvm/src/test/scala/scalapb_circe/JsonFormatSpecJVM.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scalapb_argonaut
1+
package scalapb_circe
22

33
import org.scalatest.{FlatSpec, MustMatchers, OptionValues}
44
import jsontest.test._

jvm/src/test/scala/scalapb_argonaut/StructFormatSpecJVM.scala jvm/src/test/scala/scalapb_circe/StructFormatSpecJVM.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package scalapb_argonaut
1+
package scalapb_circe
22

33
import org.scalatest.{FlatSpec, MustMatchers}
44
import com.google.protobuf.struct._

project/UpdateReadme.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import sbtrelease.Git
44

55
object UpdateReadme {
66

7-
val scalapbArgonautName = "scalapb-argonaut"
7+
val scalapbCirceName = "scalapb-circe"
88

99
val updateReadmeTask = { state: State =>
1010
val extracted = Project.extract(state)
1111
val v = extracted get version
1212
val org = extracted get organization
13-
val modules = scalapbArgonautName :: Nil
13+
val modules = scalapbCirceName :: Nil
1414
val readme = "README.md"
1515
val readmeFile = file(readme)
1616
val newReadme = Predef.augmentString(IO.read(readmeFile)).lines.map{ line =>

shared/src/main/scala/scalapb_argonaut/AnyFormat.scala shared/src/main/scala/scalapb_circe/AnyFormat.scala

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package scalapb_argonaut
1+
package scalapb_circe
22

33
import com.google.protobuf.any.{Any => PBAny}
4-
import argonaut._
4+
import io.circe._
55
import scala.language.existentials
66
import scalapb_json._
77

@@ -19,9 +19,9 @@ object AnyFormat {
1919
val message = any.unpack(cmp)
2020

2121
// ... and add the @type marker to the resulting JSON
22-
printer.toJson(message).obj match {
22+
printer.toJson(message).asObject match {
2323
case Some(fields) =>
24-
Json.obj(("@type" -> Json.jString(any.typeUrl)) :: fields.toList: _*)
24+
Json.obj(("@type" -> Json.fromString(any.typeUrl)) :: fields.toList: _*)
2525
case value =>
2626
// Safety net, this shouldn't happen
2727
throw new IllegalStateException(
@@ -30,9 +30,9 @@ object AnyFormat {
3030
}
3131

3232
val anyParser: (Parser, Json) => PBAny = { case (parser, json) =>
33-
json.obj match {
33+
json.asObject match {
3434
case Some(obj) =>
35-
obj.toMap.get("@type").flatMap(_.string) match {
35+
obj.toMap.get("@type").flatMap(_.asString) match {
3636
case Some(typeUrl) =>
3737
val cmp = parser.typeRegistry
3838
.findType(typeUrl)

0 commit comments

Comments
 (0)