Skip to content
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
5 changes: 5 additions & 0 deletions internal/config/validation_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ import (
"fmt"
"os"
"strings"
"sync"

"github.com/github/gh-aw-mcpg/internal/jqutil"
"github.com/github/gh-aw-mcpg/internal/oidc"
"github.com/itchyny/gojq"
"github.com/santhosh-tekuri/jsonschema/v6"
)

// customSchemaCache stores compiled custom schemas by schema URL to avoid
// repeated fetch + compile work across validations.
var customSchemaCache sync.Map

func logValidationFail(name, serverType, reason string, err error) error {
logValidation.Printf("Validation failed: %s, name=%s, type=%s", reason, name, serverType)
return err
Expand Down
10 changes: 1 addition & 9 deletions internal/config/validation_shared.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
package config

import (
"sync"

"github.com/github/gh-aw-mcpg/internal/logger"
)
import "github.com/github/gh-aw-mcpg/internal/logger"

var logValidation = logger.ForFile()

// customSchemaCache stores compiled custom schemas by schema URL to avoid
// repeated fetch + compile work across validations.
var customSchemaCache sync.Map
25 changes: 0 additions & 25 deletions internal/difc/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,6 @@ import "github.com/github/gh-aw-mcpg/internal/logger"

var logResource = logger.ForFile()

// Resource represents an external system with label requirements (deprecated - use LabeledResource)
type Resource struct {
Description string
Secrecy SecrecyLabel
Integrity IntegrityLabel
}

// NewResource creates a new resource with the given description
func NewResource(description string) *Resource {
return &Resource{
Description: description,
Secrecy: *NewSecrecyLabel(),
Integrity: *NewIntegrityLabel(),
}
}

// Empty returns a resource with no label requirements
func EmptyResource() *Resource {
return &Resource{
Description: "empty resource",
Secrecy: *NewSecrecyLabel(),
Integrity: *NewIntegrityLabel(),
}
}

// LabeledResource represents a resource with DIFC labels
// This can be a simple label pair or a complex nested structure for fine-grained filtering
type LabeledResource struct {
Expand Down
31 changes: 0 additions & 31 deletions internal/difc/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,6 @@ import (
"github.com/stretchr/testify/require"
)

func TestNewResource(t *testing.T) {
tests := []struct {
name string
description string
}{
{name: "basic description", description: "my-resource"},
{name: "empty description", description: ""},
{name: "long description", description: "a very long resource description with spaces and special chars: @#$%"},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
r := NewResource(tt.description)

require.NotNil(t, r)
assert.Equal(t, tt.description, r.Description)
assert.True(t, r.Secrecy.Label.IsEmpty(), "NewResource should have empty secrecy label")
assert.True(t, r.Integrity.Label.IsEmpty(), "NewResource should have empty integrity label")
})
}
}

func TestEmptyResource(t *testing.T) {
r := EmptyResource()

require.NotNil(t, r)
assert.Equal(t, "empty resource", r.Description)
assert.True(t, r.Secrecy.Label.IsEmpty(), "EmptyResource should have empty secrecy label")
assert.True(t, r.Integrity.Label.IsEmpty(), "EmptyResource should have empty integrity label")
}

func TestNewLabeledResource(t *testing.T) {
r := NewLabeledResource("labeled-resource")

Expand Down
Loading