Skip to content

Commit

Permalink
Release v1.10.7
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfrog26 committed Apr 21, 2023
1 parent 97ab53a commit 93ba122
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ The focus of this project is minimalism and flexibility. To that end, the featur
### Setup

For SBT simply include:
`libraryDependencies += "org.typelevel" %%% "fabric-core" % "1.10.6"`
`libraryDependencies += "org.typelevel" %%% "fabric-core" % "1.10.7"`

For parsing support include:
`libraryDependencies += "org.typelevel" %%% "fabric-io" % "1.10.6"`
`libraryDependencies += "org.typelevel" %%% "fabric-io" % "1.10.7"`

### Create

Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/fabric/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ package object fabric {
/**
* Create a Str from the supplied String
*/
implicit def str(s: String): Str = Str(s)
implicit def str(s: String): Json = if (s == null) Null else Str(s)

/**
* Create a Num from the supplied String
Expand Down
4 changes: 2 additions & 2 deletions core/shared/src/main/scala/fabric/search/Search.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ trait Search {

object Search {
implicit val rw: RW[Search] = RW.poly[Search]() {
case "query" => SearchQuery.rw
case "composite" => CompositeSearch.rw
case "searchQuery" => SearchQuery.rw
case "compositeSearch" => CompositeSearch.rw
}

def apply(entries: SearchEntry*): Search = SearchQuery(entries.toList)
Expand Down
10 changes: 10 additions & 0 deletions core/shared/src/test/scala/spec/RWSpecAuto.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ class RWSpecAuto extends AnyWordSpec with Matchers {
val json: Json = sample.asJson
json should be(obj("color" -> "Green", "size" -> 9.2, "quantity" -> 15))
}
"verify persisting null String values works" in {
val user = User(null, "abc/123")
user.json should be(
obj(
"name" -> Null,
"_id" -> "abc/123",
"num" -> 123
)
)
}
// TODO: Enable once Scala 3 support for sealed traits is working
// "supporting sealed traits" in {
// val car: VehicleType = VehicleType.Car
Expand Down
11 changes: 11 additions & 0 deletions core/shared/src/test/scala/spec/TransformSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ class TransformSpec extends AnyWordSpec with Matchers {
val transformed = json.transform(Search("level1", "level2", "product")).move().filterOne(RemoveEmptyFilter)
transformed should be(obj("name" -> "Product Name", "sku" -> 12345))
}
"rename a top-level entry" in {
val json = obj(
"name" -> "John Doe"
)
val transformed = json.transform(Search("name")).rename("fullName")
transformed should be(
obj(
"fullName" -> "John Doe"
)
)
}
"rename a simple object" in {
val json = obj(
"product" -> List(
Expand Down

0 comments on commit 93ba122

Please sign in to comment.