File tree Expand file tree Collapse file tree
zio-schema-json/shared/src
main/scala/zio/schema/json
test/scala/zio/schema/json Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package zio .schema .json
2+
3+ import zio .schema .DynamicValue
4+
5+ sealed trait JsonPatch {
6+
7+ def apply (target : DynamicValue ): Either [String , DynamicValue ] = {
8+ val _ = target
9+ Left (" Implementation missing" )
10+ }
11+ }
12+
13+ object JsonPatch {
14+ final case class Add (path : String , value : DynamicValue ) extends JsonPatch
15+ final case class Remove (path : String ) extends JsonPatch
16+ }
Original file line number Diff line number Diff line change 1+ package zio .schema .json
2+
3+ import zio .schema .DynamicValue
4+ import zio .test ._
5+ import zio .test .Assertion ._
6+
7+ object JsonPatchSpec extends ZIOSpecDefault {
8+ override def spec : Spec [Any , Any ] = suite(" JsonPatch Spec" )(
9+ test(" Add operation should hold correct path and value" ) {
10+ val patch = JsonPatch .Add (" path" , DynamicValue (" value" ))
11+ assert(patch.path)(equalTo(" path" ))
12+ },
13+ test(" Remove operation should hold correct path" ) {
14+ val patch = JsonPatch .Remove (" path" )
15+ assert(patch.path)(equalTo(" path" ))
16+ }
17+ )
18+ }
You can’t perform that action at this time.
0 commit comments