feat: create_parents for add operations #32
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.
Fixes: #25
Adds an option to the module which will create any parent objects/arrays needed to reach the child member in an "add" operation. If the next reference token in the path is either "0" or "-", an array will be created. If it is any other number, the parent will not be created and the operation will fail to avoid edge cases and quirks in idempotency. In all other cases, an object is created.
This is in direct contradiction to Section 4.1 of RFC6902, which is why this feature is OFF by default. However, it makes this module much more useful when editing JSON configs.
Please note that two tests are currently failing in the master branch, and are expected to fail here too. The fix for these is in #31, and the tests written in this PR do pass!