Skip to content

Validate SPDX 2.2 JSON files against the 2.2 schema - #345

Open
arpitjain099 wants to merge 1 commit into
spdx:masterfrom
arpitjain099:fix/json-schema-version-selection
Open

arpitjain099 wants to merge 1 commit into
spdx:masterfrom
arpitjain099:fix/json-schema-version-selection

Conversation

@arpitjain099

Copy link
Copy Markdown

Fixes #74.

Verify selects the schema with versionLessThan(TWO_POINT_THREE_VERSION, doc.getSpecVersion()), which asks whether 2.3 is older than the document. 2.3 is the newest supported version, so that is always false and JSON_SCHEMA_RESOURCE_V2_2 is never used: every 2.x file is checked against the 2.3 schema. The example from #74, a 2.2 package with referenceCategory set to PACKAGE-MANAGER, still verifies as valid on master.

Swapping the arguments picks the 2.2 schema below 2.3. I added that document as a fixture; it reported no errors before the change. The existing 2.2 examples are unaffected and BadJSON.spdx.json still reports its four errors.

Tested with mvn verify, checkstyle:check and spotbugs:check.

The arguments to versionLessThan were the wrong way round, so the test asked whether SPDX-2.3 was older than the document and the 2.2 schema was never selected.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SPDX 2.2 JSON documents are validated using the 2.3 schema

1 participant