client/vendor/github.com/evanphx/json-patch
Knative Automation dab9d4aa95
upgrade to latest dependencies (#1912)
bumping google.golang.org/genproto/googleapis/rpc 995d672...1f4bbc5:
  > 1f4bbc5 chore(all): auto-regenerate .pb.go files (# 1083)
  > ef43131 chore(all): auto-regenerate .pb.go files (# 1082)
  > 6c6643b chore(all): update all (# 1078)
  > a9fa171 fix(dataform): Remove broken aliases (# 1080)
  > 9144d31 fix(analytics): Remove broken aliases (# 1079)
  > 35c7eff chore(all): update all (# 1077)
  > 50ed04b chore(all): update all to v4 (# 1076)
  > 0d6446b chore(all): update all (# 1075)
bumping github.com/google/uuid 4d47f8e...0f11ee6:
  > 0f11ee6 chore(master): release 1.6.0 (# 151)
  > 16939da chore(tests):  add strict monotonicity test case for uuid v7. (# 154)
  > 016b199 fix: fix typo in version 7 uuid documentation (# 153)
  > 1d8b6ea ci: set token permissions to github workflows (# 143)
  > a2b2b32 fix: Monotonicity in UUIDv7 (# 150)
  > c58770e feat: add Max UUID constant (# 149)
bumping google.golang.org/genproto 989df2b...a9fa171:
  > a9fa171 fix(dataform): Remove broken aliases (# 1080)
  > 9144d31 fix(analytics): Remove broken aliases (# 1079)
  > 35c7eff chore(all): update all (# 1077)
  > 50ed04b chore(all): update all to v4 (# 1076)
  > 0d6446b chore(all): update all (# 1075)
  > 995d672 chore(all): update all (# 1073)
bumping golang.org/x/sys 0829ab1...914b96c:
  > 914b96c windows: support ill-formed UTF-16 in UTF16PtrToString
  > 511ec84 Revert "windows: support nil done parameter in ReadFile and WriteFile"
  > 628365d windows: support nil done parameter in ReadFile and WriteFile
  > bef1bd8 unix: move mksyscall regexp to package level variables
  > 5710a32 unix/linux: update Linux kernel to 6.7
  > b3ce6a3 windows: build env_windows_test.go only go Go 1.21 and above
  > c3fa2b8 windows: fix parsing of non-ASCII entries in token.Environ
  > f69d32a unix: in TestDirent, make as many ReadDirent calls as are needed
  > 0d9df52 unix: add more SECCOMP constants
bumping knative.dev/eventing fd95228...97e91c5:
  > 97e91c5 [main] Update community files (# 7675)
  > eac7384 Wait for events with poll interval after finished event received (# 7668)
  > ba77c3d [main] Update community files (# 7672)
  > 7d350ea [main] Upgrade to latest dependencies (# 7669)
  > 185fbf4 [main] Update community files (# 7671)
  > 03ed4ab wathola receiver, annotate span by step number (# 7667)
  > 6f2eaed Set default value for scale cache config values (# 7666)
  > bcb6100 e2e: nodeselector in apiserversauce (# 7627)
  > 836f4da feat: replace yaml merge tags (# 7662)
  > 5500bed Cache statefulset scale update/get requests (# 7651)
  > 7b975fc Update KinD for e2e tests to 0.21.0 (# 7656)
  > 96863ba [main] Upgrade to latest dependencies (# 7657)
  > 469d0ac [main] Upgrade to latest dependencies (# 7654)
  > 9d892bf Remove empty labels (# 7648)
  > d258e7d Create teardown script for local development (# 7642)
  > 62c74c1 [main] Update community files (# 7646)
  > 702004a Tiny trustbundle improvements (# 7644)
  > 02bde54 Add helm as one of the development requirement (# 7643)
  > 56ee9b2 Add TLS tests for Trigger and Subscription dead letter sinks (# 7636)
  > ff52881 Use filtered informer to watch OIDC service accounts (# 7527)
  > 54f3952 [main] Upgrade to latest dependencies (# 7641)
  > 3391d1e [main] Upgrade to latest dependencies (# 7639)
  > c6105d6 Update knative.dev/hack to latest main (# 7637)
  > 0340aa5 Fix mtbroker-filter to proxy response headers (# 7614)
  > e9bf641 Use projected volumes for sinkbinding trust bundles (# 7630)
  > bcba98a Move OIDC tests to test/rekt (# 7622)
  > ab47824 support: nodeselector in apiserversource (# 7584)
  > cdb8638 fix: exact -> atleast (# 7624)
  > 42efd06 [main] Upgrade to latest dependencies (# 7623)
  > 214f4b3 [main] Upgrade to latest dependencies (# 7616)
  > 9b6c7e2 Generalize description of EventType in CRD. (# 7617)
  > 95b9345 Adding documentation and linking resources for go setup issues with Linux Ubuntu distribution (removed noisy commits) (# 7612)
bumping golang.org/x/term ae94145...353276a:
  > 353276a go.mod: update golang.org/x dependencies
bumping knative.dev/hack f3f03ac...999d7e6:
  > 999d7e6 Update community files (# 367)
  > 6090613 Update community files (# 366)
  > d1067f2 Update community files (# 365)
  > f3881d9 Update community files (# 364)
  > ab9b690 Don't hardcode serving as the repo when setting highest semver (# 361)
  > 45dcf10 Update community files (# 360)
  > 40f0ac2 Update community files (# 359)
bumping github.com/go-logr/logr 8adefbe...dcdc3f2:
  > dcdc3f2 slogr: fix unintended API break in v0.8.0 (# 253)
  > 5d88f52 funcr: Add LogInfoLevel Option to skip logging level in the info log (# 240)
  > 177005d build(deps): bump actions/upload-artifact from 3.1.3 to 4.0.0
  > e7f489a build(deps): bump github/codeql-action from 2.22.9 to 3.22.11
  > cf56c3b build(deps): bump actions/setup-go from 4 to 5
  > 2ad296e build(deps): bump github/codeql-action from 2.22.8 to 2.22.9
  > d55b4e2 Merge pull request # 241 from thockin/master
  > c589653 Merge pull request # 245 from thockin/sloghandler_empty_groups
  > 98ee9d9 Clean up slog testing and restore coverage
  > 006d752 Merge pull request # 246 from thockin/slog_context_tests
  > b01bad7 sloghandler: unnamed groups should be inlined
  > b228ba8 Break examples to new file
  > 5153ab2 unit tests with full SlogSink mock implementation
  > 2665157 Add tests for context with slog
  > 6432877 Add benchmarks for slogSink
  > 58f101e Fix bug in slog support carrying the wrong sink
  > f558531 Put slog tests in a helper, move funcr test
  > 6151b2f support a slog.Logger pointer in a context
  > 83dbe72 Fix some lint
  > 1fffd07 move slogr into main package
  > b5e7d9f funcr: Be consistent about quoted
  > 41d36ee build(deps): bump github/codeql-action from 2.22.7 to 2.22.8
  > 44c6ac8 funcr: Be consistent about colons
  > f36813a build(deps): bump github/codeql-action from 2.22.5 to 2.22.7
  > 955d2aa funcr: Be consistent about commas
  > 24eb27c build(deps): bump actions/github-script from 6.4.1 to 7.0.1
  > 8221825 Add SlogSink support to funcr
  > 5b79d78 Merge pull request # 233 from go-logr/dependabot/github_actions/github/codeql-action-2.22.5
  > d95f9b6 Get rid of testSlogSink
  > 424fad7 Merge pull request # 232 from go-logr/dependabot/github_actions/ossf/scorecard-action-2.3.1
  > e602c1d build(deps): bump github/codeql-action from 2.22.4 to 2.22.5
  > cdb930d Minor cleanups in slogr_test (readability)
  > 64618df build(deps): bump ossf/scorecard-action from 2.3.0 to 2.3.1
bumping golang.org/x/oauth2 39adbb7...ebe81ad:
  > ebe81ad go.mod: update golang.org/x dependencies
  > adffd94 google/internal/externalaccount: update serviceAccountImpersonationRE to support universe domain
  > deefa7e google/downscope: add DownscopingConfig.UniverseDomain to support TPC
bumping google.golang.org/genproto/googleapis/api 989df2b...6c6643b:
  > 6c6643b chore(all): update all (# 1078)
  > a9fa171 fix(dataform): Remove broken aliases (# 1080)
  > 9144d31 fix(analytics): Remove broken aliases (# 1079)
  > 35c7eff chore(all): update all (# 1077)
  > 50ed04b chore(all): update all to v4 (# 1076)
  > 0d6446b chore(all): update all (# 1075)
  > 995d672 chore(all): update all (# 1073)
bumping google.golang.org/grpc dbbcf59...8167bc3:
  > 8167bc3 Change version to 1.61.0 (# 6936)
  > 52e2363 test/xds: Use different import path for gRPC Messages (# 6933)
  > 67e50be transport: Remove redundant if in handleGoAway (# 6930)
  > e96f521 alts: Extract AuthInfo after handshake in ALTS e2e test. (# 6931)
  > 987df13 metadata: move FromOutgoingContextRaw() to internal (# 6765)
  > 61eab37 server: block GracefulStop on method handlers and make blocking optional for Stop (# 6922)
  > ddd377f xds/server: fix RDS handling for non-inline route configs (# 6915)
  > 8b455de removing Roots deprecated Subjects field in tests (# 6907)
  > 953d12a alts: Forward-fix of ALTS queuing of handshake requests. (# 6906)
  > 6ce73bf internal/transport: convert `ConnectionError` to `Unavailable` status when writing headers (# 6891)
  > e7e400b deps: apply `make proto` changes (# 6916)
  > 660c394 examples: Fixed the formatting in the Authentication README.md (# 6908)
  > 3a8270f grpc: skip compression of empty messages (# 6842)
  > 7e9d319 vet: remove ignore of CloseNotifier (# 6911)
  > 5a36bb7 fix 'identitiy' typo in error message   (# 6909)
  > a233d9b build(deps): bump the github-actions group with 1 update (# 6904)
  > 6bc1906 xds: add support for mTLS Credentials in xDS bootstrap (# 6757)
  > 71cc0f1 Revert "alts: Queue ALTS handshakes once limit is reached rather than dropping. (# 6884)" (# 6903)
  > 4f03f3f removing deprecated http closenotifier function (# 6886)
  > bb0d32f xds: don't fail channel/server startup when xds creds is specified, but bootstrap is missing certificate providers (# 6848)
  > e20d5ce reflection: rename non-regenerated pb.go files to not be called '.pb.go' (# 6885)
  > adc7685 alts: Queue ALTS handshakes once limit is reached rather than dropping. (# 6884)
  > 33a60a8 internal: use OS defaults for TCP keepalive params in Windows (# 6863)
  > c109241 interop/xds: Increase go log verbosity to 99 so that EDS is logged (# 6860)
  > 02a4e93 orca: use atomic pointer instead of mutex in server metrics recorder to improve performance (# 6799)
  > df02c11 test/kokoro: Use the Kokoro shared install lib from the new repo (# 6859)
  > 444749d alts: Record network latency and pass it to the handshaker service. (# 6851)
  > 45624f0 grpc: eliminate panics in server worker implementation (# 6856)
  > 6e6914a completely delete WatchListener and WatchRouteConfig APIs (# 6849)
  > 836e5de credentials/alts: update handshaker.pb.go (# 6857)
  > 43e4461 Forbid dependabot from performing major version bumps (# 6852)
  > 686fdd8 security/advancedtls: fix test that relies on min TLS version (# 6824)
  > 52baf16 internal: use OS defaults for TCP keepalive params only on unix (# 6841)
  > d050906 build(deps): bump the github-actions group with 3 updates (# 6835)
  > 477bd62 xds/internal/resolver: switch to generic xDS API for LDS/RDS (# 6729)
  > a03c7f1 client: always enable TCP keepalives with OS defaults (# 6834)
  > c2398ce [infra] Hash-pin GitHub Actions, keep them updated with dependabot (# 6815)
  > 0866ce0 grpc: optional interface to provide channel authority (# 6752)
  > 5d7453e client: rework resolver and balancer wrappers to avoid deadlock (# 6804)
  > 93389b7 doc: fix link to the reflection protocol (# 6833)
  > 1b05500 internal/credentials/xds: Add exported comment for HandshakeInfo (# 6823)
  > 737f87b xds/internal/server: cleanup formatting directives in some logs (# 6820)
  > bc16b5f interop: support custom creds flag for stress test client (# 6809)
  > 02ea031 Bugfix for broken import (# 6816)
  > 287c473 Mark old CRL APIs as deprecated (# 6810)
  > 7935c4f resolver_wrapper: remove serializerScheduleLocked; the lock is unnecessary (# 6803)
  > 914ca65 client: further streamlining of Dial (# 6802)
  > 232054a client: remove deprecated WithServiceConfig DialOption (# 6800)
  > 42fdcc4 client: rename balancer and resolver wrapper files to be consistent (# 6801)
  > 59c0aec xDS: Atomically read and write xDS security configuration client side (# 6796)
  > ce3b538 client: simplify initialization and cleanup a bit (# 6798)
  > b98104e buffer & grpcsync: various cleanups and improvements (# 6785)
  > 424db25 credentials: if not set, restrict to TLS v1.2+ and CipherSuites per RFC7540 (# 6776)
  > 40c279a deps: update dependencies for all modules (# 6795)
  > 3cbbe29 reflection: don't serialize placeholders (# 6771)
  > 4a84ce6 Change version to 1.61.0-dev (# 6794)
bumping knative.dev/networking ce0738a...22eb3d0:
  > 22eb3d0 Update community files (# 924)
  > adc5e58 Update community files (# 923)
  > 1e6aa63 Update community files (# 922)
  > 1e7e42d upgrade to latest dependencies (# 921)
  > 66bdffa Update community files (# 920)
  > 060ef7a Clean up unused reconciler and certs code (# 919)
  > bdf2c51 upgrade to latest dependencies (# 918)
  > a874708 upgrade to latest dependencies (# 917)
  > ed5f0fa upgrade to latest dependencies (# 916)
  > a21edb5 Update community files (# 915)
  > 1dcd961 Update community files (# 914)
bumping google.golang.org/api b52e40b...87aa1d0:
  > 87aa1d0 chore(main): release 0.163.0 (# 2402)
  > 2271ef7 feat(all): auto-regenerate discovery clients (# 2405)
  > 47834b5 feat(all): auto-regenerate discovery clients (# 2403)
  > 62ceaad feat(all): auto-regenerate discovery clients (# 2401)
  > 26a1117 chore(main): release 0.162.0 (# 2389)
  > 6862015 fix(transport): enforce 1s timeout on requests to MDS universe_domain (# 2393)
  > a6d137b chore(all): update all (# 2396)
  > 5437df8 chore(all): update module github.com/google/go-github/v52 to v58 (# 2397)
  > eddfeb9 feat(all): auto-regenerate discovery clients (# 2398)
  > 169ead6 feat(all): auto-regenerate discovery clients (# 2395)
  > 140fb54 feat(all): auto-regenerate discovery clients (# 2394)
  > e5a7a15 feat(all): auto-regenerate discovery clients (# 2392)
  > c8e77f6 feat(all): auto-regenerate discovery clients (# 2391)
  > f2f2d22 feat(all): auto-regenerate discovery clients (# 2388)
  > befbd36 chore(main): release 0.161.0 (# 2387)
  > f29f327 fix(gen): reject repeated object query params (# 2383)
  > 54c764a fix(transport): skip s2a for now if service has direct path enabled (# 2385)
  > 03042ec feat(all): auto-regenerate discovery clients (# 2386)
  > dcb7e96 chore(main): release 0.160.0 (# 2381)
  > fee4c8f feat(all): auto-regenerate discovery clients (# 2384)
  > 5534cf2 feat(all): auto-regenerate discovery clients (# 2382)
  > 8f26f51 feat(all): auto-regenerate discovery clients (# 2380)
  > ee5c9cc chore(main): release 0.159.0 (# 2378)
  > 55b0516 fix(transport): relax universe checks (# 2376)
  > a8d9414 feat(all): auto-regenerate discovery clients (# 2377)
  > 68b1bc1 chore(main): release 0.158.0 (# 2360)
  > df17254 fix(transport/grpc): add universe domain verification (# 2375)
  > b21a1fa fix(internal): support internaloption.WithDefaultUniverseDomain (# 2373)
  > ddb3a12 chore(google-api-go-generator): replace literal with const (# 2363)
  > d266978 feat(all): auto-regenerate discovery clients (# 2374)
  > 73fc7fd fix(transport): not enable s2a when there is endpoint override (# 2368)
  > 2d69d97 feat(all): auto-regenerate discovery clients (# 2372)
  > 45c097f feat(all): auto-regenerate discovery clients (# 2369)
  > addc18c chore(all): update module github.com/google/go-github/v52 to v58 (# 2351)
  > a4e39d8 chore(all): update all to v0.47.0 (# 2367)
  > e0db6a5 feat(all): auto-regenerate discovery clients (# 2366)
  > f40db7f feat(all): auto-regenerate discovery clients (# 2365)
  > 69626e3 feat(transport): add universe domain support (# 2355)
  > 6c3b622 feat(all): auto-regenerate discovery clients (# 2361)
  > 6ef1144 feat(impersonate): add universe domain support (# 2296)
  > 6e77ef2 chore(main): release 0.157.0 (# 2346)
  > 72a8ffd feat(all): auto-regenerate discovery clients (# 2358)
  > 74a1558 docs(option): update WithDefaultEndpointTemplate docs (# 2356)
  > 135da01 chore(all): update all to a9fa171 (# 2350)
  > 0d002f9 feat(all): auto-regenerate discovery clients (# 2354)
  > da330c2 feat(all): auto-regenerate discovery clients (# 2353)
  > 5bf46ee feat(all): auto-regenerate discovery clients (# 2352)
  > 3bf8f4f feat(all): auto-regenerate discovery clients (# 2349)
  > 763c331 feat(all): auto-regenerate discovery clients (# 2348)
  > c3e43a1 feat(all): auto-regenerate discovery clients (# 2345)
  > d016573 chore(main): release 0.156.0 (# 2333)
  > 05de776 feat(all): auto-regenerate discovery clients (# 2344)
  > 811e925 feat(all): auto-regenerate discovery clients (# 2343)
  > 9e45101 feat(google-api-go-generator): add universe domain support (# 2335)
  > 3f90b98 feat(all): auto-regenerate discovery clients (# 2341)
  > 9745014 test: fix overflow (# 2342)
  > 3f8b548 chore(all): update all (# 2338)
  > c8905be chore(deps): bump github.com/cloudflare/circl from 1.3.3 to 1.3.7 in /internal/kokoro/discogen (# 2340)
  > d008b6e feat(all): auto-regenerate discovery clients (# 2339)
  > ceefb9b feat(all): auto-regenerate discovery clients (# 2337)
  > bd4dad1 feat(all): auto-regenerate discovery clients (# 2336)
  > 014a8e0 feat(all): auto-regenerate discovery clients (# 2332)
bumping golang.org/x/net cb5b10f...73d21fd:
  > 73d21fd go.mod: update golang.org/x dependencies
  > 643fd16 html: fix SOLIDUS '/' handling in attribute parsing
  > 73e4b50 dns/dnsmessage: allow name compression for SRV resource parsing
  > b2208d0 internal/quic/qlog: fix typo
  > 0d0b98c http2: avoid goroutine starvation in TestServer_Push_RejectAfterGoAway
  > 07e05fd http2: remove suspicious uint32->v conversion in frame code
  > 26b646e quic: avoid deadlock in Endpoint.Close
bumping knative.dev/client-pkg 67fca0c...2c46c44:
  > 2c46c44 Update community files (# 150)
  > adb84bd Update community files (# 149)
  > a722b38 Update community files (# 148)
  > 788b4b0 Update community files (# 147)
bumping knative.dev/pkg b488e7b...b8f9b22:
  > b8f9b22 Update community files (# 2957)
  > bc60487 Update community files (# 2956)
  > 405f0c4 Update community files (# 2955)
  > 2d2e27d Bump golang.org/x/oauth2 from 0.16.0 to 0.17.0 (# 2952)
  > 3b39834 Bump google.golang.org/api from 0.161.0 to 0.163.0 (# 2953)
  > 085f505 Bump golang.org/x/net from 0.20.0 to 0.21.0 (# 2954)
  > 4104e42 Bump google.golang.org/api from 0.159.0 to 0.161.0 (# 2951)
  > e85c3cf Update community files (# 2950)
  > b6659cc Bump cloud.google.com/go/storage from 1.36.0 to 1.37.0 (# 2948)
  > 9bdb511 Bump google.golang.org/grpc from 1.60.1 to 1.61.0 (# 2947)
  > d34ca03 Update knative.dev/hack to latest main (# 2949)
  > 91c6ec8 Bump google.golang.org/api from 0.157.0 to 0.159.0 (# 2946)
  > 6d59538 Bump github.com/evanphx/json-patch/v5 from 5.8.1 to 5.9.0 (# 2945)
  > 6eb53f5 Bump github.com/google/uuid from 1.5.0 to 1.6.0 (# 2944)
  > 2b8687a upgrade to latest dependencies (# 2943)
  > b42fab9 Update community files (# 2942)
  > 3f7ce63 Bump google.golang.org/api from 0.155.0 to 0.157.0 (# 2941)
  > 2a92e9d Bump github.com/evanphx/json-patch/v5 from 5.8.0 to 5.8.1 (# 2940)
  > 455683d Update community files (# 2939)
bumping knative.dev/serving 1c46c07...096adcc:
  > 096adcc Update net-certmanager nightly (# 14898)
  > fd7a6c8 Update net-contour nightly (# 14895)
  > ec32a4c Update net-kourier nightly (# 14894)
  > 148e001 Update net-certmanager nightly (# 14891)
  > 6283914 Fix: run ./hack/update-deps.sh (# 14888)
  > d8bc015 Update net-istio nightly (# 14893)
  > 45f9eeb Update community files (# 14896)
  > 5efa21e Update net-gateway-api nightly (# 14892)
  > dad0326 Update net-contour nightly (# 14884)
  > 4286c63 Update community files (# 14890)
  > 06eac8e Update net-kourier nightly (# 14885)
  > 3544fa0 Update net-certmanager nightly (# 14883)
  > 7da1f45 Update net-gateway-api nightly (# 14882)
  > 48ca4cd Update net-istio nightly (# 14886)
  > 280c922 Update community files (# 14880)
  > 2125772 Updating DEVELOPMENT.md to remove reference to allowedFields or preserveUnknownFields (# 14865)
  > 7882fa9 upgrade to latest dependencies (# 14878)
  > 774cca0 Update net-istio nightly (# 14873)
  > 87e6199 feat: Add ability to configure multiple wilcard domains (# 14543)
  > 52b4b09 Update net-istio nightly (# 14870)
  > 1760f08 Don't drop traffic when upgrading a deployment fails (# 14795)
  > 05d1927 upgrade to latest dependencies (# 14868)
  > 24bc968 Update net-contour nightly (# 14861)
  > f4bbb19 Update net-kourier nightly (# 14857)
  > 772dd36 Update net-gateway-api nightly (# 14856)
  > b44bea9 Update net-contour nightly (# 14851)
  > 0c2d16b Update net-certmanager nightly (# 14858)
  > 19f9f30 Update net-istio nightly (# 14859)
  > a303128 Update community files (# 14854)
  > 71a54e4 Update net-kourier nightly (# 14850)
  > 391c796 Update net-istio nightly (# 14852)
  > c58131a Update net-kourier nightly (# 14844)
  > 3a39279 upgrade to latest dependencies (# 14849)
  > 48a3a52 Update net-certmanager nightly (# 14845)
  > 61f5cad Update net-istio nightly (# 14843)
  > f4ef3c8 Update net-gateway-api nightly (# 14842)
  > 6d89c70 upgrade to latest dependencies (# 14841)
  > 51b0337 Capitalize the first letter of config() (# 14821)
  > 0bae8a2 implement cluster-local-domain-tls in serving (# 14610)
  > 5712497 Update net-kourier nightly (# 14832)
  > 87cef50 Update net-istio nightly (# 14831)
  > 9130d61 Update net-contour nightly (# 14834)
  > fb69b9a Update net-gateway-api nightly (# 14833)
  > 16c823b Update net-certmanager nightly (# 14830)

Signed-off-by: Knative Automation <automation@knative.team>
2024-02-15 13:56:24 +00:00
..
v5 upgrade to latest dependencies (#1912) 2024-02-15 13:56:24 +00:00
.gitignore upgrade to latest dependencies (#1570) 2022-01-19 04:53:53 -08:00
LICENSE upgrade to latest dependencies (#1123) 2020-11-17 22:30:51 -08:00
README.md upgrade to latest dependencies (#1558) 2022-01-10 01:17:59 -08:00
errors.go Update to serving 0.6.0 (#129) 2019-05-20 10:41:27 -07:00
merge.go upgrade to latest dependencies (#1558) 2022-01-10 01:17:59 -08:00
patch.go Update spf13/cobra deps (#1734) 2022-09-22 10:36:12 +00:00

README.md

JSON-Patch

jsonpatch is a library which provides functionality for both applying RFC6902 JSON patches against documents, as well as for calculating & applying RFC7396 JSON merge patches.

GoDoc Build Status Report Card

Get It!

Latest and greatest:

go get -u github.com/evanphx/json-patch/v5

Stable Versions:

  • Version 5: go get -u gopkg.in/evanphx/json-patch.v5
  • Version 4: go get -u gopkg.in/evanphx/json-patch.v4

(previous versions below v3 are unavailable)

Use It!

Configuration

  • There is a global configuration variable jsonpatch.SupportNegativeIndices. This defaults to true and enables the non-standard practice of allowing negative indices to mean indices starting at the end of an array. This functionality can be disabled by setting jsonpatch.SupportNegativeIndices = false.

  • There is a global configuration variable jsonpatch.AccumulatedCopySizeLimit, which limits the total size increase in bytes caused by "copy" operations in a patch. It defaults to 0, which means there is no limit.

These global variables control the behavior of jsonpatch.Apply.

An alternative to jsonpatch.Apply is jsonpatch.ApplyWithOptions whose behavior is controlled by an options parameter of type *jsonpatch.ApplyOptions.

Structure jsonpatch.ApplyOptions includes the configuration options above and adds two new options: AllowMissingPathOnRemove and EnsurePathExistsOnAdd.

When AllowMissingPathOnRemove is set to true, jsonpatch.ApplyWithOptions will ignore remove operations whose path points to a non-existent location in the JSON document. AllowMissingPathOnRemove defaults to false which will lead to jsonpatch.ApplyWithOptions returning an error when hitting a missing path on remove.

When EnsurePathExistsOnAdd is set to true, jsonpatch.ApplyWithOptions will make sure that add operations produce all the path elements that are missing from the target object.

Use jsonpatch.NewApplyOptions to create an instance of jsonpatch.ApplyOptions whose values are populated from the global configuration variables.

Create and apply a merge patch

Given both an original JSON document and a modified JSON document, you can create a Merge Patch document.

It can describe the changes needed to convert from the original to the modified JSON document.

Once you have a merge patch, you can apply it to other JSON documents using the jsonpatch.MergePatch(document, patch) function.

package main

import (
	"fmt"

	jsonpatch "github.com/evanphx/json-patch"
)

func main() {
	// Let's create a merge patch from these two documents...
	original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
	target := []byte(`{"name": "Jane", "age": 24}`)

	patch, err := jsonpatch.CreateMergePatch(original, target)
	if err != nil {
		panic(err)
	}

	// Now lets apply the patch against a different JSON document...

	alternative := []byte(`{"name": "Tina", "age": 28, "height": 3.75}`)
	modifiedAlternative, err := jsonpatch.MergePatch(alternative, patch)

	fmt.Printf("patch document:   %s\n", patch)
	fmt.Printf("updated alternative doc: %s\n", modifiedAlternative)
}

When ran, you get the following output:

$ go run main.go
patch document:   {"height":null,"name":"Jane"}
updated alternative doc: {"age":28,"name":"Jane"}

Create and apply a JSON Patch

You can create patch objects using DecodePatch([]byte), which can then be applied against JSON documents.

The following is an example of creating a patch from two operations, and applying it against a JSON document.

package main

import (
	"fmt"

	jsonpatch "github.com/evanphx/json-patch"
)

func main() {
	original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
	patchJSON := []byte(`[
		{"op": "replace", "path": "/name", "value": "Jane"},
		{"op": "remove", "path": "/height"}
	]`)

	patch, err := jsonpatch.DecodePatch(patchJSON)
	if err != nil {
		panic(err)
	}

	modified, err := patch.Apply(original)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Original document: %s\n", original)
	fmt.Printf("Modified document: %s\n", modified)
}

When ran, you get the following output:

$ go run main.go
Original document: {"name": "John", "age": 24, "height": 3.21}
Modified document: {"age":24,"name":"Jane"}

Comparing JSON documents

Due to potential whitespace and ordering differences, one cannot simply compare JSON strings or byte-arrays directly.

As such, you can instead use jsonpatch.Equal(document1, document2) to determine if two JSON documents are structurally equal. This ignores whitespace differences, and key-value ordering.

package main

import (
	"fmt"

	jsonpatch "github.com/evanphx/json-patch"
)

func main() {
	original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)
	similar := []byte(`
		{
			"age": 24,
			"height": 3.21,
			"name": "John"
		}
	`)
	different := []byte(`{"name": "Jane", "age": 20, "height": 3.37}`)

	if jsonpatch.Equal(original, similar) {
		fmt.Println(`"original" is structurally equal to "similar"`)
	}

	if !jsonpatch.Equal(original, different) {
		fmt.Println(`"original" is _not_ structurally equal to "different"`)
	}
}

When ran, you get the following output:

$ go run main.go
"original" is structurally equal to "similar"
"original" is _not_ structurally equal to "different"

Combine merge patches

Given two JSON merge patch documents, it is possible to combine them into a single merge patch which can describe both set of changes.

The resulting merge patch can be used such that applying it results in a document structurally similar as merging each merge patch to the document in succession.

package main

import (
	"fmt"

	jsonpatch "github.com/evanphx/json-patch"
)

func main() {
	original := []byte(`{"name": "John", "age": 24, "height": 3.21}`)

	nameAndHeight := []byte(`{"height":null,"name":"Jane"}`)
	ageAndEyes := []byte(`{"age":4.23,"eyes":"blue"}`)

	// Let's combine these merge patch documents...
	combinedPatch, err := jsonpatch.MergeMergePatches(nameAndHeight, ageAndEyes)
	if err != nil {
		panic(err)
	}

	// Apply each patch individual against the original document
	withoutCombinedPatch, err := jsonpatch.MergePatch(original, nameAndHeight)
	if err != nil {
		panic(err)
	}

	withoutCombinedPatch, err = jsonpatch.MergePatch(withoutCombinedPatch, ageAndEyes)
	if err != nil {
		panic(err)
	}

	// Apply the combined patch against the original document

	withCombinedPatch, err := jsonpatch.MergePatch(original, combinedPatch)
	if err != nil {
		panic(err)
	}

	// Do both result in the same thing? They should!
	if jsonpatch.Equal(withCombinedPatch, withoutCombinedPatch) {
		fmt.Println("Both JSON documents are structurally the same!")
	}

	fmt.Printf("combined merge patch: %s", combinedPatch)
}

When ran, you get the following output:

$ go run main.go
Both JSON documents are structurally the same!
combined merge patch: {"age":4.23,"eyes":"blue","height":null,"name":"Jane"}

CLI for comparing JSON documents

You can install the commandline program json-patch.

This program can take multiple JSON patch documents as arguments, and fed a JSON document from stdin. It will apply the patch(es) against the document and output the modified doc.

patch.1.json

[
    {"op": "replace", "path": "/name", "value": "Jane"},
    {"op": "remove", "path": "/height"}
]

patch.2.json

[
    {"op": "add", "path": "/address", "value": "123 Main St"},
    {"op": "replace", "path": "/age", "value": "21"}
]

document.json

{
    "name": "John",
    "age": 24,
    "height": 3.21
}

You can then run:

$ go install github.com/evanphx/json-patch/cmd/json-patch
$ cat document.json | json-patch -p patch.1.json -p patch.2.json
{"address":"123 Main St","age":"21","name":"Jane"}

Help It!

Contributions are welcomed! Leave an issue or create a PR.

Before creating a pull request, we'd ask that you make sure tests are passing and that you have added new tests when applicable.

Contributors can run tests using:

go test -cover ./...

Builds for pull requests are tested automatically using TravisCI.