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

JsonPointer.append(JsonPointer.tail()) includes the original pointer #1168

Closed
Mahoney opened this issue Dec 11, 2023 · 2 comments
Closed

JsonPointer.append(JsonPointer.tail()) includes the original pointer #1168

Mahoney opened this issue Dec 11, 2023 · 2 comments
Labels
2.16 Issue planned (at earliest) for 2.16
Milestone

Comments

@Mahoney
Copy link

Mahoney commented Dec 11, 2023

Given the following code:

var original = JsonPointer.compile("/a1/b/c");

var tailPointer = original.tail();

var other = JsonPointer.compile("/a2");

var concatenated = other.append(tailPointer);

I would expect concatenated to be the same as JsonPointer.compile("/a2/b/c").

However, instead it is JsonPointer.compile("/a2/a1/b/c"), because append appends tail._asString which still contains the segments from before tail() was called.

@cowtowncoder cowtowncoder added the 2.16 Issue planned (at earliest) for 2.16 label Dec 12, 2023
@cowtowncoder
Copy link
Member

That sounds like a bug indeed. Thank you for reporting this @Mahoney !

cowtowncoder added a commit that referenced this issue Dec 15, 2023
@cowtowncoder cowtowncoder changed the title JsonPointer.append(JsonPointer.tail()) includes the original pointer JsonPointer.append(JsonPointer.tail()) includes the original pointer Dec 15, 2023
@cowtowncoder cowtowncoder added 2.17 Issues planned (at earliest) for 2.17 and removed 2.16 Issue planned (at earliest) for 2.16 labels Dec 15, 2023
@cowtowncoder cowtowncoder added this to the 2.17.0 milestone Dec 15, 2023
@cowtowncoder cowtowncoder added 2.16 Issue planned (at earliest) for 2.16 and removed 2.17 Issues planned (at earliest) for 2.17 labels Dec 15, 2023
@cowtowncoder cowtowncoder modified the milestones: 2.17.0, 2.16.1 Dec 15, 2023
@cowtowncoder
Copy link
Member

Fix to this is safe enough, will include in 2.16 branch for 2.16.1.

cowtowncoder added a commit that referenced this issue Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.16 Issue planned (at earliest) for 2.16
Projects
None yet
Development

No branches or pull requests

2 participants