You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of today, I noticed cyclonedx-go/testdata only provides valid-* sample test BOM files in XML and JSON. It provides no invalid-* files, and no protobuf files.
And files are not sorted by CycloneDX specification version, which makes it
harder to list and to maintain.
But I noticed the github.com/CycloneDX/specification repository provides both valid-* and invalid-* BOM sample files in XML, JSON and PROTOBUF formats.
These files are useful to tests implementation of the CycloneDX, such as github.com/CycloneDX/cyclonedx-go.
This would give access to the full list of valid-* and invalid-* BOMs files
in *.xml, *.json and *.textproto with no efforts.
This would be available at this path: cyclonedx-go/specification/tools/src/test/resources.
And if there are tests files dedicated to one particular language (Go, python, or Java),
then either keep a folder for custom test files, or contribute to the tests files in the CycloneDX/specification repo.
All CycloneDX Implementation Python, Golang, Java could do the same
The same principle could be applied to any CycloneDX implementation:
Once the git submodules for CycloneDX/specification are available in both cyclonedx-go, cyclonedx-core-java and cyclonedx-python-lib to fetch
test files, this could also be used for fetching schema files (JSON Schema,
XSD and protobuf).
This would prevent issues such as this one where I noticed CycloneDX schema
files are different from one CycloneDX implementation to another. CycloneDX/specification#479 (comment)
Note: I start this discussion for the cyclonedx-go project. But we could
open the same discussion in others CycloneDX implementations (python and
java).
CC @jkowalleck & @nscuro who helped me figure out how to explain this idea 😄
The text was updated successfully, but these errors were encountered:
@Nicolas-Peiffer Do you know how well Git submodules play with Go modules? For example, consider we want to embed schema files from the submodule via //go:embed. Will consumers of cyclonedx-go still be able to use the library (because Go automatically clones submodules), or will this cause issues (because Go doesn't automatically clone submodules)?
@nscuro you make a very good point that I completely missed. Thank you very much for this 👍 .
Indeed, after a quick search with ChatGPT4 and the web, I came to the conclusion that GoLang packages on Github.com does not support git submodules natively.
There is an open issue since 2016 somehow similar to this topic: golang/go#17522
And the workarounds based on git clone --recurse-submodules [...] are not satisfactory, since they are not supported by go install and go get.
Fetching files and commit them instead of using a submodule?
I think the only viable short term solution (outside of patching GoLang to add support for git submodules) it to mimic what is already done on the python implementation:
As of today, I noticed
cyclonedx-go/testdata
only providesvalid-*
sample test BOM files in XML and JSON. It provides noinvalid-*
files, and no protobuf files.And files are not sorted by CycloneDX specification version, which makes it
harder to list and to maintain.
But I noticed the
github.com/CycloneDX/specification
repository provides bothvalid-*
andinvalid-*
BOM sample files in XML, JSON and PROTOBUF formats.These files are useful to tests implementation of the CycloneDX, such as
github.com/CycloneDX/cyclonedx-go
.I suggest using a git submodule to fetch tests files from the CycloneDX specification repository.
git clone https://github.com/CycloneDX/cyclonedx-go cd cyclonedx-go git submodule add -f https://github.com/CycloneDX/specification specification
This would give access to the full list of
valid-*
andinvalid-*
BOMs filesin
*.xml
,*.json
and*.textproto
with no efforts.This would be available at this path:
cyclonedx-go/specification/tools/src/test/resources
.And if there are tests files dedicated to one particular language (Go, python, or Java),
then either keep a folder for custom test files, or contribute to the tests files in the
CycloneDX/specification
repo.All CycloneDX Implementation Python, Golang, Java could do the same
The same principle could be applied to any CycloneDX implementation:
github.com/CycloneDX/cyclonedx-go
github.com/CycloneDX/cyclonedx-core-java
github.com/CycloneDX/cyclonedx-python-lib
Use the git submodule for Schema Files as well?
Once the git submodules for
CycloneDX/specification
are available in bothcyclonedx-go
,cyclonedx-core-java
andcyclonedx-python-lib
to fetchtest files, this could also be used for fetching schema files (JSON Schema,
XSD and protobuf).
This would prevent issues such as this one where I noticed CycloneDX schema
files are different from one CycloneDX implementation to another.
CycloneDX/specification#479 (comment)
CC @jkowalleck & @nscuro who helped me figure out how to explain this idea 😄
The text was updated successfully, but these errors were encountered: