JsonPatch

zio.blocks.schema.json.JsonPatch
See theJsonPatch companion class
object JsonPatch

Attributes

Companion
class
Source
JsonPatch.scala
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
JsonPatch.type

Members list

Type members

Classlikes

object ArrayOp

Attributes

Companion
trait
Source
JsonPatch.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
ArrayOp.type
sealed trait ArrayOp

Attributes

Companion
object
Source
JsonPatch.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Append
class Delete
class Insert
class Modify
final case class JsonPatchOp(path: DynamicOptic, operation: Op)

A single patch operation paired with the path to apply it at.

A single patch operation paired with the path to apply it at.

Value parameters

operation

The operation to apply at the path

path

The path indicating where to apply the operation

Attributes

Source
JsonPatch.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ObjectOp

Attributes

Companion
trait
Source
JsonPatch.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
ObjectOp.type
sealed trait ObjectOp

Attributes

Companion
object
Source
JsonPatch.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Add
class Modify
class Remove
object Op

Attributes

Companion
trait
Source
JsonPatch.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Op.type
sealed trait Op

Top-level operation type for JSON patches. Each operation describes a change to be applied to a Json value.

Top-level operation type for JSON patches. Each operation describes a change to be applied to a Json value.

Attributes

Companion
object
Source
JsonPatch.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ArrayEdit
class Nested
class ObjectEdit
class Set
object PrimitiveOp

Attributes

Companion
trait
Source
JsonPatch.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait PrimitiveOp

Attributes

Companion
object
Source
JsonPatch.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class NumberDelta
class StringEdit
object StringOp

Attributes

Companion
trait
Source
JsonPatch.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
StringOp.type
sealed trait StringOp

Attributes

Companion
object
Source
JsonPatch.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Append
class Delete
class Insert
class Modify

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def apply(path: DynamicOptic, operation: Op): JsonPatch

Creates a patch with a single operation at the given path.

Creates a patch with a single operation at the given path.

Value parameters

operation

The operation to apply

path

The path where the operation should be applied

Attributes

Returns

A new patch with the operation at the specified path

Source
JsonPatch.scala
def diff(source: Json, target: Json): JsonPatch

Compute the diff between two Json values.

Compute the diff between two Json values.

Returns a JsonPatch that transforms source into target. The patch uses minimal operations:

  • NumberDelta for number changes
  • StringEdit when more compact than Set
  • ArrayEdit with LCS-based Insert/Delete operations
  • ObjectEdit for field changes

Value parameters

source

The original Json value

target

The desired Json value

Attributes

Returns

A JsonPatch that transforms source into target

Source
JsonPatch.scala

Converts a DynamicPatch to a JsonPatch.

Converts a DynamicPatch to a JsonPatch.

Temporal Deltas and Map Key which are not Strings, fail.

Numeric deltas from DynamicPatch (IntDelta, LongDelta, etc.) are widened to NumberDelta (BigDecimal) since JSON has a single number type.

Value parameters

patch

The DynamicPatch to convert

Attributes

Returns

Either an error for unsupported operations, or the equivalent JsonPatch

Source
JsonPatch.scala
def root(operation: Op): JsonPatch

Creates a patch with a single operation at the root.

Creates a patch with a single operation at the root.

Value parameters

operation

The operation to apply at the root

Attributes

Returns

A new patch with the operation at the root path

Source
JsonPatch.scala

Concrete fields

Empty patch - identity element for composition.

Empty patch - identity element for composition.

Attributes

Source
JsonPatch.scala

Implicits

Implicits

implicit lazy val arrayOpAppendSchema: Schema[Append]

Attributes

Source
JsonPatch.scala
implicit lazy val arrayOpDeleteSchema: Schema[Delete]

Attributes

Source
JsonPatch.scala
implicit lazy val arrayOpInsertSchema: Schema[Insert]

Attributes

Source
JsonPatch.scala
implicit lazy val arrayOpModifySchema: Schema[Modify]

Attributes

Source
JsonPatch.scala
implicit lazy val arrayOpSchema: Schema[ArrayOp]

Attributes

Source
JsonPatch.scala
implicit lazy val jsonPatchOpSchema: Schema[JsonPatchOp]

Attributes

Source
JsonPatch.scala
implicit lazy val objectOpAddSchema: Schema[Add]

Attributes

Source
JsonPatch.scala
implicit lazy val objectOpModifySchema: Schema[Modify]

Attributes

Source
JsonPatch.scala
implicit lazy val objectOpRemoveSchema: Schema[Remove]

Attributes

Source
JsonPatch.scala
implicit lazy val objectOpSchema: Schema[ObjectOp]

Attributes

Source
JsonPatch.scala
implicit lazy val opArrayEditSchema: Schema[ArrayEdit]

Attributes

Source
JsonPatch.scala
implicit lazy val opNestedSchema: Schema[Nested]

Attributes

Source
JsonPatch.scala
implicit lazy val opObjectEditSchema: Schema[ObjectEdit]

Attributes

Source
JsonPatch.scala

Attributes

Source
JsonPatch.scala
implicit lazy val opSchema: Schema[Op]

Attributes

Source
JsonPatch.scala
implicit lazy val opSetSchema: Schema[Set]

Attributes

Source
JsonPatch.scala

Attributes

Source
JsonPatch.scala
implicit lazy val primitiveOpSchema: Schema[PrimitiveOp]

Attributes

Source
JsonPatch.scala

Attributes

Source
JsonPatch.scala
implicit lazy val schema: Schema[JsonPatch]

Attributes

Source
JsonPatch.scala
implicit lazy val stringOpAppendSchema: Schema[Append]

Attributes

Source
JsonPatch.scala
implicit lazy val stringOpDeleteSchema: Schema[Delete]

Attributes

Source
JsonPatch.scala
implicit lazy val stringOpInsertSchema: Schema[Insert]

Attributes

Source
JsonPatch.scala
implicit lazy val stringOpModifySchema: Schema[Modify]

Attributes

Source
JsonPatch.scala
implicit lazy val stringOpSchema: Schema[StringOp]

Attributes

Source
JsonPatch.scala