Skip to content

Add load() API#26

Open
JPEWdev wants to merge 1 commit intospdx:mainfrom
JPEWdev:autoload
Open

Add load() API#26
JPEWdev wants to merge 1 commit intospdx:mainfrom
JPEWdev:autoload

Conversation

@JPEWdev
Copy link
Copy Markdown
Collaborator

@JPEWdev JPEWdev commented Mar 11, 2026

Adds an API to automatically load an SPDX document with the correct model based on the document context. This allows users to load a document without needing to know what specific version it is.

Adds an API to automatically load an SPDX document with the correct
model based on the document context. This allows users to load a
document without needing to know what specific version it is.
Copy link
Copy Markdown
Collaborator

@bact bact left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May optionally add another test data file with @context that will be surely not in the generated _CONTEXT_TABLE.

tests/data/bad-context/no-context.spdx3.json:

{
  "@graph": []
}

tests/data/bad-context/wrongtype-context.spdx3.json:

{
  "@context" : 1,
  "@graph" : [ ]
}

tests/data/bad-context/unknown-context.spdx3.json:

{
  "@context" : "https://example.com/context.jsonld",
  "@graph" : [ ]
}

All of the three should raise LoadError

@bact bact added the enhancement New feature or request label Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants