Description of changes:
Add canary file generation functionality for Patch Operation canaries from contract test inputs.
canarySettings will be shared with generating Create Operation canaries.
Testing Scenarios:
Validate that the correct number of output files are generated. Validated that file naming and structure are correct.
Validate that an existing field in the CreateInputs will be updated by a replace, add or remove operation in PatchInputs.
Validate that only replace, add and remove operations result in an update. Other operations such as move, copy and test are ignored.
Validate that a field can be updated if it was not included in CreateInputs but included in PatchInputs for add and replace operations.
Validate that nested inputs are correctly updated.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Refactored hardcoded values into defined constants
Refactored to use jsonpatch and removed unnecessary functions. A noteworthy changes are listed below:
jsonpath will enforce path validation. If a path is invalid, an exception will be raised. Previous behavior of skipping updates with invalid paths could lead consumers to ignore operations that are not passing.
Contract test PatchInputs.path values should be relative to the “Properties” key and include a leading slash(“/“). This behavior will be enforced in canary generation.
Revised algorithm for PatchInputs
Filter for supported “op” (ie remove, replace and add)
Translate “value” to dynamic values
use jsonpatch to apply translated patch(which includes dynamic values) to CreateInputs
Issue #, if available:
Description of changes: Add canary file generation functionality for Patch Operation canaries from contract test inputs. canarySettings will be shared with generating Create Operation canaries.
Testing Scenarios:
CreateInputs
will be updated by areplace
,add
orremove
operation inPatchInputs
.replace
,add
andremove
operations result in an update. Other operations such asmove
,copy
andtest
are ignored.CreateInputs
but included inPatchInputs
foradd
andreplace
operations.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.