-
Notifications
You must be signed in to change notification settings - Fork 8
Enforce data structure and data type consistency for JSON metadata #1421
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
base: master
Are you sure you want to change the base?
Changes from all commits
1d53e3a
8efb138
2ce744c
20e175b
19213ec
1360a4c
04497cd
853dd15
77e6295
71143ae
a5ca110
bdb6327
42f9f59
b4b3451
c5e8678
8a4a38b
49c5ff3
e90e088
3337cc2
1f8dee6
ac4864c
0c343ad
c6d150f
19a710c
da0e51d
d3d118b
d9c046e
e5f7e96
0351dc2
9107c7d
2833a4d
e3b1429
de18655
15c2f2f
156e56f
c431f7b
9036ca7
9663a76
cdd8419
a08363c
d545e4b
225deae
c2bba5b
3f6606c
6315505
4bb4b5b
2d87449
329ee8f
04de852
44fb68e
598906b
acb17d4
ad28046
c6e093f
da5f9e8
111ec55
c917c85
e44889b
743ac08
235c3f9
fae0e97
d430aee
05b301e
7a96090
2148812
8e953cd
091b665
f27dcee
fe15778
a0b91fe
5e831a9
d719846
e945040
f428d24
3c9ee96
bb141dc
681654a
7a1071e
bb739f4
cf14588
74d0375
86c22a7
d3f2056
64206c3
1162d93
3232373
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "title": "Affiliation", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "object", | ||
| "properties": { | ||
| "affiliationIdentifier": { | ||
| "type": ["string", "null"] | ||
| }, | ||
| "affiliationIdentifierScheme": { | ||
| "type": ["string", "null"] | ||
| }, | ||
| "name": { | ||
| "type": ["string", "null"] | ||
| }, | ||
| "schemeUri": { | ||
| "type": ["string", "null"] | ||
| } | ||
| }, | ||
| "dependentRequired": { | ||
| "affiliationIdentifier": ["affiliationIdentifierScheme"] | ||
| }, | ||
| "additionalProperties": false | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "title": "Affiliations", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "array", | ||
| "minItems": 0, | ||
| "items": { | ||
| "$ref": "affiliation.json" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "title": "AlternateIdentifier", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "object", | ||
| "properties": { | ||
| "alternateIdentifier": { | ||
| "type": "string" | ||
| }, | ||
| "alternateIdentifierType": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "additionalProperties": false, | ||
| "dependentRequired": { | ||
| "alternateIdentifier": ["alternateIdentifierType"] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should both |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "title": "AlternateIdentifiers", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "array", | ||
| "minItems": 0, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? |
||
| "items": { | ||
| "$ref": "alternate_identifier.json" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "title": "Contributor", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "object", | ||
| "properties": { | ||
| "name": { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting one. I was testing with metadata pulled from some recently created/updated DOIs, to see if this validation would have impacted them. I found this DOI which in the JSON has a contributor "contributors": [
{
"nameType": "Personal",
"givenName": "Jacopo",
"familyName": "Torrisi",
"affiliation": [],
"contributorType": "DataManager",
"nameIdentifiers": [
{
"nameIdentifier": "",
"nameIdentifierScheme": "ORCID"
}
]
}
],Using this metadata to create a DOI on staging failed with this error: {
"errors": [
{
"source": "contributors",
"title": "Object at `/0` is missing required properties: name",
"uid": "10.1111/742r-wc63"
}
]
}From my understanding of the XSD, <contributors>
<contributor contributorType="DataManager">
<contributorName nameType="Personal">Torrisi, Jacopo</contributorName>
<givenName>Jacopo</givenName>
<familyName>Torrisi</familyName>
<nameIdentifier nameIdentifierScheme="ORCID" schemeURI=""/>
<affiliation affiliationIdentifierScheme="ROR"/>
</contributor>
</contributors>How is that contributorName being generated for the XML? I am just thinking through the potential impact on user who are currently providing not providing
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tagging @codycooperross for input into this as well :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With JSON -> XML, we currently generate a contributorName and creatorName based on available familyName and givenName metadata if available. See the description here: https://docs.google.com/spreadsheets/d/1Hy0KXWPxqNx-Pfh-nNFxbsUFXXVYsO8O2sDIytXQv7U/edit?gid=1806954511#gid=1806954511&range=2:2 For the sake of backwards compatibility with existing request patterns and scoping this PR, let's remove the |
||
| "type": "string" | ||
| }, | ||
| "nameType": { | ||
| "$ref": "controlled_vocabularies/name_type.json" | ||
| }, | ||
| "givenName": { | ||
| "type": ["string", "null"] | ||
| }, | ||
| "familyName": { | ||
| "type": ["string", "null"] | ||
| }, | ||
| "contributorType": { | ||
| "oneOf": [ | ||
| { | ||
| "$ref": "controlled_vocabularies/contributor_type.json" | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ] | ||
| }, | ||
| "lang": { | ||
codycooperross marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "$ref": "language.json" | ||
| }, | ||
| "affiliation": { | ||
| "$ref": "affiliations.json" | ||
| }, | ||
| "nameIdentifiers": { | ||
| "$ref": "name_identifiers.json" | ||
| } | ||
| }, | ||
| "additionalProperties": false, | ||
| "required": [ | ||
| "name" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "title": "Contributors", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "array", | ||
| "minItems": 0, | ||
| "items": { | ||
| "$ref": "contributor.json" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| { | ||
| "title": "ContributorType", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": ["string", "null"], | ||
| "anyOf": [ | ||
| { | ||
| "type": "string", | ||
| "enum": [ | ||
| "ContactPerson", | ||
| "DataCollector", | ||
| "DataCurator", | ||
| "DataManager", | ||
| "Distributor", | ||
| "Editor", | ||
| "HostingInstitution", | ||
| "Producer", | ||
| "ProjectLeader", | ||
| "ProjectManager", | ||
| "ProjectMember", | ||
| "RegistrationAgency", | ||
| "RegistrationAuthority", | ||
| "RelatedPerson", | ||
| "Researcher", | ||
| "ResearchGroup", | ||
| "RightsHolder", | ||
| "Sponsor", | ||
| "Supervisor", | ||
| "Translator", | ||
| "WorkPackageLeader", | ||
| "Other" | ||
| ] | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "title": "DateType", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": ["string", "null"], | ||
| "anyOf": [ | ||
| { | ||
| "type": "string", | ||
| "enum": [ | ||
| "Accepted", | ||
| "Available", | ||
| "Copyrighted", | ||
| "Collected", | ||
| "Coverage", | ||
| "Created", | ||
| "Issued", | ||
| "Submitted", | ||
| "Updated", | ||
| "Valid", | ||
| "Withdrawn", | ||
| "Other" | ||
| ] | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "title": "DescriptionType", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "string", | ||
| "enum": [ | ||
| "Abstract", | ||
| "Methods", | ||
| "SeriesInformation", | ||
| "TableOfContents", | ||
| "TechnicalInfo", | ||
| "Other" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "title": "FunderIdentifierType", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": "string", | ||
| "enum": [ | ||
| "Crossref Funder ID", | ||
| "GRID", | ||
| "ISNI", | ||
| "ROR", | ||
| "Other" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "title": "NameType", | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "type": ["string", "null"], | ||
| "anyOf": [ | ||
| { | ||
| "type": "string", | ||
| "enum": ["Organizational", "Personal"] | ||
| }, | ||
| { | ||
| "type": "null" | ||
| } | ||
| ] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While logical, this is inconsistent with the XSD definition, which does not suggest dependent values between affiliationIdentifier and affiliationIdentifierScheme:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree with this. Although logic is described in the Schema documentation at https://datacite-metadata-schema.readthedocs.io/en/4.6/properties/creator/#b-affiliationidentifierscheme - "If affiliationIdentifier is used, affiliationIdentifierScheme is mandatory." - it isn't part of the XSD, so we should omit it from the JSON Schema validation.