Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: log schema metadata #574

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/annotator/annotator.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func getSchemaMetadata(schema []byte) schemaMetadata {
namespace := schemaContents.Get("self.namespace").String()
version := schemaContents.Get("self.version").String()
disableValidation := schemaContents.Get("disableValidation").Bool()
log.Debug().Msgf("🟡 vendor: %s, namespace: %s, version: %s, disableValidation: %t", vendor, namespace, version, disableValidation)
return schemaMetadata{
Vendor: vendor,
Namespace: namespace,
Expand Down
33 changes: 33 additions & 0 deletions pkg/annotator/annotator_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package annotator

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestGetSchemaMetadata(t *testing.T) {
testData := []struct {
name string
input []byte
expected schemaMetadata
}{
{
name: "Valid JSON",
input: []byte(`{"self":{"vendor":"testVendor","namespace":"testNamespace","version":"testVersion"},"disableValidation":true}`),
expected: schemaMetadata{
Vendor: "testVendor",
Namespace: "testNamespace",
Version: "testVersion",
DisableValidation: true,
},
},
}

for _, tc := range testData {
t.Run(tc.name, func(t *testing.T) {
result := getSchemaMetadata(tc.input)
assert.Equal(t, tc.expected, result)
})
}
}
1 change: 0 additions & 1 deletion pkg/annotator/test_annotator.go

This file was deleted.

Loading