Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stefankoegl/python-json-patch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.44
Choose a base ref
...
head repository: stefankoegl/python-json-patch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.45
Choose a head ref
  • 15 commits
  • 7 files changed
  • 3 contributors

Commits on Sep 1, 2025

  1. feat: Add optional append operation for efficient string concatenation

    - Add new `append` operation as an optional extension to RFC 6902
    - Introduce `use_append_ops` parameter to enable/disable append operations
    - Support automatic detection of string append scenarios in make_patch()
    - Maintain full backward compatibility with RFC 6902 by default
    - Enable optimized notation for consecutive append operations in streaming
    
    The append operation is disabled by default to maintain RFC 6902 compliance.
    Users can opt-in by setting use_append_ops=True in apply_patch(), make_patch(), and JsonPatch methods.
    
    This feature is particularly useful for chat applications and streaming scenarios where text is appended incrementally, reducing payload size by ~2.8x compared to replace operations.
    jeonsworld committed Sep 1, 2025
    Configuration menu
    Copy the full SHA
    2e0c8bb View commit details
    Browse the repository at this point in the history

Commits on Nov 6, 2026

  1. Configuration menu
    Copy the full SHA
    f91c14e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0d04d21 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    128d010 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1014d15 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4461e2e View commit details
    Browse the repository at this point in the history
  6. Add path_split and path_join utility functions

    Convert between the path of an operation (a JSON Pointer string) and its
    unescaped parts, so that users can inspect the keys a patch refers to, or
    build paths for hand-written patches, without re-implementing the
    escaping rules.
    
    path_split returns a tuple of strings (array indices are not converted to
    ints, as only the document tells whether a part is an index). path_join
    accepts strings and ints. Both take an optional pointer_cls, like the
    other public functions.
    
    Refs #95
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PewzphboJ9XrLY2h8AJ9iN
    claude committed Nov 6, 2026
    Configuration menu
    Copy the full SHA
    ae5db24 View commit details
    Browse the repository at this point in the history
  7. Write diff paths in the syntax of pointer_cls

    JsonPatch.from_diff and make_patch accepted a pointer_cls, but always
    wrote RFC 6901 paths and then parsed them with pointer_cls. A pointer
    class with another path syntax therefore produced patches that could not
    be applied, even to the source document.
    
    DiffBuilder now writes paths with path_join(parts, pointer_cls). This
    covers the use case of #189 (other path styles in generated patches)
    without a separate path_join argument that would have to be kept in sync
    with pointer_cls.
    
    path_join no longer uses JsonPointer.from_parts, which always builds an
    RFC 6901 string and parses it with pointer_cls. Instead it sets the parts
    of a pointer_cls instance and returns its path, so a pointer class with
    another syntax only has to override __init__ and path. JsonPointer itself
    keeps the previous fast path.
    
    Refs #95, #189
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PewzphboJ9XrLY2h8AJ9iN
    claude committed Nov 6, 2026
    Configuration menu
    Copy the full SHA
    c8e0eb8 View commit details
    Browse the repository at this point in the history
  8. Document how to implement a custom path syntax

    Add a "Custom Path Syntax" section to the tutorial. It explains which
    members of JsonPointer a pointer class for another syntax has to
    override, shows a complete example with dot-separated paths (applying,
    diffing, path_split / path_join and rejected keys), and how to convert
    such patches to standard JSON Patches.
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PewzphboJ9XrLY2h8AJ9iN
    claude committed Nov 6, 2026
    Configuration menu
    Copy the full SHA
    5aff2d9 View commit details
    Browse the repository at this point in the history
  9. Return proper paths from PatchOperation.path and from_path

    PatchOperation.path and MoveOperation.from_path joined the parts before
    the key with a plain '/': without a leading '/', without escaping keys
    that contain '/' or '~', and ignoring the syntax of pointer_cls. For
    '/a~1b/0/c' they returned 'a/b/0', which is a different location.
    
    They now return the location of the parent as a path, written with
    path_join in the syntax of pointer_cls: '/a~1b/0' for the example above,
    and '' for a target at the top level, as before. This changes the result
    for all nested paths, e.g. 'a/0' becomes '/a/0'.
    
    Refs #95, #189
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PewzphboJ9XrLY2h8AJ9iN
    claude committed Nov 6, 2026
    Configuration menu
    Copy the full SHA
    be51e16 View commit details
    Browse the repository at this point in the history
  10. Merge pull request #171 from jeonsworld/feature/stream-chat

    Add opt-in JsonPatchWithAppend for string appends
    stefankoegl authored Nov 6, 2026
    Configuration menu
    Copy the full SHA
    ee7620c View commit details
    Browse the repository at this point in the history
  11. Build custom paths with from_parts, not an uninitialized pointer

    path_join created a pointer_cls instance with __new__, set its parts and
    read its path, without calling __init__. Pointer subclasses whose path
    property uses state set in __init__, or whose __new__ requires the path,
    failed with AttributeError or TypeError. As make_patch, from_diff and
    PatchOperation.path use path_join, this broke them for such classes,
    which worked before.
    
    path_join now uses JsonPointer.from_parts, the existing class method that
    builds a pointer from parts, as the hook for other path syntaxes:
    
    - If pointer_cls doesn't override from_parts (or has none), path_join
      returns an RFC 6901 pointer without using pointer_cls, as before this
      branch. JsonPointer.from_parts can't be used for these classes, as it
      parses an RFC 6901 string with pointer_cls, which applies e.g. the
      prefix of a pointer class that resolves paths below a prefix.
    - Otherwise it returns pointer_cls.from_parts(parts).path, so the class
      constructs its pointers itself.
    
    Addresses the review comment on #256.
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PewzphboJ9XrLY2h8AJ9iN
    claude committed Nov 6, 2026
    Configuration menu
    Copy the full SHA
    98e36ed View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2026

  1. Document that get_part converts numeric object keys to ints

    The docstring of PatchOperation.key said that it is an int for an array
    index and a str otherwise. But get_part converts every part that int()
    accepts, as it can't tell array indices from object keys: the object key
    '01' becomes 1, and '1_0' becomes 10.
    
    Document this on get_part and get_from_part, refer key and from_key to
    them, and point to path_split for the exact keys. The behaviour itself is
    unchanged, as these are existing public methods.
    
    Addresses a review comment on #256.
    
    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01PewzphboJ9XrLY2h8AJ9iN
    claude committed Nov 7, 2026
    Configuration menu
    Copy the full SHA
    8988679 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2026

  1. Merge pull request #256 from stefankoegl/claude/wizardly-euler-iadncx

    Add path_split and path_join utility functions
    stefankoegl authored Nov 9, 2026
    Configuration menu
    Copy the full SHA
    af50e36 View commit details
    Browse the repository at this point in the history
  2. bump version to 1.45

    stefankoegl committed Nov 9, 2026
    Configuration menu
    Copy the full SHA
    b763363 View commit details
    Browse the repository at this point in the history
Loading