Skip to content

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.

// 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] == "-" {
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.

4 participants