Skip to content
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

feat: create_parents for add operations #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tnyeanderson
Copy link

@tnyeanderson tnyeanderson commented Jan 5, 2025

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!

Fixes: particledecay#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changed always true for some reason
1 participant