Validate Custom JSON-LD Context
まだ誰も着手していません。
評価
調査の方向性
Issue の Verify コマンドを sbom-output.spdx.json に対して実行し、その後、expand-custom-context.sh によって生成された expanded-sbom-output.spdx.json と比較します。Verify コマンドの JSON-LD コンテキスト検証から始め、カスタムコンテキストマッピングをどのように扱うべきかを判断します。完了の条件は、外部の展開スクリプトを必要とせずに元のドキュメントが検証に通ることです。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 101
- フォーク
- 46
- 平均マージ
- 9時間 43分
- マージ済み PR(30日)
- 8
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
spdx/tools-java のほかの issue
-
bug spdx-2.3 validation
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
spdx/tools-java#316 · コメント 1 件 · リアクション 1 件 ·
-
Release 2.0.8 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 20/100
spdx/tools-java#313 · リアクション 1 件 ·
-
spdx-2.x spdx-3.x
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
spdx/tools-java#290 · コメント 2 件 ·
-
validation
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
spdx/tools-java#287 · コメント 1 件 · リアクション 1 件 ·
-
question test
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
spdx/tools-java#283 · コメント 14 件 · リアクション 1 件 ·
spdx/tools-java の issue をすべて見る
似ている issue
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/flink-agents#1152 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jenkinsci/blueocean-plugin#5417 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
objectionary/eo-graphs#75 ·