SPDX: Replace deprecated documentDescribes with DESCRIBES relationships#2065
Open
gyanranjanpanda wants to merge 1 commit intoaboutcode-org:mainfrom
Open
SPDX: Replace deprecated documentDescribes with DESCRIBES relationships#2065gyanranjanpanda wants to merge 1 commit intoaboutcode-org:mainfrom
gyanranjanpanda wants to merge 1 commit intoaboutcode-org:mainfrom
Conversation
While working on SPDX output, I noticed we're still using the documentDescribes field even though it was deprecated in SPDX 2.3 in favour of explicit DESCRIBES relationships in the relationships array. This removes that field from serialization and instead writes equivalent DESCRIBES relationships, prepended so document-level entries appear first. Reading is still backward compatible — if an older document uses documentDescribes, it's transparently converted when parsed. Updated the asgiref fixture and added two new tests: one that confirms the deprecated field no longer appears in output, and one that verifies older documents round-trip correctly to the new format. Signed-off-by: Gyan Ranjan Panda <gyanranjanpanda@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While working on the SPDX output, I noticed we're still emitting the
documentDescribestop-level field even though it was deprecated in the SPDX 2.3 specification in favour of explicitDESCRIBESrelationships inside therelationshipsarray (see spdx/spdx-spec#395).This PR removes
documentDescribesfrom serialization and emits the equivalentDESCRIBESrelationships instead, prepended so that document-level entries appear before package-level ones, keeping the ordering deterministic.Deserialization is fully backward compatible. If an older SPDX document still uses
documentDescribes,Document.from_data()transparently converts it, so existing test data and externally generated SBOMs continue to load correctly.What changed:
Document.as_dict()no longer emitsdocumentDescribes; it now prependsDESCRIBESrelationships derived from the internaldescribeslist.Document.from_data()reconstructsdescribesfrom the legacy field if present, or fromDESCRIBESrelationships wherespdxElementIdmatches the document ID.asgiref-3.3.0.spdx.jsonfixture is updated accordingly.Testing: