Add guidelines for spdxId URI - #1215
Conversation
Heavily copied from https://spdx.github.io/spdx-spec/v2.3/document-creation-information/#65-spdx-document-namespace-field Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
|
@kzantow @augelu-tng is this SPDX document namespace and element URIs pattern align with what you use currently? |
|
In our case we have very large documents. Our goal was therefore to keep the spdxId as short as possible. At the moment we use the following format:
With a custom JSON-LD context this allows to have very short spdxIds in the document: {
"@context": [
"https://spdx.org/rdf/3.0.1/spdx-context.jsonld",
{
"o": "urn:spdx.dev:17fbbbad-b3a2-5a13-9558-00e25f843ee9/output/"
}
],
"@graph": [
{
"spdxId": "o:0",
}
]
} |
|
This change seems to align with my current usage. 👍 Specifically: if the user doesn't explicitly specify a document URI, I'm following the the 2.3 guidance to generate one, e.g. |
|
One note: @augelu-tng using a custom LD context is not allowed by the spec for SPDX JSON. I am strongly in favor of leaning in to JSON LD here, as without it extensions have to be in fully expanded form, which is very large and difficult to read, but the spec is specific about using |
@kzantow we currently have a very long discussion about that at spdx/spdx-spec#1312 |
|
@kzantow It should be allowed already. The spec says: "Additional namespace mappings may be defined within a separate object within the context.". |
|
Discussed on 10 Feb tech call - agreed we don't need to tie this to a specific release milestone |
goneall
left a comment
There was a problem hiding this comment.
LGTM - I was thinking we may want to reference the namespaceMap as a way to create shorter ID's in the serialized document. However, this may over complicate the suggestions.
maxhbr
left a comment
There was a problem hiding this comment.
Looks good. But I would suggest to have something like spdx.docs as a fallback domain suggested for projects that do not want to set a default.
|
From @maxhbr :
You mean using So instead of it will be I like the idea. It will make the ID a bit shorter. From @goneall :
We can do that. I think in terms of tooling, we are near to support that soon (from what I understand from the Go side and the shacl2code side). Suggesting a shorter ID will greatly improve file size and benefit everyone. For now, with two approvals, I will merge this PR as it is. And we can improve the spdxId description (suggested domain + shorter ID + @kzantow's suggested |
|
|
|
I open another issue here #1223 to document suggestions being made here and during the 17 Feb 2026 Tech call. |
Heavily copied from https://spdx.github.io/spdx-spec/v2.3/document-creation-information/#65-spdx-document-namespace-field
To fix spdx/spdx-spec#1326
Previous relevant discussions: