-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Update to latest fast-json-patch #23
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,12 @@ describe('keyword $patch', function() { | |
"source": { | ||
"type": "object", | ||
"properties": { "p": { "type": "string" } }, | ||
"additionalProperties": false | ||
"additionalProperties": false, | ||
"required": [ "p" ] | ||
}, | ||
"with": [ | ||
{ "op": "add", "path": "/properties/q", "value": { "type": "number" } } | ||
{ "op": "add", "path": "/properties/q", "value": { "type": "number" } }, | ||
{ "op": "add", "path": "/required/-", "value": "q" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you want to add "required" keyword and its change with "patch", then it has to be added with "merge" as well (it can replace the whole array) and also tested in "test_validate.js" (object without "q" should fail); as is it is not tested at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you for the review. Changes submitted |
||
] | ||
} | ||
}; | ||
|
@@ -44,7 +46,8 @@ describe('keyword $patch', function() { | |
"id": "obj.json#", | ||
"type": "object", | ||
"properties": { "p": { "type": "string" } }, | ||
"additionalProperties": false | ||
"additionalProperties": false, | ||
"required": [ "p" ] | ||
}; | ||
|
||
ajv.addSchema(sourceSchema); | ||
|
@@ -53,7 +56,8 @@ describe('keyword $patch', function() { | |
"$patch": { | ||
"source": { "$ref": "obj.json#" }, | ||
"with": [ | ||
{ "op": "add", "path": "/properties/q", "value": { "type": "number" } } | ||
{ "op": "add", "path": "/properties/q", "value": { "type": "number" } }, | ||
{ "op": "add", "path": "/required/-", "value": "q" } | ||
] | ||
} | ||
}; | ||
|
@@ -73,13 +77,15 @@ describe('keyword $patch', function() { | |
"source": { | ||
"type": "object", | ||
"properties": { "p": { "type": "string" } }, | ||
"additionalProperties": false | ||
"additionalProperties": false, | ||
"required": [ "p" ] | ||
} | ||
}, | ||
"$patch": { | ||
"source": { "$ref": "#/definitions/source" }, | ||
"with": [ | ||
{ "op": "add", "path": "/properties/q", "value": { "type": "number" } } | ||
{ "op": "add", "path": "/properties/q", "value": { "type": "number" } }, | ||
{ "op": "add", "path": "/required/-", "value": "q" } | ||
] | ||
} | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pass
jsonPatch.applyPatch
here andjsonMergePatch.apply
above. Then in add_keyword you would just need to usejsonPatch(null, source, patch, true);
without any additional parameters.