Merge resources and include metanetkan #2913
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
In KSP-CKAN/NetKAN-Infra#70 we are saving the
resources
object from mod metadata into the status page's JSON objects, and in KSP-CKAN/NetKAN-status#9 these will be rendered as links on the status page for more convenient investigation of inflation errors.Currently most
$kref
variants populate a property inresources
(e.g.spacedock
,repository
,curse
), except fornetkan
, the kref source for metanetkans. This info would be nice to have as well since metanetkans have a big impact on how issues are investigated and fixed.Problem
Astrogator defines its
resources
in an "internal ckan", but all that appears in its .ckan file is "repository".Cause
The
resources
property is populated withSafeAdd
, which doesn't overwrite existing data on a property-by-property basis. The GitHub transformer populatesresources.repository
, which counts as populating theresources
property, so the entireresources
object of the internal ckan is dropped, even the properties that do not conflict with the one set by the GitHub transformer.Note that this would be disruptive for the metanetkan feature suggested above, since setting
resources.metanetkan
before processing the remote netkan would overrideresources
and block any downstream sources from setting values in it.Changes
Now
resources.metanetkan
is added to the schema and spec and populated by the metanetkan transformer. This will allow us to click it on the status page once it is updated.Now
resources
is populated withSafeMerge
, a new function that effectively doesSafeAdd
on all of the properties of the given object. This will allow downstream transformers to add properties toresources
(but they still can't change properties set by upstream transformers). This will fix mods with missingresources
metadata and prevent the metanetkan resource from blocking other resources.