Skip to content
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

[GSoC'21] Pr:5 . Complete the JSON saver #92

Merged
merged 34 commits into from Jul 16, 2021
Merged

Conversation

specter25
Copy link
Collaborator

GSoC'2021 Pull Request 5 :
Deliverables Completed :

  • Save CreationInfo
  • Save Realtionships
  • Save Annotations
  • Save Reviews
  • Save Snippets
  • Save Packages
  • Save Other licensing Info
  • Write Utility function to parse special SPDXIdentifiers for relationships
  • Write an example to convert a tag-value document to json format

specter25 and others added 30 commits March 28, 2021 00:47
- Shows error if a Package has a missing SPDXID tag
- Show error if a File has a missing SPDXID tag

Signed-off-by: specter25 <ujjwalcoding012@gmail.com>
- Shows error if a Package has a missing SPDXID tag
- Show error if a File has a missing SPDXID tag

Signed-off-by: specter25 <ujjwalcoding012@gmail.com>
- Fix capitalized initials of error messages
- Other structural changes to increase code efficiency

Signed-off-by: specter25 <ujjwalcoding012@gmail.com>
-- Added file name display in error messages
- Structured the tests in respective files

Signed-off-by: specter25 <ujjwalcoding012@gmail.com>
Signed-off-by: specter25 <ujjwalcoding012@gmail.com>
Signed-off-by: Steve Winslow <steve@swinslow.net>
Signed-off-by: Ian Ling <ian@iancaling.com>
Merge JSON parsing into main
Signed-off-by: Steve Winslow <steve@swinslow.net>
Throw error for pkgs / files without SPDX IDs
Signed-off-by: Steve Winslow <steve@swinslow.net>
Fix missing colon for excludes in PackageVerificationCode
Signed-off-by: Steve Winslow <steve@swinslow.net>
Fix multi-line text wrapping fields
Signed-off-by: Steve Winslow <steve@swinslow.net>
Signed-off-by: Steve Winslow <steve@swinslow.net>
Signed-off-by: Steve Winslow <steve@swinslow.net>
Update documentation for 0.2.0 release
Signed-off-by: Steve Winslow <steve@swinslow.net>
Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- parsed other licenses from spdx.Doxument2_2 to json
- tests pending

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- Saved annoations on the root document from struct to json
- unit tests pending

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- Saved document describes from spdxStruct to json
- unit tests pending from this section

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- saved packages from spdx struct to json
- saved relationships froms spdx struct to json

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- parsed files information from struct to json
- unckaged files spdx map altered (find a fix around it )

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- save snippets information from spdx struct to json
- unit tests for render function pending

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- Write bytes from bytes.buffer to io.Writer while parsing json

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- Parse a jsonsaved file using jsonloader and fixx the bugs discovered

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
- Don't remove () suffix while parsing creator person and organization

Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
Signed-off-by: Ujjwal Agarwal <ujjwalcoding012@gmail.com>
@specter25
Copy link
Collaborator Author

@swinslow the main and json branch were not in sync after the release as a result some extra commits have come in the pull request . The commits for the jsonsaver have 'jsonsaver:' as the prefix in the commit message .

Copy link
Member

@swinslow swinslow left a comment

Choose a reason for hiding this comment

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

Hi @specter25, great job as always with this :) I've included a handful of comments below. Some of these are things we discussed yesterday so you can ignore if they are no longer applicable based on what we talked about.

I'll go ahead and merge this into the json branch so that you can keep moving forward, so feel free to review the edits at your leisure for subsequent commits. Thanks!

examples/9-jsonsaver/exampletvtojson.go Show resolved Hide resolved
examples/9-jsonsaver/exampletvtojson.go Show resolved Hide resolved
examples/9-jsonsaver/exampletvtojson.go Show resolved Hide resolved
examples/8-jsonloader/result.txt Show resolved Hide resolved
examples/9-jsonsaver/sample.json Show resolved Hide resolved
jsonsaver/saver2v2/save_creation_info.go Show resolved Hide resolved
if ci.Created != "" {
fmt.Fprintf(buf, "\"%s\": \"%s\",", "created", ci.Created)
}
if ci.CreatorPersons != nil || ci.CreatorOrganizations != nil || ci.CreatorTools != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I haven't checked to confirm, but: this looks like it will run the range action across each of the CreatorPersons, CreatorOrganizations and CreatorTools slices if any one of them is non-nil.

Will this work as expected if one of them is non-nil, but the others are nil? It might be fine, I'm just forgetting at the moment whether range on a nil slice will crash, or whether it will just silently skip it.

jsonsaver/saver2v2/save_files.go Show resolved Hide resolved
jsonsaver/saver2v2/save_package.go Show resolved Hide resolved
jsonsaver/saver2v2/save_package.go Show resolved Hide resolved
@swinslow swinslow merged commit 668152c into spdx:json Jul 16, 2021
@swinslow swinslow added the enhancement New feature or request label Jul 31, 2021
@swinslow swinslow added this to the 0.3.0 milestone Jul 31, 2021
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.

None yet

3 participants