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

manage the dependency of jsondiff and jsonpatch #239

Open
erikyao opened this issue Jul 1, 2022 · 1 comment
Open

manage the dependency of jsondiff and jsonpatch #239

erikyao opened this issue Jul 1, 2022 · 1 comment
Assignees

Comments

@erikyao
Copy link
Contributor

erikyao commented Jul 1, 2022

Definition

From rfc6902:

JSON Patch defines a JSON document structure for expressing a sequence of operations to apply to a JavaScript Object Notation (JSON) document; it is suitable for use with the HTTP PATCH method. The "application/json-patch+json" media type is used to identify such patch documents.

If two documents, old_doc and new_doc, are involved, we say:

  • We diff old_doc and new_old, resulting in a patch p
  • We apply patch p to old_doc, resulting in a new document equal to new_doc

Two modules in our codebase can do the diffs

Dependency Management

Some questions towards these 2 modules:

  • biothings.utils.jsonpatch is a copy of the 1.13 version, while PyPi - jsonpatch has been developed to 1.32. Any particular reason to keep the old version in our code base? Can we just install jsonpatch as a library?
  • jsonpatch.make_patch() can replace jsondiff.make() if we don't take the element order in list values into account. jsondiff has two option variables, UNORDERED_LIST and USE_LIST_OPS, to enable/disable the diff operation on list values, however are they really used in the codebase?
    • Plus I prefer to making these 2 global options as parameters to jsondiff.make()
@erikyao erikyao self-assigned this Jul 1, 2022
@erikyao erikyao changed the title manage the dependency on jsondiff and jsonpatch manage the dependency of jsondiff and jsonpatch Jul 1, 2022
@erikyao
Copy link
Contributor Author

erikyao commented Jul 1, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant