corka149
Jsonpatch - Pure Elixir implementation of RFC 6902
A JSON patch is a way to define a sequence of manipulating operations on a JavaScript object. The IETF published the RFC 6902 - found here RFC 6902 - JavaScript Object Notation (JSON) Patch. The Kubernetes API is an user of those JSON patches. In my opinion this is the easiest way to change a Kubernetes resource. Unfortunantely no library was available until yet or I did not fount it. This was my motivation to create the JSON patch library.
- Get Jsonpatch here jsonpatch | Hex
- Read the documentation here Jsonpatch — Jsonpatch v2.3.1
- And source GitHub - corka149/jsonpatch: A implementation of RFC 6902 in pure Elixir. · GitHub
In this sense - keep calm and code Elixir
Your Corka/Sebastian
Most Liked
corka149
v1.0.0
I know it exists but never had the time to implement it. I am talking about that patching of lists at top level never worked. This was for me the milestone for v1.0.0. Finally it is fixed.
.
Changes:
- Allow lists at top level of Jsonpatch.apply_patch
- Fix error message when updating a non existing key in list
- Performance boost for diffing
Example of new feature:
iex(1)> source = [1, 2, 3, 5, 6]
[1, 2, 3, 5, 6]
iex(2)> destination = [1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, 5, 6]
iex(3)> patch = Jsonpatch.diff source, destination
[
%Jsonpatch.Operation.Add{path: "/5", value: 6},
%Jsonpatch.Operation.Replace{path: "/4", value: 5},
%Jsonpatch.Operation.Replace{path: "/3", value: 4}
]
iex(4)> Jsonpatch.apply_patch! patch, source
[1, 2, 3, 4, 5, 6]
corka149
v0.9.3
It has been a since the last update. I worked on testing to eliminate dead code and bugs (of course). Also I tried to make the documentation a little bit prettier.
- Jsonpatch — Jsonpatch v2.3.1 |> read_documentation
- jsonpatch | Hex |> get_dependency
- GitHub - corka149/jsonpatch: A implementation of RFC 6902 in pure Elixir. · GitHub |> browse_code
I am happy about any feedback.
Your Corka/Sebastian
corka149
v0.11.0
The whole process for creating patches through Jsonpatch.diff/2 was not perfect. I was encouraged through a github issue to rewrite it with a reduce-loop. This version fixes this. In addition, Jsonpatch.FlatMap was removed because it is not necessary anymore and it was not the focus of this lib.
Changelog:
- Removed module Jsonpatch.FlatMap because it is not necessary anymore and not the focus of the lib
- Reworked creating diff to create less unnecessary data and for more accurate patches
- Fixed adding values to empty lists (thanks @webdeb )
Updated documentation: Jsonpatch — Jsonpatch v0.11.0
Popular in Announcing
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #code-sync
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








