-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended operations a.k.a. user-defined operations #284
Open
superguineapig
wants to merge
14
commits into
Starcounter-Jack:master
Choose a base branch
from
superguineapig:extended-operations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Extended operations a.k.a. user-defined operations #284
superguineapig
wants to merge
14
commits into
Starcounter-Jack:master
from
superguineapig:extended-operations
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I will have a look at this. A plugin system that does not add size or lower performance for users without a plugin could work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello there! I've been using this library in a number of projects and have found it very useful.
Recently, at my company I needed the ability to perform simple mutations of JSON documents beyond those defined in the RFC-6902 specification. I really love the way the RFC defined its patch operation objects and wondered if there would be a way to extend that schema into user-defined operations. ("smart patches", if you will...)
I wound up implementing the specific changes I needed in our product, but quickly realized that it could be generalized to "reasonably arbitrary" operations and also work along side of the standard patch operations, and that we would have need to utilize such functionality immediately.
Using the JSON-Patch library as a starting point, I added "hooks" to allow processing of user-defined operation logic. It worked very well with almost no impact to the existing behavior and API.
I wasn't really planning on publishing this fork myself, (though I am using this code in production), but It seems like this functionality could be helpful to others, so I did some refactoring and added a full suite of tests and documentation and am submitting this pull request in case you'd like to incorporate this functionality into the public library as a major version release.
Please check out the docs in 'EXTENDED.md' for a much better overview of what this branch is all about.
The tests are at 'test/spec/extendedSpec.mjs'
I tried my best to not disturb any existing core functionality (core API is the same, all core tests pass w/o modifications) and match existing coding style.
Thanks for the hard work so far. JSON-Patch has been very helpful in several of my projects.
I hope you'll find this pull useful as well.
Cheers!