-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[issue-184] validate against json-spec #254
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew, that was quite the amount of work :O
Thanks for addressing these non-trivial matters! :)
The remarks regarding the json
files also apply to the xml
and yaml
versions as far as I checked.
spdx/file.py
Outdated
@@ -63,7 +63,7 @@ def __init__(self, name, spdx_id=None, chk_sum=None): | |||
self.spdx_id = spdx_id | |||
self.comment = None | |||
self.type = None | |||
self.chk_sum = chk_sum | |||
self.checksums = [None] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.checksums = [None] | |
self.checksums = [chk_sum] |
and maybe rename chk_sum
to checksum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the intention here was to distinguish the package and file checksum by using different names chk_sum
for file and check_sum
for package. I agree that it is better to use chksum
and checksum
but I would stick to the different names for the objects since they are slightly different: checksums for packages are optional whereas checksums for files are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To give my opinion here (already discussed with @meretp ):
- I find the distinction between the two variable names rather arbitrary and obscure. I would question whether it's necessary at all, and if it is, I would prefer something like
file_checksum
andpackage_checksum
. That would make it clear to a reader which one is which, and also provide a hint at why the naming distinction is made in the first place - Considering that this is probably an issue in quite a lot of places, and we are planning a major redesign in the near future, I want to be pragmatic about this. If renaming the variables everywhere is a lot of effort, let's just stick with the status quo until the redesign.
Currently sick and unable to do another round
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked the outstanding comments, since @armintaenzertng already did an extensive review. I think this is good to go now (as soon as appveyor starts working again or we disable it somehow...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approving after rebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once more
Signed-off-by: Daniel Holth <[email protected]>
Signed-off-by: Meret Behrens <[email protected]>
leads to failing tests caused by jsonyamlxml writer since json and yaml expect surrounding document Signed-off-by: Meret Behrens <[email protected]>
This leads to the failure of tests caused by the jsonyamlxml writer. Signed-off-by: Meret Behrens <[email protected]>
…spec 2.2 Signed-off-by: Meret Behrens <[email protected]>
…ing to spec Signed-off-by: Meret Behrens <[email protected]>
Signed-off-by: Meret Behrens <[email protected]>
…lidate against spec Signed-off-by: Meret Behrens <[email protected]>
Signed-off-by: Meret Behrens <[email protected]>
- correct checksum in json example - add JSONExample2.2 from spec but exclude in tests since 2.2 is not yet completely supported - add files only once if they appear in multiple packages - parse only spdxid in documentDescribes, delete commented out code - delete unused XMLWriter and JsonYamlWriter class, updated xml test results - rework create_document_describes method - delete surrounding document in json/yaml test - rename licenseinfoinfiles method according to variable - rename chk_sum/ check_sum to chksum/checksum - delete duplicated relationships from json/yaml/xml Signed-off-by: Meret Behrens <[email protected]>
This PR is taken over from the original PR #197 by @dholth.
Besides writing the json according to the spec this PR also handles parsing json/yaml/xml files.
This PR doesn't cover files that do not belong to any package since this would need more work on the internal data model. Also it is not possible to parse checksums other than sha1, there is another PR #200 dealing with this, which can hopefully be rebased on this and add this functionality.
fixes #184, #234,#240, #242.