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

Function ensurePathExists should handle appending correctly #148

Merged
merged 1 commit into from Oct 20, 2021

Conversation

MarcelMue
Copy link
Contributor

Previously this failed unexpectedly by not creating an array.

},
{
`{ "foo": [{"bar": [{"baz0": "123"}]}]}`,
`[ { "op": "add", "path": "/foo/1/bar/-", "value": {"baz1": "456"} } ]`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other added testcases worked previously - this one failed.

// 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] == "-" {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should check for - here as it's intuitive behavior to me at least.

@MarcelMue
Copy link
Contributor Author

@evanphx Let me know if I need to do anything to help with merging this :)

@MarcelMue
Copy link
Contributor Author

Friendly ping @evanphx

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
@zhangguanzhang
Copy link

@evanphx PTAL

@boindil
Copy link

boindil commented Oct 20, 2021

@evanphx you still with us?

@evanphx evanphx merged commit 556cb64 into evanphx:master Oct 20, 2021
@evanphx
Copy link
Owner

evanphx commented Oct 20, 2021

Sorry for the delay!

@MarcelMue MarcelMue deleted the fix-ensurePathExists branch October 21, 2021 09:21
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.

None yet

4 participants