oipwg / oip Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
As MLG has been using the OIP042 Edit spec for the past month or two, we have occasionally ran into an issue with how Edits use a Squashed version of the RFC6902 Patches.
While squashing the patch works in most instances, there are a couple specific semi-common cases that the squashed patches cannot handle. The main issue occurs when multiple items are being added to an array, as if there are multiple add
operations for an Array, and they are “appending” the data, the squashed patch format will only pick up on one of the add
s and ignore the second. The additional issues stem from how RFC6902 patches are Sequential, and how the Squashed Patch format removes any ordering.
The main bug logic can be demonstrated as follows using js-oip
. Notice how we lose the “add” for “three”.
let rfc6902Patch = edit.createRFC6902Patch({ field: [ 'one', 'two' ] }, { field: [ 'two', 'three', 'four' ] })
// rfc6902Patch = [
// {"op": "remove", "path": "/field/0"},
// {"op": "add", "path": "/field/-", "value": "three"},
// {"op": "add", "path": "/field/-", "value": "four"}
// ]
let squashedPatch = edit.squashRFC6902Patch(rfc6902Patch)
// squashedPatch = {
// "add": { "/field/-": "four" },
// "remove": ["/field/0"]
// }
We propose that we retroactively remove support for the Squashed Patch format from js-oip
and OIPd
and only support patches containing a full RFC6902 formatted JSON Patch. MLG would then publish "replacement" edits for records that we have already edited. We at MLG think this way forward would be simplest for the long term support of OIPd, in order to prevent having to maintain the squashed patch format forever.
Currently MLG is the only user of OIP042 Edits, so this should luckily not affect anybody else.
We propose that the format of an OIP042 Edit be defined as the following:
{
"oip042": {
"edit": {
"artifact": {
"artifactID": "string",
"timestamp": integer,
"patch": // RFC6902 JSON Patch https://tools.ietf.org/html/rfc6902
},
"signature": "string"
}
}
}
An example edit would look like:
{
"oip042": {
"edit": {
"artifact": {
"artifactID": "a66b77ec997a72b649fd8e2e256f39f698b914c8c35ea87dc6b0ffb7c2fd8c29",
"timestamp": 1567526939603,
"patch":[
{"op": "remove", "path": "/field/0"},
{"op": "add", "path": "/field/-", "value": "three"},
{"op": "add", "path": "/field/-", "value": "four"}
]
},
"signature": "IPra1n/c8Zd76cTwNMgM6I4SVc/r6MBo+KQdVoWoOxi8JZvGMmjYO/gazJl0llZoiAQ+BBNYrDGYfHnAJYUywMA="
}
}
}
Could we have something like this:
https://api.oip.io/oip/o5/record/mapping/tmpl_90BD561D?pretty=true
or something like that?
The response just needs to pass through something like JSON.stringify(payload, null, ' ')
Currently there is no code that will mark an Edit as broken and prevent it from being processed in the future. This is a feature that still needs to be implemented, but is currently a lower priority.
You can find more discussion about the work that needs to be done, and the reasoning behind it, right here: #13 (comment)
The search:
https://api.oip.io/oip/o5/record/search?limit=12&page=1&q=_exists_:record.details.tmpl_7C6B7370
Does not return records like this one:
https://api.oip.io/oip/o5/record/get/ce5f4406fd867c5eff635c1b9dc43c8753940da16e31b91ddbc9ccbab68d69e2
But it should.
differentiate between "insufficient funds" and when there is a mismatch between the payer and the signer, in such a case return "payer/signer mismatch"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.