-
Notifications
You must be signed in to change notification settings - Fork 46
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
Need to specify how to null a value. #42
Comments
This is now possible. Should be documented though. Currently, in ocds version of jsonmerge, null values will be ignored, and will not change a field. But can set to empty string to empty a value. This wouldn't work for emptying a number. Setting to 0 is not the same thing. Not entirely sure what to do, because if we don't ignore null values then our versionedRelease gets massive, but maybe that doesn't matter as its only intended to be read by a machine. Alternatively, we could ignore null if the versioned release field is empty, but not if its not. The more I think about this, the more I think this is not good. Would really appreciate thoughts from @avian2, @practicalparticipation, @jpmckinney. |
Do any current publishers have versioned releases? All the data I've seen is one-shot. There are alternatives to the current versioning system that may work better, so if no publisher currently does versioning, then maybe it'd be possible to include later. Under the current system, if an earlier version has a non-null value, and a later version has a null value, the non-null value should not pass through. |
If I understand correctly, in incremental updates you need to differentiate between 1) value that is not changed from the current state and 2) a value that should be removed. From the perspective of jsonmerge, I think the correct way is in case of 1) that the value is not present at all in the update document (e.g. no |
@avian2 Yes, that's my understanding, too. |
+1 to @jpmckinney 's question, @birdsarah would love to hear what you have seen on versioning from the supply side. |
@avian2's suggestion also matches with the JSON Merge Patch approach. I've drafted the following documentation on this: Null values, and removing fieldsPublishers providing regular releases of data should pay careful attention to the inclusion of fields and the use of null values as this affects how data is merged when compiling a record with a version history of the contracting process. If a field is included in one release, and then ommitted entirely from a subsequent release, the compiled record will continue to contain the original field.
If a field is included in one release, and then set to null in a subsequent release, that field will be removed from the compiled record (though past values of it should remain in the versioned section of the record).
If a field is set to null in one release, and is also set to null in a subsequent release, it will be ommitted from both the record and the versioned section of the record. I.e. fields that are always set as null will be ignored in the record.
If a field is set to null in one release, and then has a value in a subsequent release, it will first appear in the record, and the version section of the record when it has a value.
|
@jpmckinney just getting my head back in the game, so i may be answering the wrong question. "Do any current publishers have versioned releases?" A number of datasets update their data and mark it as revised / amended. |
@practicalparticipation - that is perfect - I'm not sure that's what our version of jsonmerge does at the moment, but I think it's the right behavior. |
@practicalparticipation looking at this again, would the following be acceptable. If a field is included in one release, and then set to If a field is set to If a field is set to The short way of saying this, is if you want a tidy compiled & versioned record, then omit fields rather than set to |
(I'm still haven't checked behavior) am just covering my bases. |
I still need to confirm this - will do so on 17th. |
Closed for now. Will revisit in testing tools in future. |
If you have a field:
award.supplier.address.postcode = 'ABC'
and you want to set it to
empty award.supplier.address.postcode = ''
but at the moment, merging will ignore the change, assuming its just an empty field.
The text was updated successfully, but these errors were encountered: