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: swaggest/json-diff
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.1
Choose a base ref
...
head repository: swaggest/json-diff
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Sep 29, 2017

  1. fixing get by numeric key

    vearutop committed Sep 29, 2017
    Copy the full SHA
    c06cd77 View commit details

Commits on Oct 10, 2017

  1. Copy the full SHA
    34b4d41 View commit details

Commits on Nov 29, 2017

  1. Copy the full SHA
    b0bc1ba View commit details

Commits on Jan 16, 2018

  1. performance optimization

    vearutop committed Jan 16, 2018
    Copy the full SHA
    c71b41e View commit details
  2. fix travis

    vearutop committed Jan 16, 2018
    Copy the full SHA
    7ad944d View commit details

Commits on Jan 28, 2018

  1. adding JSON Patch support

    vearutop committed Jan 28, 2018
    Copy the full SHA
    9954d61 View commit details
  2. Update README.md

    vearutop authored Jan 28, 2018
    Copy the full SHA
    16f0445 View commit details

Commits on Jan 29, 2018

  1. Copy the full SHA
    cf093c8 View commit details
  2. Merge pull request #4 from swaggest/v2-patch

    passing additional spec tests
    vearutop authored Jan 29, 2018
    Copy the full SHA
    2058926 View commit details

Commits on Jan 30, 2018

  1. code cleanup

    vearutop committed Jan 30, 2018
    Copy the full SHA
    77c888e View commit details
  2. code cleanup

    vearutop committed Jan 30, 2018
    Copy the full SHA
    1f15d54 View commit details
  3. Merge pull request #5 from swaggest/v2-patch

    code cleanup
    vearutop authored Jan 30, 2018
    Copy the full SHA
    e583f89 View commit details

Commits on Feb 8, 2018

  1. #6 check

    vearutop committed Feb 8, 2018
    Copy the full SHA
    e9e947d View commit details

Commits on Feb 9, 2018

  1. Copy the full SHA
    e1d0f04 View commit details
  2. Copy the full SHA
    688b9df View commit details
  3. Merge pull request #7 from swaggest/issue-6

    Issue 6
    vearutop authored Feb 9, 2018
    Copy the full SHA
    64972f5 View commit details

Commits on Feb 18, 2018

  1. Copy the full SHA
    e6954a5 View commit details
  2. Merge pull request #8 from swaggest/v3

    extracting CLI to separate package
    vearutop authored Feb 18, 2018
    Copy the full SHA
    211318d View commit details

Commits on Mar 12, 2018

  1. Copy the full SHA
    fb25971 View commit details
  2. Copy the full SHA
    95a931e View commit details
  3. readme

    vearutop committed Mar 12, 2018
    Copy the full SHA
    8c05369 View commit details

Commits on Mar 13, 2018

  1. fixing code-style

    vearutop committed Mar 13, 2018
    Copy the full SHA
    809cb01 View commit details
  2. wrong escaping

    vearutop committed Mar 13, 2018
    Copy the full SHA
    3ea7087 View commit details

Commits on Mar 15, 2018

  1. JsonValueReplace

    vearutop committed Mar 15, 2018
    Copy the full SHA
    b1fd4cc View commit details
  2. JsonValueReplace

    vearutop committed Mar 15, 2018
    Copy the full SHA
    4e76cd7 View commit details
  3. JsonValueReplace

    vearutop committed Mar 15, 2018
    Copy the full SHA
    67f2acf View commit details

Commits on Mar 19, 2018

  1. fault-tolerant patch apply

    vearutop committed Mar 19, 2018
    Copy the full SHA
    4554ad2 View commit details
  2. verbose non-existent path

    vearutop committed Mar 19, 2018
    Copy the full SHA
    cc847b3 View commit details
  3. Copy the full SHA
    44b7078 View commit details

Commits on Mar 20, 2018

  1. JsonPointer::buildPath

    vearutop committed Mar 20, 2018
    Copy the full SHA
    94925ea View commit details

Commits on Mar 22, 2018

  1. Handle Array/Object Conversion

    This commit allows us to patch from an empty "array" into an object.
    
    Without this commit:
    ```
    $old = ["emptyObject" => []];
    $new = ["emptyObject" => ["notEmpty"=>"value"]];
    $diff = new \Swaggest\JsonDiff\JsonDiff(json_decode(json_encode($old)),
    json_decode(json_encode($new)));
    $patch = $diff->getPatch();
    
    $test = json_decode(json_encode($old));
    $patch->apply($test);
    ```
    fails
    Allen Tsai committed Mar 22, 2018
    Copy the full SHA
    960918e View commit details

