Skip to content

Commit cca6b2e

Browse files
committed
fix: update context paths and @id values for ReproSchema 1.0.0
- Update context path from /contexts/generic to /contexts/reproschema for v1.0.0 - Fix @id values to match lowercase filenames (e.g., activity2_schema) - Update schema version script to handle different context paths by version - All schemas now validate successfully with reproschema validate command This ensures compatibility with ReproSchema 1.0.0 specification and proper validation.
1 parent 1551d06 commit cca6b2e

30 files changed

+43
-37
lines changed

update_schema_version.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,23 @@ def update_file(file_path, version):
1313
with open(file_path, "r") as file:
1414
content = file.read()
1515

16+
# Determine context path based on version
17+
if version == "1.0.0":
18+
context_path = "reproschema"
19+
else:
20+
context_path = "generic"
21+
1622
# Update simple string @context
1723
content = re.sub(
18-
r'"@context": "https://raw\.githubusercontent\.com/ReproNim/reproschema/[^/]+/contexts/generic"',
19-
f'"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/{version}/contexts/generic"',
24+
r'"@context": "https://raw\.githubusercontent\.com/ReproNim/reproschema/[^/]+/contexts/(generic|reproschema)"',
25+
f'"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/{version}/contexts/{context_path}"',
2026
content,
2127
)
2228

2329
# Update @context when it's in an array (handles multi-line)
2430
content = re.sub(
25-
r'"https://raw\.githubusercontent\.com/ReproNim/reproschema/[^/]+/contexts/generic"',
26-
f'"https://raw.githubusercontent.com/ReproNim/reproschema/{version}/contexts/generic"',
31+
r'"https://raw\.githubusercontent\.com/ReproNim/reproschema/[^/]+/contexts/(generic|reproschema)"',
32+
f'"https://raw.githubusercontent.com/ReproNim/reproschema/{version}/contexts/{context_path}"',
2733
content,
2834
)
2935

{{cookiecutter.protocol_name}}/activities/Activity1/activity1_schema

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": [ "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": [ "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
{
44
"rl": "https://raw.githubusercontent.com/ReproNim/reproschema-library/master/activities/"
55
}

{{cookiecutter.protocol_name}}/activities/Activity1/items/document_upload_item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Field",
44
"@id": "document_upload_item",
55
"prefLabel": {"en": "Upload Documents"},

{{cookiecutter.protocol_name}}/activities/Activity2/Activity2_schema

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Activity",
4-
"@id": "Activity2_schema",
4+
"@id": "activity2_schema",
55
"prefLabel": {"en": "Select Dropdown"},
66
"description": "dummy activity to show all inputs types and widgets",
77
"preamble": "This activity will show you all the different input type and widgets currently available.",

{{cookiecutter.protocol_name}}/activities/Activity2/items/country_item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Field",
44
"@id": "country_item",
55
"prefLabel": "country item",

{{cookiecutter.protocol_name}}/activities/Activity2/items/date_item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Field",
44
"@id": "date_item",
55
"prefLabel": "date item",

{{cookiecutter.protocol_name}}/activities/Activity2/items/language_item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Field",
44
"@id": "language_item",
55
"prefLabel": "language item",

{{cookiecutter.protocol_name}}/activities/Activity2/items/state_item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Field",
44
"@id": "state_item",
55
"prefLabel": "state item",

{{cookiecutter.protocol_name}}/activities/Activity2/items/time_range_item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Field",
44
"@id": "time_range_item",
55
"prefLabel": "time range item",

{{cookiecutter.protocol_name}}/activities/Activity2/items/year_item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/generic",
2+
"@context": "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
33
"@type": "reproschema:Field",
44
"@id": "year_item",
55
"prefLabel": "year item",

0 commit comments

Comments
 (0)