Repository navigation
Function ensurePathExists should handle appending correctly - #148
Merged
Merged
Conversation
MarcelMue
commented
Aug 31, 2021
| }, | ||
| { | ||
| `{ "foo": [{"bar": [{"baz0": "123"}]}]}`, | ||
| `[ { "op": "add", "path": "/foo/1/bar/-", "value": {"baz1": "456"} } ]`, |
Contributor
Author
There was a problem hiding this comment.
The other added testcases worked previously - this one failed.
| // Check if the next part is a numeric index or "-". | ||
| // If yes, then create an array, otherwise, create an object. | ||
| if arrIndex, err = strconv.Atoi(parts[pi+1]); err == nil { | ||
| if arrIndex, err = strconv.Atoi(parts[pi+1]); err == nil || parts[pi+1] == "-" { |
Contributor
Author
There was a problem hiding this comment.
I believe we should check for - here as it's intuitive behavior to me at least.
Contributor
Author
|
@evanphx Let me know if I need to do anything to help with merging this :) |
Contributor
Author
|
Friendly ping @evanphx |
Signed-off-by: Marcel Mueller <[email protected]>
MarcelMue
force-pushed
the
fix-ensurePathExists
branch
from
September 15, 2021 08:31
6b362cc to
71ddd89
Compare
|
@evanphx PTAL |
|
@evanphx you still with us? |
Owner
|
Sorry for the delay! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously this failed unexpectedly by not creating an array.