-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
[plugin-json] Add patch json file step #1499
Conversation
vividus-plugin-json/build.gradle
Outdated
implementation project(':vividus-util') | ||
implementation(group: 'com.jayway.jsonpath', name: 'json-path-assert', version: '2.4.0') { | ||
exclude module: 'hamcrest-library' | ||
} | ||
implementation (group: 'net.javacrumbs.json-unit', name: 'json-unit', version: '2.18.0') |
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.
Have tried to get rid of this dependencies, but do not succeed. Will discuss tomorrow
import org.vividus.bdd.context.IBddVariableContext; | ||
import org.vividus.bdd.variable.VariableScope; | ||
|
||
public class JsonSteps |
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.
JsonPatchSteps
} | ||
|
||
@When("I patch content from json '$sourceJsonFilePath' with '$patchJsonFilePath' and put patched json to '$scopes'" | ||
+ " variable with name '$pathVariable'") |
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.
When I patch JSON `$sourceJson` using `$jsonPatch` and save result to $scopes variable `$variableName`
Codecov Report
@@ Coverage Diff @@
## master #1499 +/- ##
=========================================
Coverage 95.55% 95.56%
- Complexity 4874 4877 +3
=========================================
Files 685 687 +2
Lines 14083 14102 +19
Branches 983 983
=========================================
+ Hits 13457 13476 +19
Misses 493 493
Partials 133 133
Continue to review full report at Codecov.
|
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.
Please add:
- regular docs (see
/docs
folder) - integration tests
vividus-plugin-json/src/main/java/org/vividus/bdd/steps/json/JsonPatchSteps.java
Outdated
Show resolved
Hide resolved
vividus-plugin-json/src/main/java/org/vividus/bdd/steps/json/JsonPatchSteps.java
Show resolved
Hide resolved
@@ -0,0 +1,25 @@ | |||
= Json Plugin |
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.
let's use JSON
notation everywhere
When I patch JSON `$sourceJson` using `$jsonPatch` and save result to $scopes variable `$variableName` | ||
---- | ||
|
||
* `$sourceJson` - JSON file to be patched. |
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.
it's not file, but JSON data
---- | ||
|
||
* `$sourceJson` - JSON file to be patched. | ||
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902] |
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.
not file, similar to the above comment
|
||
* `$sourceJson` - JSON file to be patched. | ||
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902] | ||
* `$scopes` - xref:parameters:variable-scope.adoc[the comma-separated set of the variables scopes] |
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.
The
/** | ||
* Performs patching of a json and save it to the variable | ||
* @param sourceJson json file to be patched | ||
* @param jsonPatch json file with patch actions |
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.
please see related comments for the documentation
* `$sourceJson` - JSON file to be patched. | ||
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902] | ||
* `$scopes` - xref:parameters:variable-scope.adoc[the comma-separated set of the variables scopes] | ||
* `$variableName` - The variable |
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.
please add example of using step
* `$sourceJson` - JSON file to be patched. | ||
* `$jsonPatch` - JSON file with required patch actions according to https://tools.ietf.org/html/rfc6902#page-6[RFC-6902] | ||
* `$scopes` - xref:parameters:variable-scope.adoc[the comma-separated set of the variables scopes] | ||
* `$variableName` - The variable |
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.
The variable name
Closes #1476