Skip to content

Commit

Permalink
Merge pull request #81 from wadeking98/fix-script-trailing-comma
Browse files Browse the repository at this point in the history
Fixed oca generation bug creating invalid JSON
  • Loading branch information
wadeking98 authored Sep 25, 2023
2 parents 690bd82 + 11a963d commit 0f56f04
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 210 deletions.
5 changes: 2 additions & 3 deletions OCABundles/schema/bcgov-digital-trust/member-card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ A verifiable credential schema for a lawyer's membership card that used in a dem

| Identifier | Location | URL |
| ------------------------------------------ | --------- | ----------------------------------------------------- |
| 63ZiwyeZeazA6AhYRYm2zD:2:Member Card:1.5.1 | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/26676 |
| Trx3R1frdEzbn34Sp1jyX:2:Member Card:1.5.1 | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/26514 |
| XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1 | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/27369 |
| AuJrigKQGRLJajKAebTgWu:3:CL:209526:default | sovrn:staging | https://indyscan.io/tx/SOVRIN_STAGINGNET/domain/209527 |
| 4xE68b6S5VRFrKMMG1U95M:3:CL:59232:default | sovrn:mainnet | https://indyscan.io/tx/SOVRIN_MAINNET/domain/59233 |

## Authorization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"type": "spec/overlays/meta/1.0"
},
{
"logo": "https://raw.githubusercontent.com/bcgov/aries-oca-bundles/main/OCABundles/schema/bcgov-digital-trust/person/bc-logo.png",
"logo": "https://raw.githubusercontent.com/bcgov/aries-oca-bundles/main/OCABundles/schema/bcgov-digital-trust/person/bc-logo.jpg",
"background_image_slice": "",
"background_image": "https://raw.githubusercontent.com/bcgov/aries-oca-bundles/main/OCABundles/schema/bcgov-digital-trust/person/person-background-image.png",
"primary_background_color": "#003366",
Expand Down
188 changes: 0 additions & 188 deletions OCABundles/schema/bcgov-digital-trust/person/OCABundleShowcase.json

This file was deleted.

7 changes: 4 additions & 3 deletions OCABundles/schema/bcgov-digital-trust/person/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ A schema for a "person" credential used in a demo that is part of the [BC Gov Di

| Identifier | Location | URL |
| ----------------------------------- | --------- | ----------------------------------------------------- |
| 63ZiwyeZeazA6AhYRYm2zD:2:Person:1.0 | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/28329 |
| Trx3R1frdEzbn34Sp1jyX:2:Person:1.0 | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/28328 |
| XUxBrVSALWHLeycAUhrNr9:2:Person:1.0 | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/28330 |
| KCxVC8GkKywjhWJnUfCmkW:3:CL:20:PersonQA | candy:test | https://candyscan.idlab.org/tx/CANDY_TEST/domain/51 |
| 7xjfawcnyTUcduWVysLww5:3:CL:28075:PersonSIT | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/31530 |
| XpgeQa93eZvGSZBZef3PHn:3:CL:28075:PersonDEV | candy:dev | https://candyscan.idlab.org/tx/CANDY_DEV/domain/31602 |
| RGjWbW1eycP7FrMf4QJvX8:3:CL:13:Person | candy:prod | https://candyscan.idlab.org/tx/CANDY_PROD/domain/14 |

## Authorization

Expand Down
2 changes: 1 addition & 1 deletion OCABundles/schema/bcgov-digital-trust/person/branding.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"logo": "https://raw.githubusercontent.com/bcgov/aries-oca-bundles/main/OCABundles/schema/bcgov-digital-trust/person/bc-logo.png",
"logo": "https://raw.githubusercontent.com/bcgov/aries-oca-bundles/main/OCABundles/schema/bcgov-digital-trust/person/bc-logo.jpg",
"background_image_slice": "",
"background_image": "https://raw.githubusercontent.com/bcgov/aries-oca-bundles/main/OCABundles/schema/bcgov-digital-trust/person/person-background-image.png",
"primary_background_color": "#003366",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
"capture_base": "E75sopl65qnoZRwjQQ0FjWGemLlOXcXtanhScZ2CloJY",
"digest": "EBQbQEV6qSEGDzGLj1CqT4e6yzESjPimF-Swmyltw5jU",
"expiry_date_attribute": "expiry_date",
"primary_attribute": "student_last_name",
"secondary_attribute": "student_first_name",
"primary_attribute": "",
"secondary_attribute": "",
"type": "aries/overlays/branding/1.0"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"capture_base": "E75sopl65qnoZRwjQQ0FjWGemLlOXcXtanhScZ2CloJY",
"digest": "EBQbQEV6qSEGDzGLj1CqT4e6yzESjPimF-Swmyltw5jU",
"expiry_date_attribute": "expiry_date",
"primary_attribute": "student_last_name",
"secondary_attribute": "student_first_name",
"primary_attribute": "",
"secondary_attribute": "",
"type": "aries/overlays/branding/1.0"
}
]
14 changes: 7 additions & 7 deletions ocabundles.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"4DsheHjrS8kbzw4Rd8Peym:2:Digital Business Card:1.0.0": { "path": "OCABundles/schema/bcgov-digital-trust/business-card/OCABundle.json" },
"63ZiwyeZeazA6AhYRYm2zD:2:Member Card:1.5.1": { "path": "OCABundles/schema/bcgov-digital-trust/member-card/OCABundle.json" },
"Trx3R1frdEzbn34Sp1jyX:2:Member Card:1.5.1": { "path": "OCABundles/schema/bcgov-digital-trust/member-card/OCABundle.json" },
"XUxBrVSALWHLeycAUhrNr9:2:Member Card:1.5.1": { "path": "OCABundles/schema/bcgov-digital-trust/member-card/OCABundle.json" },
"AuJrigKQGRLJajKAebTgWu:3:CL:209526:default": { "path": "OCABundles/schema/bcgov-digital-trust/member-card/OCABundle.json" },
"4xE68b6S5VRFrKMMG1U95M:3:CL:59232:default": { "path": "OCABundles/schema/bcgov-digital-trust/member-card/OCABundle.json" },
"L6ASjmDDbDH7yPL1t2yFj9:2:member_card:1.53": { "path": "OCABundles/schema/bcgov-digital-trust/member-card-showcase/OCABundle.json" },
"M6dhuFj5UwbhWkSLmvYSPc:2:member_card:1.53": { "path": "OCABundles/schema/bcgov-digital-trust/member-card-showcase/OCABundle.json" },
"QEquAHkM35w4XVT3Ku5yat:2:member_card:1.53": { "path": "OCABundles/schema/bcgov-digital-trust/member-card-showcase/OCABundle.json" },
"63ZiwyeZeazA6AhYRYm2zD:2:Person:1.0": { "path": "OCABundles/schema/bcgov-digital-trust/person/OCABundle.json" },
"Trx3R1frdEzbn34Sp1jyX:2:Person:1.0": { "path": "OCABundles/schema/bcgov-digital-trust/person/OCABundle.json" },
"XUxBrVSALWHLeycAUhrNr9:2:Person:1.0": { "path": "OCABundles/schema/bcgov-digital-trust/person/OCABundle.json" },
"KCxVC8GkKywjhWJnUfCmkW:3:CL:20:PersonQA": { "path": "OCABundles/schema/bcgov-digital-trust/person/OCABundle.json" },
"7xjfawcnyTUcduWVysLww5:3:CL:28075:PersonSIT": { "path": "OCABundles/schema/bcgov-digital-trust/person/OCABundle.json" },
"XpgeQa93eZvGSZBZef3PHn:3:CL:28075:PersonDEV": { "path": "OCABundles/schema/bcgov-digital-trust/person/OCABundle.json" },
"RGjWbW1eycP7FrMf4QJvX8:3:CL:13:Person": { "path": "OCABundles/schema/bcgov-digital-trust/person/OCABundle.json" },
"L6ASjmDDbDH7yPL1t2yFj9:2:Person:1.2": { "path": "OCABundles/schema/bcgov-digital-trust/person-showcase/OCABundle.json" },
"M6dhuFj5UwbhWkSLmvYSPc:2:Person:1.2": { "path": "OCABundles/schema/bcgov-digital-trust/person-showcase/OCABundle.json" },
"QEquAHkM35w4XVT3Ku5yat:2:Person:1.2": { "path": "OCABundles/schema/bcgov-digital-trust/person-showcase/OCABundle.json" },
Expand All @@ -19,5 +19,5 @@
"M6dhuFj5UwbhWkSLmvYSPc:2:student_card:1.2": { "path": "OCABundles/schema/bcgov-digital-trust/student-card/OCABundle.json" },
"QEquAHkM35w4XVT3Ku5yat:2:student_card:1.2": { "path": "OCABundles/schema/bcgov-digital-trust/student-card/OCABundle.json" },
"YXCtXE4YhVjULgj5hrk4ML:2:unverified_person:0.1.0": { "path": "OCABundles/schema/bcgov-digital-trust/unverified-person/OCABundle.json" },
"Ep31SvFAetugFPe5CGzJxt:2:Attestation numérique d'identité gouvernemental (EXP):1.0": { "path": "OCABundles/schema/qc_anig_demo/Attestation_numérique_didentité_gouvernemental/OCABundle.json" },
"Ep31SvFAetugFPe5CGzJxt:2:Attestation numérique d'identité gouvernemental (EXP):1.0": { "path": "OCABundles/schema/qc_anig_demo/Attestation_numérique_didentité_gouvernemental/OCABundle.json" }
}
2 changes: 1 addition & 1 deletion ocabundleslist.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
{ "org": "Digital Trust, Government of British Columbia", "name": "Digital Identity Trust Program Pilot Invitation", "desc": "A verifiable credential schema for a Pilot Invitation credential to gain access to the Person Credential.", "type": "schema", "ocabundle": "OCABundles/schema/bcgov-digital-trust/pilot/OCABundle.json" },
{ "org": "Digital Trust, Government of British Columbia", "name": "BC Best College Demo Student Card", "desc": "A verifiable credential schema for a Student Card used in a demo that is part of the BC Gov Digital Trust Showcase.", "type": "schema", "ocabundle": "OCABundles/schema/bcgov-digital-trust/student-card/OCABundle.json" },
{ "org": "Digital Trust, Government of British Columbia", "name": "Unverified Person Credential", "desc": "A verifiable credential schema for an \"unverified\" person, used in various BC Wallet demos where an unofficial Person credential is useful.", "type": "schema", "ocabundle": "OCABundles/schema/bcgov-digital-trust/unverified-person/OCABundle.json" },
{ "org": "MCN, Government of Quebec", "name": "QC ANIG ID", "desc": "A verifiable credential schema used for demonstration and internal use purposes only.", "type": "schema", "ocabundle": "OCABundles/schema/qc_anig_demo/Attestation_numérique_didentité_gouvernemental/OCABundle.json" },
{ "org": "MCN, Government of Quebec", "name": "QC ANIG ID", "desc": "A verifiable credential schema used for demonstration and internal use purposes only.", "type": "schema", "ocabundle": "OCABundles/schema/qc_anig_demo/Attestation_numérique_didentité_gouvernemental/OCABundle.json" }
]
29 changes: 27 additions & 2 deletions scripts/gen_ocabundlesjson.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,32 @@ fi
echo -e "{" >${OCAIDSJSON}
echo -e "[" >${OCALISTJSON}

