github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/format/internal/spdxutil/versions.go (about)

     1  package spdxutil
     2  
     3  import (
     4  	"github.com/anchore/syft/syft/sbom"
     5  )
     6  
     7  const DefaultVersion = "2.3"
     8  
     9  const (
    10  	JSONFormatID     sbom.FormatID = "spdx-json"
    11  	TagValueFormatID sbom.FormatID = "spdx-tag-value"
    12  )
    13  
    14  func SupportedVersions(id sbom.FormatID) []string {
    15  	versions := []string{
    16  		"2.2",
    17  		"2.3",
    18  	}
    19  
    20  	if id != JSONFormatID {
    21  		// JSON format is not supported in v2.1
    22  		return append([]string{"2.1"}, versions...)
    23  	}
    24  
    25  	return versions
    26  }