Validate Custom JSON-LD Context
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Esegui il comando Verify dell’issue su sbom-output.spdx.json, quindi confrontalo con expanded-sbom-output.spdx.json prodotto da expand-custom-context.sh. Parti dalla convalida del contesto JSON-LD del comando Verify e determina come devono essere gestite le mappature di contesto personalizzate; il lavoro è completato quando il documento originale viene convalidato senza richiedere lo script esterno di espansione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
According to the Serialization Information section in the SPDX 3.0.1 spec serializing NamespaceMaps within the @context field for JSON-LD serializations is valid.
When serializing a physical SpdxDocument, any property of the logical element that can be natively represented within the chosen serialization format (e.g.,
@contextprefixes in JSON-LD instead of the namespaceMap) may utilize these native mechanisms. All remaining properties shall be serialized within the SpdxDocument element itself.
[...]
Additional namespace mappings may be defined within a separate object within the context.
The java spdx tools however do not currently support this.
Take for example the following document: sbom-output.spdx.json
export SPDX_TOOLS_VERSION=2.0.2
curl -sLO "https://github.com/spdx/tools-java/releases/download/v${SPDX_TOOLS_VERSION}/tools-java-${SPDX_TOOLS_VERSION}.zip"
unzip -j "tools-java-${SPDX_TOOLS_VERSION}.zip" "tools-java-${SPDX_TOOLS_VERSION}-jar-with-dependencies.jar"
java -jar "tools-java-${SPDX_TOOLS_VERSION}-jar-with-dependencies.jar" Verify "sbom-output.spdx.json"
The java tools fail with
This SPDX Document is not valid due to:
$.@context: must be the constant value 'https://spdx.org/rdf/3.0.1/spdx-context.jsonld'
even though the document should be valid.
An easy way to fix this would be to expand the custom context before processing the SPDX document.
See for example expand-custom-context.sh
./expand-custom-context.sh sbom-output.spdx.json
This small script expands the custom context and outputs expanded-sbom-output.spdx.json which successfully gets validated by the java tools.
java -jar "tools-java-${SPDX_TOOLS_VERSION}-jar-with-dependencies.jar" Verify "expanded-sbom-output.spdx.json"
This SPDX Document is valid.
It would be helpful if this behavior could be supported directly by the java-tools.
- Lingua principale
- Java
- Stelle
- 101
- Fork
- 46
- Merge medio
- 9h 43m
- PR unite (30g)
- 8
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spdx/tools-java
-
bug spdx-2.3 validation
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
spdx/tools-java#316 · 1 commento · 1 reazione ·
-
Release 2.0.8 Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
spdx/tools-java#313 · 1 reazione ·
-
spdx-2.x spdx-3.x
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
spdx/tools-java#290 · 2 commenti ·
-
Warning when validating Apertavalidation
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
spdx/tools-java#287 · 1 commento · 1 reazione ·
-
Case-Sensitive IRI as spdxId Apertaquestion test
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
spdx/tools-java#283 · 14 commenti · 1 reazione ·
Tutte le issue di spdx/tools-java
Issue simili
-
Bug Java Platform: Java
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/sentry-java#6138 · 1 commento ·
-
bug needs triage p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100