declare -a schema_files
schema_files=(OCABundles/schema/*)
last_schema_idx=$(( ${#schema_files[*]} - 1 ))
curr_schema_idx=0
for i in OCABundles/schema/*; do
last_schema=false
if [[ $curr_schema_idx -eq $last_schema_idx ]]; then
last_schema=true
fi
if [ -d "${i}" ]; then
declare -a files
files=(${i}/*)
last_idx=$(( ${#files[*]} - 1 ))
curr_idx=0
for j in ${i}/*; do
BUNDLE_PATH=${j}/OCABundle.json
ID=$(grep '^| ' ${j}/README.md | sed -e "/OCA Bundle/,100d" -e "/Identifier/d" -e "/----/d" -e 's/^| \([^|]*\) |.*/\1/' -e 's/\s*$//' -e 's/ /~/g')
last_id_idx=$(( ${#ID[*]} - 1 ))
curr_id_idx=0
for id in ${ID}; do
echo "\"${id}\": { \"path\": \"${BUNDLE_PATH}\" }," | sed "s/~/ /g" >>${OCAIDSJSON}
delim=","
if [[ $last_schema = true && $curr_idx -eq $last_idx ]]; then
delim=""
fi
echo "\"${id}\": { \"path\": \"${BUNDLE_PATH}\" }${delim}" | sed "s/~/ /g" >>${OCAIDSJSON}
curr_id_idx=$(( $curr_id_idx + 1))
done
ORG=$(grep "Publishing\|Issuing" ${j}/README.md | sed -e "s/.*: //")
NAME=$(sed -e "2,1000d" -e "s/# //" ${j}/README.md)
Expand All @@ -49,9 +68,15 @@ for i in OCABundles/schema/*; do
if [ "$(echo ${j} | grep "schema")" == "" ]; then
TYPE="credential"
fi
echo "{ \"org\": \"${ORG}\", \"name\": \"${NAME}\", \"desc\": \"${DESC}\", \"type\": \"${TYPE}\", \"ocabundle\": \"${BUNDLE_PATH}\" }," >>${OCALISTJSON}
delim=","
if [[ $last_schema = true && $curr_idx -eq $last_idx ]]; then
delim=""
fi
echo "{ \"org\": \"${ORG}\", \"name\": \"${NAME}\", \"desc\": \"${DESC}\", \"type\": \"${TYPE}\", \"ocabundle\": \"${BUNDLE_PATH}\" }${delim}" >>${OCALISTJSON}
curr_idx=$(( $curr_idx + 1))
done
fi
curr_schema_idx=$(( $curr_schema_idx + 1))
done

echo -e "}" >>${OCAIDSJSON}
Expand Down

0 comments on commit 0f56f04

Please sign in to comment.