Skip to content

Commit

Permalink
Feat(spec type): Added v1.6 spec type
Browse files Browse the repository at this point in the history
Signed-off-by: Petzys <87223648+Petzys@users.noreply.github.com>
  • Loading branch information
Petzys committed Apr 24, 2024
1 parent e8a52d8 commit f13799c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cyclonedx_json.go
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
)

func (ev EnvironmentVariableChoice) MarshalJSON() ([]byte, error) {
Expand Down Expand Up @@ -124,6 +125,9 @@ func (sv *SpecVersion) UnmarshalJSON(bytes []byte) error {
*sv = SpecVersion1_4
case SpecVersion1_5.String():
*sv = SpecVersion1_5
case SpecVersion1_6.String():
log.Default().Println("Warning: Support for v1.6 in cyclonedx-go is work in progress.")
*sv = SpecVersion1_6
default:
return ErrInvalidSpecVersion
}
Expand Down Expand Up @@ -192,4 +196,5 @@ var jsonSchemas = map[SpecVersion]string{
SpecVersion1_3: "http://cyclonedx.org/schema/bom-1.3.schema.json",
SpecVersion1_4: "http://cyclonedx.org/schema/bom-1.4.schema.json",
SpecVersion1_5: "http://cyclonedx.org/schema/bom-1.5.schema.json",
SpecVersion1_6: "http://cyclonedx.org/schema/bom-1.6.schema.json",
}
5 changes: 3 additions & 2 deletions cyclonedx_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions cyclonedx_xml.go
Expand Up @@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"io"
"log"
)

// bomReferenceXML is temporarily used for marshalling and unmarshalling
Expand Down Expand Up @@ -292,6 +293,9 @@ func (sv *SpecVersion) UnmarshalXML(d *xml.Decoder, start xml.StartElement) erro
*sv = SpecVersion1_4
case SpecVersion1_5.String():
*sv = SpecVersion1_5
case SpecVersion1_6.String():
log.Default().Println("Warning: Support for v1.6 in cyclonedx-go is work in progress.")
*sv = SpecVersion1_6
default:
return ErrInvalidSpecVersion
}
Expand Down Expand Up @@ -411,4 +415,5 @@ var xmlNamespaces = map[SpecVersion]string{
SpecVersion1_3: "http://cyclonedx.org/schema/bom/1.3",
SpecVersion1_4: "http://cyclonedx.org/schema/bom/1.4",
SpecVersion1_5: "http://cyclonedx.org/schema/bom/1.5",
SpecVersion1_6: "http://cyclonedx.org/schema/bom/1.6",
}

0 comments on commit f13799c

Please sign in to comment.