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

ReleaseManager does not read "move" operation from jsondiff results #237

Open
erikyao opened this issue Jun 21, 2022 · 2 comments
Open

ReleaseManager does not read "move" operation from jsondiff results #237

erikyao opened this issue Jun 21, 2022 · 2 comments
Assignees
Labels

Comments

@erikyao
Copy link
Contributor

erikyao commented Jun 21, 2022

1. Problem

Involved method: analyze_diff

Code example:

from biothings.utils.jsondiff import make as jsondiff

old_mapping = {
  "clinvar": {
    "properties": {
      "gene": {
        "properties": {
          #############
          # OLD FIELD #
          #############
          "gene_id": {
            "type": "long"
          }
        }
      },
    }
  }
}

new_mapping = {
  "clinvar": {
    "properties": {
      "gene": {
        "properties": {
          ###############
          # NEW FIELD 1 #
          ###############
          "id": {
            "type": "long"
          },
          ###############
          # NEW FIELD 2 #
          ###############
          "new_id": {
            "type": "long"
          }
        }
      },
    }
  },
}

diff_result = jsondiff(old_mapping, new_mapping)
print(diff_result)

Output:

[{'op': 'move',
  'path': '/clinvar/properties/gene/properties/id',
  'from': '/clinvar/properties/gene/properties/gene_id'},
 {'op': 'add',
  'path': '/clinvar/properties/gene/properties/new_id',
  'value': {'type': 'long'}}]

However, 'op': 'move' is not handled in analyze_diff. It's better to split move(path="id", from="gene_id") => add(path="id") + remove(path="gene_id") when generating the release notes.

2. Reference

Accoding to rfc6902, add, remove, replace, move are all valid operations.

@erikyao
Copy link
Contributor Author

erikyao commented Jul 1, 2022

To be fixed along with biothings/myvariant.info#103

@erikyao
Copy link
Contributor Author

erikyao commented Mar 2, 2023

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

No branches or pull requests

1 participant