GithubHelp home page GithubHelp logo

inspirehep / inspire-json-merger Goto Github PK

View Code? Open in Web Editor NEW
3.0 18.0 13.0 377 KB

INSPIRE-specific configuration of the JSON Merger.

License: GNU General Public License v3.0

Python 99.46% Shell 0.54%
inspirehep python json

inspire-json-merger's Introduction

INSPIRE-JSON-Merger

https://travis-ci.org/inspirehep/inspire-json-merger.svg?branch=master https://coveralls.io/repos/github/inspirehep/inspire-json-merger/badge.svg?branch=master

About

INSPIRE-specific configuration of the JSON Merger.

inspire-json-merger's People

Contributors

ammirate avatar david-caro avatar drjova avatar harunurhan avatar jacquerie avatar jmartinm avatar michamos avatar mjedr avatar nooraangelva avatar oguzdemirbasci avatar pazembrz avatar rikirenz avatar vbalbp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inspire-json-merger's Issues

inspire-json-merger change

After discussion with Micha we suggest as follows:

  1. Add ordering information for authors input dictionary so we could keep ordering of authors.
  2. Ignore root from merged conflicts
  3. Before flattening and serializing to JSON patch, MERGE conflict looks like this:
    ('MANUAL_MERGE', ('authors',), ( pmap(<ROOT>), pmap(<HEAD>), pmap(<UPDATE>) )),
  4. Before flattening conflicts, take out all MANUAL_MERGE and do as follows:
  • Remove/Ignore ROOT
  • Update merged result with HEAD from conflict by inserting the author from HEAD at the right position .
  • Look for ADD_BACK_TO_HEAD conflict with identical content as HEAD change and remove it as it's already added to HEAD
  • serialize the UPDATE from conflict as a replace JSON patch at the right position
  1. Remove all positioning information form author dictionary.

This should result in less conflicts in editor, also should allow to achieve behavior of getting HEAD when dismissing all conflicts.

Originally posted by @pazembrz in inspirehep/inspirehep#1110 (comment)

Change `ADD_BACK_TO_HEAD` conflict to generate `delete` patch

When UPDATE removes something from HEAD json_merger generates ADD_BACK_TO_HEAD conflict. Now it's just interpreted as it is so in merged value is absent and in patch we have an add of HEAD value, but we want it to work in opposite way. So in merged we should have value from HEAD and patch should be a delete.

Change default behaviour for conflicts

All conflicts should be displayed as changes form head. For conflicts which do not have separate configuration If there is conflict on update, then HEAD value should be in merged and update should be put as conflict. So when curator reject all conflicts only HEAD values should be left. This will require to set default fallback conflict strategy to KEEP_HEAD.
All conflicts which we are ignoring (ones from conflict_filters) should stay with HEAD values if they are not configured differently.

tests: flatten the structure

Now that integration is gone we can flatten the structure of this folder, also avoiding things like utils/utils.py.

global: clarify the API

Currently the structure of the inspire_json_merger folder doesn't help to understand what to import and from where.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.