Skip to content

Commit 435cf91

Browse files
committed
Add JSON-LD example
Adds a JSON-LD example and GitHub actions to validate them
1 parent 8f171e5 commit 435cf91

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
- pull_request
3+
- push
4+
5+
jobs:
6+
validate-examples:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
10+
- name: Install dependencies
11+
run: |
12+
python3 -m pip install pyshacl==0.25.0 check-jsonschema==0.28.1
13+
- name: Check files
14+
run: |
15+
set -e
16+
for f in examples/jsonld/*.json; do
17+
echo "Checking $f"
18+
19+
check-jsonschema \
20+
-v \
21+
--schemafile https://spdx.org/schema/3.0.0/spdx-json-schema.json \
22+
$f
23+
24+
pyshacl \
25+
-s https://spdx.org/rdf/3.0.0/spdx-model.ttl \
26+
-e https://spdx.org/rdf/3.0.0/spdx-model.ttl \
27+
$f
28+
done
29+

examples/jsonld/package_sbom.json

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"@context": "https://spdx.org/rdf/3.0.0/spdx-context.jsonld",
3+
"@graph": [
4+
{
5+
"type": "CreationInfo",
6+
"@id": "_:creationinfo",
7+
"createdBy": [
8+
"http://spdx.example.com/Agent/JoshuaWatt"
9+
],
10+
"specVersion": "3.0.0",
11+
"created": "2024-03-06T00:00:00Z"
12+
},
13+
{
14+
"type": "Person",
15+
"spdxId": "http://spdx.example.com/Agent/JoshuaWatt",
16+
"name": "Joshua Watt",
17+
"creationInfo": "_:creationinfo",
18+
"externalIdentifier": [
19+
{
20+
"type": "ExternalIdentifier",
21+
"externalIdentifierType": "email",
22+
"identifier": "[email protected]"
23+
}
24+
]
25+
},
26+
{
27+
"type": "SpdxDocument",
28+
"spdxId": "http://spdx.example.com/Document1",
29+
"creationInfo": "_:creationinfo",
30+
"rootElement": [
31+
"http://spdx.example.com/BOM1"
32+
],
33+
"profileConformance": [
34+
"core",
35+
"software"
36+
]
37+
},
38+
{
39+
"type": "software_Sbom",
40+
"spdxId": "http://spdx.example.com/BOM1",
41+
"creationInfo": "_:creationinfo",
42+
"rootElement": [
43+
"http://spdx.example.com/Package1"
44+
],
45+
"software_sbomType": [
46+
"build"
47+
]
48+
},
49+
{
50+
"type": "software_Package",
51+
"spdxId": "http://spdx.example.com/Package1",
52+
"creationInfo": "_:creationinfo",
53+
"name": "my-package",
54+
"software_packageVersion": "1.0",
55+
"software_downloadLocation": "http://dl.example.com/my-package_1.0.0.tar",
56+
"builtTime": "2024-03-06T00:00:00Z",
57+
"originatedBy": [
58+
"http://spdx.example.com/Agent/JoshuaWatt"
59+
]
60+
},
61+
{
62+
"type": "software_File",
63+
"spdxId": "http://spdx.example.com/Package1/myprogram",
64+
"creationInfo": "_:creationinfo",
65+
"name": "myprogram",
66+
"software_primaryPurpose": "executable",
67+
"software_additionalPurpose": [
68+
"application"
69+
],
70+
"software_copyrightText": "Copyright 2024, Joshua Watt",
71+
"builtTime": "2024-03-06T00:00:00Z",
72+
"originatedBy": [
73+
"http://spdx.example.com/Agent/JoshuaWatt"
74+
]
75+
},
76+
{
77+
"type": "Relationship",
78+
"spdxId": "http://spdx.example.com/Relationship/1",
79+
"creationInfo": "_:creationinfo",
80+
"from": "http://spdx.example.com/Package1",
81+
"relationshipType": "contains",
82+
"to": [
83+
"http://spdx.example.com/Package1/myprogram"
84+
],
85+
"completeness": "complete"
86+
}
87+
]
88+
}

0 commit comments

Comments
 (0)