mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 22:46:36 +01:00
chore(deps): bump the go-minor-patch group with 3 updates (#4524)
* chore(deps): bump the go-minor-patch group with 3 updates Bumps the go-minor-patch group with 3 updates: [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml), [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) and [github.com/invopop/jsonschema](https://github.com/invopop/jsonschema). Updates `github.com/BurntSushi/toml` from 1.5.0 to 1.6.0 - [Release notes](https://github.com/BurntSushi/toml/releases) - [Commits](https://github.com/BurntSushi/toml/compare/v1.5.0...v1.6.0) Updates `github.com/go-git/go-git/v5` from 5.16.3 to 5.16.4 - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.16.3...v5.16.4) Updates `github.com/invopop/jsonschema` from 0.7.0 to 0.13.0 - [Commits](https://github.com/invopop/jsonschema/compare/v0.7.0...v0.13.0) --- updated-dependencies: - dependency-name: github.com/BurntSushi/toml dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-minor-patch - dependency-name: github.com/go-git/go-git/v5 dependency-version: 5.16.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: go-minor-patch - dependency-name: github.com/invopop/jsonschema dependency-version: 0.13.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: go-minor-patch ... Signed-off-by: dependabot[bot] <support@github.com> * port breaking jsonschema lib changes Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * regenerate the existing json schema with new generation code Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex Goodman
parent
81dd955871
commit
3ea6a03cd0
@@ -45,6 +45,9 @@ func LoadCapabilities(catalogerDir, repoRoot string) (*capabilities.Document, ma
|
||||
Catalogers []capabilities.CatalogerEntry `yaml:"catalogers"`
|
||||
}
|
||||
if err := yaml.Unmarshal(data, &doc); err != nil {
|
||||
fmt.Printf("\n=== DEBUG: YAML Parse Error in %s ===\n", file)
|
||||
fmt.Printf("Error: %v\n\n", err)
|
||||
fmt.Printf("=== FULL FILE CONTENT ===\n%s\n=== END FILE ===\n", string(data))
|
||||
return nil, nil, fmt.Errorf("failed to parse %s into struct: %w", file, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -110,12 +110,9 @@ func warnMissingDescriptions(schema *jsonschema.Schema, metadataNames []string)
|
||||
|
||||
// check if fields have descriptions
|
||||
if def.Properties != nil {
|
||||
for _, fieldName := range def.Properties.Keys() {
|
||||
fieldSchemaRaw, _ := def.Properties.Get(fieldName)
|
||||
fieldSchema, ok := fieldSchemaRaw.(*jsonschema.Schema)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
for pair := def.Properties.Newest(); pair != nil; pair = pair.Prev() {
|
||||
fieldName := pair.Key
|
||||
fieldSchema := pair.Value
|
||||
|
||||
// skip if field has a description
|
||||
if fieldSchema.Description != "" {
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/iancoleman/orderedmap"
|
||||
"github.com/invopop/jsonschema"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
orderedmap "github.com/wk8/go-ordered-map/v2"
|
||||
)
|
||||
|
||||
// TestCopyAliasFieldComments verifies that field comments from source types are correctly copied to alias types.
|
||||
@@ -373,8 +373,8 @@ func TestWarnMissingDescriptions(t *testing.T) {
|
||||
}
|
||||
|
||||
// helper to create an ordered map from a regular map
|
||||
func newOrderedMap(m map[string]*jsonschema.Schema) *orderedmap.OrderedMap {
|
||||
om := orderedmap.New()
|
||||
func newOrderedMap(m map[string]*jsonschema.Schema) *orderedmap.OrderedMap[string, *jsonschema.Schema] {
|
||||
om := orderedmap.New[string, *jsonschema.Schema]()
|
||||
for k, v := range m {
|
||||
om.Set(k, v)
|
||||
}
|
||||
|
||||
@@ -158,20 +158,18 @@ func build() *jsonschema.Schema {
|
||||
// ensure the generated list of names is stable between runs
|
||||
sort.Strings(metadataNames)
|
||||
|
||||
metadataTypes := []map[string]string{
|
||||
metadataTypes := []*jsonschema.Schema{
|
||||
// allow for no metadata to be provided
|
||||
{"type": "null"},
|
||||
{Type: "null"},
|
||||
}
|
||||
for _, name := range metadataNames {
|
||||
metadataTypes = append(metadataTypes, map[string]string{
|
||||
"$ref": fmt.Sprintf("#/$defs/%s", name),
|
||||
metadataTypes = append(metadataTypes, &jsonschema.Schema{
|
||||
Ref: fmt.Sprintf("#/$defs/%s", name),
|
||||
})
|
||||
}
|
||||
|
||||
// set the "anyOf" field for Package.Metadata to be a conjunction of several types
|
||||
documentSchema.Definitions["Package"].Properties.Set("metadata", map[string][]map[string]string{
|
||||
"anyOf": metadataTypes,
|
||||
})
|
||||
documentSchema.Definitions["Package"].Properties.Set("metadata", &jsonschema.Schema{AnyOf: metadataTypes})
|
||||
|
||||
// warn about missing descriptions
|
||||
warnMissingDescriptions(documentSchema, metadataNames)
|
||||
|
||||
Reference in New Issue
Block a user