Files
git.stella-ops.org/docs/schemas/spdx-jsonld-3.0.1.schema.json
2026-02-01 21:37:40 +02:00

175 lines
4.6 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://spdx.org/schema/3.0.1/spdx-json-schema.json",
"title": "SPDX 3.0.1 JSON-LD Schema (Structural Subset)",
"description": "Focused structural validation for SPDX 3.0.1 JSON-LD documents. Validates key requirements per SPDX 3.0.1 specification.",
"type": "object",
"required": ["@context", "@graph"],
"properties": {
"@context": {
"const": "https://spdx.org/rdf/3.0.1/spdx-context.jsonld"
},
"@graph": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/GraphElement"
}
}
},
"additionalProperties": false,
"$defs": {
"GraphElement": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"minLength": 1
},
"@id": {
"type": "string"
},
"spdxId": {
"type": "string"
},
"creationInfo": {
"oneOf": [
{ "type": "string" },
{ "type": "object" }
]
},
"name": {
"type": "string"
},
"created": {
"type": "string"
},
"specVersion": {
"type": "string"
},
"createdBy": {
"type": "array",
"items": { "type": "string" }
},
"createdUsing": {
"type": "array",
"items": { "type": "string" }
},
"rootElement": {
"type": "array",
"items": { "type": "string" }
},
"element": {
"type": "array",
"items": { "type": "string" }
},
"profileConformance": {
"type": "array",
"items": { "type": "string" }
},
"software_sbomType": {
"type": "array",
"items": { "type": "string" }
},
"software_packageVersion": { "type": "string" },
"software_packageUrl": { "type": "string" },
"software_downloadLocation": { "type": "string" },
"software_primaryPurpose": { "type": "string" },
"software_copyrightText": { "type": "string" },
"simplelicensing_licenseExpression": { "type": "string" },
"from": { "type": "string" },
"relationshipType": { "type": "string" },
"to": {
"type": "array",
"items": { "type": "string" }
}
},
"allOf": [
{
"if": {
"properties": { "type": { "const": "CreationInfo" } },
"required": ["type"]
},
"then": {
"required": ["@id", "created", "specVersion"]
}
},
{
"if": {
"properties": { "type": { "const": "SpdxDocument" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "rootElement", "element"]
}
},
{
"if": {
"properties": { "type": { "const": "software_Sbom" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "rootElement", "element"]
}
},
{
"if": {
"properties": { "type": { "const": "software_Package" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "name"]
}
},
{
"if": {
"properties": { "type": { "const": "software_File" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "name"]
}
},
{
"if": {
"properties": { "type": { "const": "Relationship" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "from", "relationshipType", "to"]
}
},
{
"if": {
"properties": { "type": { "const": "Tool" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "name"]
}
},
{
"if": {
"properties": { "type": { "const": "Organization" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "name"]
}
},
{
"if": {
"properties": { "type": { "const": "Person" } },
"required": ["type"]
},
"then": {
"required": ["spdxId", "creationInfo", "name"]
}
}
],
"additionalProperties": true
}
}
}