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

Expose JsonPatch as public API #1088

Open
ikhoon opened this issue Jan 14, 2025 · 0 comments · May be fixed by #1089
Open

Expose JsonPatch as public API #1088

ikhoon opened this issue Jan 14, 2025 · 0 comments · May be fixed by #1089
Milestone

Comments

@ikhoon
Copy link
Contributor

ikhoon commented Jan 14, 2025

JsonPatch is only used internally so users can't access it and its subclasses.

public final class JsonPatch implements JsonSerializable {

If it is exposed as a public API, users could create JSON patch operations more easily.
For example:

final TextNode emailNode = new TextNode(newEmail);
final JsonPointer jsonPointer = JsonPointer.compile(
        "/user/" + userId + "/email");
final ReplaceOperation replace = new ReplaceOperation(jsonPointer, emailNode);
final JsonNode jsonNode = replace.toJsonNode();
changes.add(Change.ofJsonPatch("/some/path", jsonNode));
@ikhoon ikhoon added this to the 0.74.0 milestone Jan 14, 2025
@ikhoon ikhoon linked a pull request Jan 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant