Sort crossRef members in JSON output#244
Merged
Merged
Conversation
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Member
|
Suggest adding this to the LicenseJson.java file - that would benefit anyone serializing a license which would include the LicenseListPublisher. It would also simplify the implementation. Another suggestion - to make the list order deterministic, you could sort on a field in the CrossRef (e.g. the URL string) if there is no order. |
Contributor
Author
|
Thank you. Will move this to Spdx-Java-Library as suggested. |
Contributor
Author
|
The crossRef sorting part in LicenseJson is now ready for review spdx/Spdx-Java-Library#430 |
SortableExceptionJsonTOC is now unused Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Contributor
Author
|
java-spdx-library 2.0.4 (with the JSON sorting method) is released and updated to the pom.xml. Test now passed. |
goneall
approved these changes
Jun 29, 2026
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.
In JSON output, sort the
crossRefarray byorderkey, from smallest (0) to largest.If there is no
order, push the element to the end of list and sort them byurl.To fix #243
Note
spdx/Spdx-Java-Library#430 is needed to be landed in Spdx-Java-Library, released, and added to pom.xml of LicenseListPublisher first (and update the pom.xml in this PR), in order for this PR to pass CI test.That PR implements crossRef sorting directly in
LicenseJsonand sorting ofLicenseJsonTOCandExceptionJsonTOC.org.spdx.storage.listedlicense.SortableExceptionJsonTOC is now unused anywhere in the codebase, but kept as it is a public class.