mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 07:26:34 +01:00
add bom descriptor schema + test against xml schemas in pipeline (#163)
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -5,21 +5,23 @@ package integration
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/anchore/go-testutils"
|
||||
"github.com/anchore/syft/syft"
|
||||
"github.com/anchore/syft/syft/pkg"
|
||||
"github.com/anchore/syft/syft/presenter"
|
||||
"github.com/anchore/syft/syft/scope"
|
||||
"github.com/xeipuuv/gojsonschema"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/anchore/go-testutils"
|
||||
"github.com/anchore/syft/syft"
|
||||
"github.com/anchore/syft/syft/pkg"
|
||||
"github.com/anchore/syft/syft/presenter"
|
||||
"github.com/anchore/syft/syft/scope"
|
||||
"github.com/xeipuuv/gojsonschema"
|
||||
)
|
||||
|
||||
const jsonSchemaExamplesPath = "json-schema/examples"
|
||||
const jsonSchemaPath = "schema/json"
|
||||
const jsonSchemaExamplesPath = jsonSchemaPath + "/examples"
|
||||
|
||||
func repoRoot(t *testing.T) string {
|
||||
t.Helper()
|
||||
@@ -35,7 +37,7 @@ func repoRoot(t *testing.T) string {
|
||||
}
|
||||
|
||||
func validateAgainstV1Schema(t *testing.T, json string) {
|
||||
fullSchemaPath := path.Join(repoRoot(t), "json-schema", "schema.json")
|
||||
fullSchemaPath := path.Join(repoRoot(t), jsonSchemaPath, "schema.json")
|
||||
schemaLoader := gojsonschema.NewReferenceLoader(fmt.Sprintf("file://%s", fullSchemaPath))
|
||||
documentLoader := gojsonschema.NewStringLoader(json)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user