Skip to content

Commit 7e7cfe1

Browse files
committed
Common restrictions with different names along the different schemas have been rewritten in a single place in order to reuse them.
1 parent 4200478 commit 7e7cfe1

9 files changed

+31
-99
lines changed

json-schemas/2.0.x/_shared.json

+17
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,23 @@
119119
}
120120
]
121121
},
122+
123+
"ReferredContactIds": {
124+
"title": "The concept's contact id(s), i.e. the creators",
125+
"type": "array",
126+
"minItems": 1,
127+
"items": {
128+
"type": "string",
129+
"pattern": "^orcid:[09]",
130+
"foreign_keys": [
131+
{
132+
"schema_id": "Contact",
133+
"members": [ "." ]
134+
}
135+
],
136+
"minLength": 1
137+
}
138+
},
122139

123140
"DatasetTemporaryId": {
124141
"title": "The temporary id of a dataset",

json-schemas/2.0.x/benchmarkingEvent.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,7 @@
131131
},
132132
"bench_contact_ids": {
133133
"title": "The benchmarking event contact id(s)",
134-
"type": "array",
135-
"minItems": 1,
136-
"items": {
137-
"type": "string",
138-
"pattern": "^orcid:0",
139-
"foreign_keys": [
140-
{
141-
"schema_id": "Contact",
142-
"members": [ "." ]
143-
}
144-
],
145-
"minLength": 1
146-
}
134+
"$ref": "_shared#/definitions/ReferredContactIds"
147135
}
148136
},
149137
"unevaluatedProperties": false,

json-schemas/2.0.x/challenge.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,7 @@
204204
},
205205
"challenge_contact_ids": {
206206
"title": "The challenge contact id(s)",
207-
"type": "array",
208-
"minItems": 1,
209-
"items": {
210-
"type": "string",
211-
"pattern": "^orcid:0",
212-
"foreign_keys": [
213-
{
214-
"schema_id": "Contact",
215-
"members": [ "." ]
216-
}
217-
],
218-
"minLength": 1
219-
}
207+
"$ref": "_shared#/definitions/ReferredContactIds"
220208
}
221209
},
222210
"unevaluatedProperties": false,

json-schemas/2.0.x/community.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,7 @@
6969