Commits on Mar 23, 2018

  1. Merge pull request #10 from allentsai/issue-9

    Handle Array/Object Conversion
    vearutop authored Mar 23, 2018
    Copy the full SHA
    81a403c View commit details
  2. resolves #9

    vearutop committed Mar 23, 2018
    Copy the full SHA
    59fb701 View commit details
  3. Merge pull request #11 from swaggest/issue-9

    resolves #9
    vearutop authored Mar 23, 2018
    Copy the full SHA
    8230d84 View commit details

Commits on Apr 28, 2018

  1. Copy the full SHA
    c9719f6 View commit details
  2. Merge pull request #12 from swaggest/skip_if_isset

    option to skip overwriting value if it is set
    vearutop authored Apr 28, 2018
    Copy the full SHA
    05e6127 View commit details

Commits on Sep 20, 2018

  1. Copy the full SHA
    a911cf2 View commit details
  2. Fix #14

    vearutop committed Sep 20, 2018
    Copy the full SHA
    06bf0ac View commit details
  3. Copy the full SHA
    32f3f48 View commit details
  4. Merge pull request #15 from jsonCarmock/add-merge-patch

    Add JSON Merge Patch support #13
    vearutop authored Sep 20, 2018
    Copy the full SHA
    3825404 View commit details
  5. Update links in README.md

    vearutop committed Sep 20, 2018
    Copy the full SHA
    dadb65f View commit details

Commits on Apr 9, 2019

  1. Add modifier full property

    [JsonDiff] add $modifiedFull + getter
    Alexandre Tomatis committed Apr 9, 2019
    Copy the full SHA
    c952788 View commit details

Commits on Apr 19, 2019

  1. Copy the full SHA
    114edf2 View commit details
  2. Merge pull request #20 from swaggest/class-pointer

    Add support for PHP classes in JsonPointer
    vearutop authored Apr 19, 2019
    Copy the full SHA
    1282c40 View commit details

Commits on Apr 24, 2019

  1. Copy the full SHA
    58eaea4 View commit details
  2. Merge pull request #21 from swaggest/assoc-array

    Add support for PHP associative arrays as JSON objects, resolves #17
    vearutop authored Apr 24, 2019
    Copy the full SHA
    de18f54 View commit details
  3. Merge pull request #19 from atomatis/feature/add_full_modified_property

    Add modifier full diff property
    vearutop authored Apr 24, 2019
    Copy the full SHA
    2f51b1a View commit details

Commits on Apr 25, 2019

  1. Copy the full SHA
    d9308e3 View commit details
  2. Merge pull request #22 from swaggest/modified-diff-flag

    Change modified diff collection behavior
    vearutop authored Apr 25, 2019
    Copy the full SHA
    b997a29 View commit details
  3. Update docs

    vearutop committed Apr 25, 2019
    Copy the full SHA
    53c412a View commit details
Showing with 8,909 additions and 569 deletions.
  1. +5 −4 .gitattributes
  2. +41 −0 .github/workflows/cloc.yml
  3. +37 −0 .github/workflows/lint.yml
  4. +38 −0 .github/workflows/test-unit-cov.yml
  5. +37 −0 .github/workflows/test-unit.yml
  6. +8 −3 .gitignore
  7. +11 −1 .scrutinizer.yml
  8. +0 −37 .travis.yml
  9. +119 −0 CHANGELOG.md
  10. +38 −2 Makefile
  11. +172 −135 README.md
  12. +109 −0 benchmarks/DiffBench.php
  13. +0 −12 bin/json-diff
  14. +32 −29 composer.json
  15. +1,149 −0 composer.lock
  16. +8 −0 phpstan.neon
  17. +0 −112 src/Cli/Diff.php
  18. +1 −1 src/Exception.php
  19. +66 −0 src/InvalidFieldTypeException.php
  20. +338 −53 src/JsonDiff.php
  21. +76 −0 src/JsonHash.php
  22. +31 −0 src/JsonMergePatch.php
  23. +218 −0 src/JsonPatch.php
  24. +8 −0 src/JsonPatch/Add.php
  25. +8 −0 src/JsonPatch/Copy.php
  26. +8 −0 src/JsonPatch/Move.php
  27. +18 −0 src/JsonPatch/OpPath.php
  28. +14 −0 src/JsonPatch/OpPathFrom.php
  29. +16 −0 src/JsonPatch/OpPathValue.php
  30. +8 −0 src/JsonPatch/Remove.php
  31. +8 −0 src/JsonPatch/Replace.php
  32. +8 −0 src/JsonPatch/Test.php
  33. +306 −0 src/JsonPointer.php
  34. +5 −0 src/JsonPointerException.php
  35. +0 −96 src/JsonProcessor.php
  36. +79 −0 src/JsonValueReplace.php
  37. +48 −0 src/MissingFieldException.php
  38. +30 −0 src/ModifiedPathDiff.php
  39. +50 −0 src/PatchTestOperationFailedException.php
  40. +73 −0 src/PathException.php
  41. +37 −0 src/UnknownOperationException.php
  42. +615 −0 tests/assets/issue38_1.json
  43. +615 −0 tests/assets/issue38_2.json
  44. +190 −0 tests/assets/merge-patch.json
  45. +30 −0 tests/assets/merge.json
  46. +28 −0 tests/assets/new.json
  47. +27 −0 tests/assets/original.json
  48. +64 −0 tests/assets/patch.json
  49. +28 −0 tests/assets/rearranged.json
  50. +233 −0 tests/assets/spec-tests.json
  51. +1,576 −0 tests/assets/tests.json
  52. +167 −0 tests/phpunit.patch
  53. +62 −0 tests/src/AssociativeTest.php
  54. +0 −34 tests/src/CliTest.php
  55. +46 −0 tests/src/DiffTest.php
  56. +85 −0 tests/src/ExampleTest.php
  57. +18 −0 tests/src/Issues/Issue14Test.php
  58. +18 −0 tests/src/Issues/Issue31Test.php
  59. +245 −0 tests/src/Issues/Issue40Test.php
  60. +90 −0 tests/src/Issues/Issue6Test.php
  61. +28 −0 tests/src/Issues/Issue9Test.php
  62. +42 −0 tests/src/JsonHashTest.php
  63. +312 −0 tests/src/JsonPatchTest.php
  64. +139 −0 tests/src/JsonPointerTest.php
  65. +308 −0 tests/src/MergePatchTest.php
  66. +0 −35 tests/src/ProcessorTest.php
  67. +364 −1 tests/src/RearrangeArrayTest.php
  68. +106 −14 tests/src/RearrangeTest.php
  69. +113 −0 tests/src/ReplaceTest.php
  70. +102 −0 tests/src/SpecTest.php
