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

Conversion creates invalid SPDX JSON #361

Open
vargenau opened this issue Apr 8, 2024 · 3 comments
Open

Conversion creates invalid SPDX JSON #361

vargenau opened this issue Apr 8, 2024 · 3 comments

Comments

@vargenau
Copy link
Contributor

vargenau commented Apr 8, 2024

hello.spdx.json.txt
hello.cdx.json.txt

Convert hello.spdx.jsonfrom SPDX to CycloneDX:

cyclonedx convert --input-file hello.spdx.json --input-format autodetect --output-file hello.cdx.json --output-format json

Try to convert the result back to SPDX:

cyclonedx convert --output-file hello2.spdx.json --output-format spdxjson --input-file hello.cdx.json --input-format json

Result:

Unhandled exception: System.Text.Json.JsonException: '}' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 182 | BytePositionInLine: 3.
@andreas-hilti
Copy link
Contributor

@vargenau Could it be that hello.cdx.json already existed and you tried to overwrite it?
Then, I would assume that it is a duplicate of #255.

@vargenau
Copy link
Contributor Author

vargenau commented May 22, 2024

I tested again with version 0.25.0 of cyclonedx-cli

The hello.spdx.json file is valid SPDX:

pyspdxtools -i hello2.spdx.json

When converted to CycloneDX then converted back to SPDX, the resulting file hello2.spdx.json is invalid SPDX:

pyspdxtools -i hello2.spdx.json
ERROR:root:The document is invalid. The following issues have been found:
license_info_in_file is mandatory in SPDX-2.2
license_info_in_file is mandatory in SPDX-2.2
license_info_in_file is mandatory in SPDX-2.2
there must be at least one relationship "SPDXRef-DOCUMENT DESCRIBES ..." or "... DESCRIBED_BY SPDXRef-DOCUMENT" when there is not only a single package present

@vargenau
Copy link
Contributor Author

hello2.spdx.json.txt

@vargenau vargenau changed the title Conversion creates invalid JSON Conversion creates invalid SPDX JSON May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants