Allow a role or *array of roles* for contributor role #846
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.
This PR extends contributor
role
from a string to a string OR array of strings and related to #804. Note thatenum
restrictions on what roles are allowed were already removed as part of #809.Why
Allowing multiple roles per contributor removes the current drawback where contributors have to be duplicated just because they performed multiple roles for a Data Package. Duplication is annoying for data publishers and software implementations (especially disambiguating contributors that look the same). Allowing multiple roles per contributor is a use case we have in Camtrap DP. Profiles (like Camtrap DP) currently can't extend to allow multiple roles since Data Package requires
role
to be of typestring
.Software implementations
This change has an effect on software implementations, but only if they make use of contributor
role
and only for (new) Data Packages that provide contributorrole
as an array. Existing Data Packages (withrole
as string) are still valid.role
as arrayrole
might have to pick the first element of an array if they only support one role per contributor.Changes in this PR
To the best of my ability, I made the changes where I think they should be implemented in this repo, but have likely made mistakes.
While it is technically possible to just change
role
from a string to an array (since a single role can be expressed as a array of length 1), I think it is better to allow both, since it is easier for data providers and backwards compatible.I took from inspiration from
resourcePath
which also allows strings and array of strings: https://github.com/frictionlessdata/specs/blob/6b4009428c141e7308349e113c40f633d9da2bea/schemas/dictionary/resource.yml#L159-L162... and created two extra definitions for role:
role
androleArray
(incommon.yml
, alphabetically afterlicenses
and beforesource
).The
items
forroleArray
expect arole
, so that any added requirements forrole
are immediately adopted forroleArray
items as well.Minimum one value is expected for
roleArray
I updated the description of role in
data-package/README.md