Filter duplicate co-authors from SpaceDock #3599
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.
Problem
This mod:
https://spacedock.info/mod/2992/SRB%20Waterfall%20Effects%20(SWE)
... gave me this inflation error locally after fixing the
install
to match the latest download:Cause
The co-author was added twice:
... which we simply dumped into a
List<string>
, but it's not allowed in the schema (noteuniqueItems
):CKAN/CKAN.schema
Lines 47 to 57 in 4f3da57
Since neither the simple string format nor the unique-array format matched, the validator considered the
oneOf
to be the thing that failed.Changes
Now the SpaceDock translator ensures co-author uniqueness with
.Distinct()
. Initially I looked at using aHashSet
, but then we would lose the ordering of the authors. I wanted to avoid generating more temporary values, and since you can't add yourself as a co-author, this seemed sufficient to cover the problematic cases.I audited the GitHub translator and as far as I can tell it already ensures uniqueness with
.Contains()
calls. I don't think any of the other translators can generate multiple authors.This should probably also be fixed on the SpaceDock side at some point, but it's good to satisfy constraints in the same project that imposes them.