Interface PatchError

All Known Implementing Classes:
PatchError.DuplicateMember, PatchError.FromNotFound, PatchError.InvalidPointer, PatchError.MissingMember, PatchError.MoveIntoChild, PatchError.NotAnArray, PatchError.NotAnObject, PatchError.NotAString, PatchError.PathNotFound, PatchError.RootRemoved, PatchError.TestFailed, PatchError.UnknownOperation, PatchError.ValueNotRepresentable

An error of a JSON Patch: a patch document that violates RFC 6902, or an operation that is not successful (RFC 6902, Section 5).

Each error, except PatchError.NotAnArray, has the zero-based index of its operation in the patch.

Error Cause
PatchError.NotAnArray the patch document is not an array (Section 3)
PatchError.NotAnObject an operation is not an object (Section 3)
PatchError.MissingMember an operation has no op, path, from, or value that it needs
PatchError.DuplicateMember an operation has a member more than once, for example two op members (Section 4)
PatchError.NotAString op, path, or from is not a string
PatchError.UnknownOperation op is not add, remove, replace, move, copy, or test
PatchError.InvalidPointer path or from is not a valid JSON Pointer
PatchError.PathNotFound the target location, or its parent for add, does not exist
PatchError.FromNotFound the from location does not exist
PatchError.RootRemoved remove has the whole document as its target
PatchError.MoveIntoChild from is a proper prefix of path (Section 4.4)
PatchError.TestFailed the values of a test are not equal (Section 4.6)
PatchError.ValueNotRepresentable the target model cannot hold a number of the value, or the value has an object with duplicate member names
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    An operation has a member more than once.
    static final record 
    The from location of a move or a copy does not exist (Sections 4.4 and 4.5).
    static final record 
    The path or from member of an operation is not a valid JSON Pointer.
    static final record 
    An operation has no member that it needs: op and path (Section 4), value for add, replace, and test, or from for move and copy.
    static final record 
    The from location of a move is a proper prefix of its path (Section 4.4).
    static final record 
    The patch document is not an array (RFC 6902, Section 3).
    static final record 
    An operation is not an object (RFC 6902, Section 3).
    static final record 
    The op, path, or from member of an operation is not a string.
    static final record 
    The target location does not exist.
    static final record 
    A remove has the whole document as its target.
    static final record 
    The value at the target location of a test is not equal to its value (Section 4.6).
    static final record 
    The op of an operation is not one of the six operations (Section 4).
    static final record 
    The value of an operation cannot be added to the target document: the target model cannot hold one of its numbers, for example 1e99999999999 in a Jackson tree, or an object of the value has duplicate member names, which have no defined value (RFC 8259, Section 4).
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Returns a description of the error for people.
  • Method Details

    • message

      default String message()
      Returns a description of the error for people.
      Returns:
      the description