9 changes: 5 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
* text eol=lf
*.serialized -text
*.dat -text
/tests export-ignore
/stubs export-ignore
/.github/ export-ignore
/tests/ export-ignore
/benchmarks/ export-ignore
/composer.lock export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/.gitlab-ci.yml
/phpunit.xml export-ignore
/phpstan.neon export-ignore
/changelog.md export-ignore
/Makefile export-ignore
41 changes: 41 additions & 0 deletions .github/workflows/cloc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: cloc
on:
pull_request:

# Cancel the workflow in progress in newer build is about to start.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
cloc:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: pr
- name: Checkout base code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.base.sha }}
path: base
- name: Count Lines Of Code
id: loc
run: |
curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.2/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "b17e76bede22af0206b4918d3b3c4e7357f2a21b57f8de9e7c9dc0eb56b676c0 sccdiff" | shasum -c
OUTPUT=$(cd pr && ../sccdiff -basedir ../base)
echo "${OUTPUT}"
OUTPUT="${OUTPUT//$'\n'/%0A}"
echo "::set-output name=diff::$OUTPUT"
- name: Comment Code Lines
continue-on-error: true
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: LOC
message: |
### Lines Of Code
${{ steps.loc.outputs.diff }}
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: lint
on:
push:
branches:
- master
- main
pull_request:
jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ 'ubuntu-latest' ]
php-versions: [ '7.4' ]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache vendor
uses: actions/cache@v4
with:
path: |
vendor
key: vendor-${{ hashFiles('composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: post_max_size=256M, max_execution_time=180
tools: composer

- name: Populate vendor
run: '[ -e vendor ] || composer install'

- name: Lint
run: make lint
38 changes: 38 additions & 0 deletions .github/workflows/test-unit-cov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: test-unit-cov
on:
push:
branches:
- master
- main
pull_request:
jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ 'ubuntu-latest' ]
php-versions: [ '7.4' ]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache vendor
uses: actions/cache@v4
with:
path: |
vendor
key: deps-${{ hashFiles('composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug
tools: composer

- name: Populate vendor
run: '[ -e vendor ] || composer install'

- name: Run Tests With Coverage
run: make deps test-coverage && bash <(curl -s https://codecov.io/bash)
37 changes: 37 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test-unit
on:
push:
branches:
- master
- main
pull_request:
jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ 'ubuntu-latest' ]
php-versions: [ '7.1', '7.2', '7.3', '8.0', '8.1', '8.2', '8.3', '8.4' ]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache vendor
uses: actions/cache@v4
with:
path: |
vendor
key: deps-${{ hashFiles('composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
ini-values: post_max_size=256M, max_execution_time=180
tools: composer

- name: Populate vendor
run: '[ -e vendor ] || composer install'

- name: Run Tests
run: make deps test
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/vendor
/.idea
/json-diff
/json-diff.tar.gz
/composer.lock
/composer.phar
/clover.xml
build
/xhprof_report.*
benchmark-result.json
/coverage.xml
/phpbench-candidate.xml
/phpbench-master.xml
12 changes: 11 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
checks:
php:
code_rating: true
duplication: true
filter:
paths: [src/*]
excluded_paths: [vendor/*, tests/*]
@@ -15,4 +19,10 @@ tools:
excluded_dirs: [vendor, tests]
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
excluded_dirs: [vendor, tests]
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

119 changes: 119 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.10.4] - 2022-11-09

### Fixed
- Handling of non-string `op` values, [#63](https://github.com/swaggest/json-diff/pull/63).

## [3.10.3] - 2022-11-08

### Added
- Option to skip paths, [#39](https://github.com/swaggest/json-diff/pull/39).

## [3.10.2] - 2022-11-08

### Added
- Exceptions improved, [#60](https://github.com/swaggest/json-diff/pull/60).

## [3.10.1] - 2022-10-24

### Added
- Exception type hints improved, [#59](https://github.com/swaggest/json-diff/pull/59).

## [3.10.0] - 2022-10-21

### Added
- More specific exception types added for failed test operation, [#57](https://github.com/swaggest/json-diff/pull/57).


## [3.9.0] - 2022-08-29

### Added
- Specific exception type `PatchTestOperationFailedException` for failed test operation.

## [3.8.3] - 2021-09-25

### Fixed
- Redundant operations in array patches that strip first element.
- XOR hash collision for properties having equal parts.

### Added
- Rearrange indexing by non-scalar properties that contain object, using XOR hash.

## [3.8.2] - 2021-09-17

### Fixed
- PHP 8.1 Deprecation notices with missing returns.

## [3.8.1] - 2020-09-25

### Fixed
- Rearrangement of equal array items is corrupting data by redundant replaces.

## [3.8.0] - 2020-09-25

### Added
- Rearrangement of equal items for non-homogeneous arrays with `JsonDiff::REARRANGE_ARRAYS` option.

## [3.7.5] - 2020-05-26

### Fixed
- Accidental array to associative array conversion ([#31](https://github.com/swaggest/json-diff/issues/31)).

## [3.7.4] - 2020-01-26

### Fixed
- PHP version check for empty property name support.

## [3.7.3] - 2020-01-24

### Fixed
- Merge patch was not replacing partially different arrays.

## [3.7.2] - 2019-10-23

### Added
- Change log.

### Fixed
- Few irrelevant files not mentioned in `.gitattributes`.

## [3.7.1] - 2019-09-26

### Added
- Benchmarks to CI.

### Fixed
- Unstable array rearrange order.

## [3.7.0] - 2019-04-25

### Added
- `getModifiedDiff()` and `COLLECT_MODIFIED_DIFF` option to return paths with original and new values.

## [3.6.0] - 2019-04-24

### Added
- Compatibility option to `TOLERATE_ASSOCIATIVE_ARRAYS` that mimic JSON objects.

[3.10.4]: https://github.com/swaggest/json-diff/compare/v3.10.3...v3.10.4
[3.10.3]: https://github.com/swaggest/json-diff/compare/v3.10.2...v3.10.3
[3.10.2]: https://github.com/swaggest/json-diff/compare/v3.10.1...v3.10.2
[3.10.1]: https://github.com/swaggest/json-diff/compare/v3.10.0...v3.10.1
[3.10.0]: https://github.com/swaggest/json-diff/compare/v3.9.0...v3.10.0
[3.9.0]: https://github.com/swaggest/json-diff/compare/v3.8.3...v3.9.0
[3.8.3]: https://github.com/swaggest/json-diff/compare/v3.8.2...v3.8.3
[3.8.2]: https://github.com/swaggest/json-diff/compare/v3.8.1...v3.8.2
[3.8.1]: https://github.com/swaggest/json-diff/compare/v3.8.0...v3.8.1
[3.8.0]: https://github.com/swaggest/json-diff/compare/v3.7.5...v3.8.0
[3.7.5]: https://github.com/swaggest/json-diff/compare/v3.7.4...v3.7.5
[3.7.4]: https://github.com/swaggest/json-diff/compare/v3.7.3...v3.7.4
[3.7.3]: https://github.com/swaggest/json-diff/compare/v3.7.2...v3.7.3
[3.7.2]: https://github.com/swaggest/json-diff/compare/v3.7.1...v3.7.2
[3.7.1]: https://github.com/swaggest/json-diff/compare/v3.7.0...v3.7.1
[3.7.0]: https://github.com/swaggest/json-diff/compare/v3.6.0...v3.7.0
[3.6.0]: https://github.com/swaggest/json-diff/compare/v3.5.1...v3.6.0
Loading