7070
"community_contact_ids": {
7171
"title": "_id of the contacts of the responsible researchers in charge of the community coordination in OpenEBench",
72-
"type": "array",
73-
"minItems": 1,
74-
"items": {
75-
"type": "string",
76-
"pattern": "^orcid:0",
77-
"foreign_keys": [
78-
{
79-
"schema_id": "Contact",
80-
"members": [ "." ]
81-
}
82-
],
83-
"minLength": 1
84-
}
72+
"$ref": "_shared#/definitions/ReferredContactIds"
8573
},
8674
"reference_tools": {
8775
"title": "The tools which are considered as reference/baseline on this community",

json-schemas/2.0.x/dataset.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,7 @@
185185
},
186186
"dataset_contact_ids": {
187187
"title": "The contact id(s) of the depositor(s)/creator(s) of this dataset",
188-
"type": "array",
189-
"minItems": 1,
190-
"items": {
191-
"type": "string",
192-
"pattern": "^orcid:0",
193-
"foreign_keys": [
194-
{
195-
"schema_id": "Contact",
196-
"members": [ "." ]
197-
}
198-
],
199-
"minLength": 1
200-
}
188+
"$ref": "_shared#/definitions/ReferredContactIds"
201189
},
202190
"depends_on": {
203191
"title": "The causal, direct dependencies of this dataset on a tool and other datasets, if available",

json-schemas/2.0.x/metrics.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,7 @@
8080

8181
"metrics_contact_ids": {
8282
"title": "The contact id(s) of the creators of this metrics",
83-
"type": "array",
84-
"minItems": 1,
85-
"items": {
86-
"type": "string",
87-
"pattern": "^orcid:0",
88-
"foreign_keys": [
89-
{
90-
"schema_id": "Contact",
91-
"members": [ "." ]
92-
}
93-
],
94-
"minLength": 1
95-
}
83+
"$ref": "_shared#/definitions/ReferredContactIds"
9684
},
9785
"formal_definition": {
9886
"title": "Formal definition of the metrics",

json-schemas/2.0.x/testAction.json

+1-14
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,7 @@
127127
},
128128
"test_contact_ids": {
129129
"title": "Contact id(s) related to the action",
130-
"description": "The test action contact id(s), i.e. the runners of the tool and depositors of the results",
131-
"type": "array",
132-
"minItems": 1,
133-
"items": {
134-
"type": "string",
135-
"pattern": "^orcid:0",
136-
"foreign_keys": [
137-
{
138-
"schema_id": "Contact",
139-
"members": [ "." ]
140-
}
141-
],
142-
"minLength": 1
143-
}
130+
"$ref": "_shared#/definitions/ReferredContactIds"
144131
},
145132
"status": {
146133
"title": "The lifecycle of the testAction will be managed by the API, validating it is progressing forward instead of backward",

json-schemas/2.0.x/tool.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,7 @@
103103
},
104104
"tool_contact_ids": {
105105
"title": "The tool's contact id(s), i.e. the creators",
106-
"type": "array",
107-
"minItems": 1,
108-
"items": {
109-
"type": "string",
110-
"pattern": "^orcid:0",
111-
"foreign_keys": [
112-
{
113-
"schema_id": "Contact",
114-
"members": [ "." ]
115-
}
116-
],
117-
"minLength": 1
118-
}
106+
"$ref": "_shared#/definitions/ReferredContactIds"
119107
},
120108
"implements": {
121109
"description": "A tool might implement at least one metrics",

json-schemas/from_1.0.x_to_2.0.x.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
|
1111
(
1212
.bench_contact_ids | map(
13-
$contacts[.].links[] | select(.label == "ORCID")
13+
$contacts[.].links[]? | select(.label == "ORCID")
1414
|
1515
.uri
1616
| ltrimstr("orcid:")
@@ -47,7 +47,7 @@
4747
|
4848
(
4949
.challenge_contact_ids | map(
50-
$contacts[.].links[] | select(.label == "ORCID")
50+
$contacts[.].links[]? | select(.label == "ORCID")
5151
|
5252
.uri
5353
| ltrimstr("orcid:")
@@ -85,7 +85,7 @@
8585
|
8686
(
8787
.community_contact_ids | map(
88-
$contacts[.].links[] | select(.label == "ORCID")
88+
$contacts[.].links[]? | select(.label == "ORCID")
8989
|
9090
.uri
9191
| ltrimstr("orcid:")
@@ -102,7 +102,7 @@
102102
- schema: https://www.elixir-europe.org/excelerate/WP2/json-schemas/1.0/Contact
103103
side_objects_paths:
104104
contacts: MIG-1.0/Contact
105-
# (.links[] | select(.label == "ORCID") | .uri) as $orcid
105+
# (.links[]? | select(.label == "ORCID") | .uri) as $orcid
106106
script: |-
107107
. as {
108108
"_id": $id,
@@ -122,7 +122,7 @@
122122
) as $links
123123
|
124124
(
125-
.links[] | select(.label == "ORCID")
125+
.links[]? | select(.label == "ORCID")
126126
|
127127
.uri
128128
| ltrimstr("orcid:")
@@ -178,7 +178,7 @@
178178
|
179179
(
180180
.metrics_contact_ids | map(
181-
$contacts[.].links[] | select(.label == "ORCID")
181+
$contacts[.].links[]? | select(.label == "ORCID")
182182
|
183183
.uri
184184
| ltrimstr("orcid:")
@@ -229,7 +229,7 @@
229229
|
230230
(
231231
.tool_contact_ids | map(
232-
$contacts[.].links[] | select(.label == "ORCID")
232+
$contacts[.].links[]? | select(.label == "ORCID")
233233
|
234234
.uri
235235
| ltrimstr("orcid:")

0 commit comments

Comments
 (0)