Skip to content

Commit b6a70ac

Browse files
committed
Fix linting errors
Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent f4657e5 commit b6a70ac

File tree

2 files changed

+6
-40
lines changed

2 files changed

+6
-40
lines changed

internal/auth/jwt_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func TestJWTManager_BlockedNamespaces(t *testing.T) {
304304
jwtManager := auth.NewJWTManager(cfg)
305305

306306
claims := auth.JWTClaims{
307-
AuthMethod: model.AuthMethodGitHubAT,
307+
AuthMethod: auth.MethodGitHubAT,
308308
AuthMethodSubject: "spammer",
309309
Permissions: []auth.Permission{
310310
{
@@ -329,7 +329,7 @@ func TestJWTManager_BlockedNamespaces(t *testing.T) {
329329
jwtManager := auth.NewJWTManager(cfg)
330330

331331
claims := auth.JWTClaims{
332-
AuthMethod: model.AuthMethodGitHubAT,
332+
AuthMethod: auth.MethodGitHubAT,
333333
AuthMethodSubject: "gooduser",
334334
Permissions: []auth.Permission{
335335
{
@@ -353,7 +353,7 @@ func TestJWTManager_BlockedNamespaces(t *testing.T) {
353353
jwtManager := auth.NewJWTManager(cfg)
354354

355355
claims := auth.JWTClaims{
356-
AuthMethod: model.AuthMethodGitHubAT,
356+
AuthMethod: auth.MethodGitHubAT,
357357
AuthMethodSubject: "user",
358358
Permissions: []auth.Permission{
359359
{
@@ -382,7 +382,7 @@ func TestJWTManager_BlockedNamespaces(t *testing.T) {
382382
jwtManager := auth.NewJWTManager(cfg)
383383

384384
claims := auth.JWTClaims{
385-
AuthMethod: model.AuthMethodNone,
385+
AuthMethod: auth.MethodNone,
386386
AuthMethodSubject: "admin",
387387
Permissions: []auth.Permission{
388388
{

internal/database/import.go

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"net/http"
99
"os"
1010
"strings"
11-
"time"
1211

1312
apiv1 "github.com/modelcontextprotocol/registry/pkg/api/v1"
1413
)
@@ -125,20 +124,8 @@ func fetchFromRegistryAPI(ctx context.Context, baseURL string) ([]*apiv1.ServerR
125124
}
126125

127126
func convertServerResponseToRecord(response apiv1.ServerRecord) *apiv1.ServerRecord {
128-
// Extract registry metadata from the extension
129-
registryExt := response.XIOModelContextProtocolRegistry
130-
131-
// Parse timestamps
132-
publishedAt, _ := time.Parse(time.RFC3339, getStringFromInterface(registryExt, "published_at"))
133-
updatedAt, _ := time.Parse(time.RFC3339, getStringFromInterface(registryExt, "updated_at"))
134-
135-
registryMetadata := apiv1.RegistryExtensions{
136-
ID: getStringFromInterface(registryExt, "id"),
137-
IsLatest: getBoolFromInterface(registryExt, "is_latest"),
138-
PublishedAt: publishedAt,
139-
UpdatedAt: updatedAt,
140-
ReleaseDate: getStringFromInterface(registryExt, "release_date"),
141-
}
127+
// The registry extensions are already properly typed, so we can use them directly
128+
registryMetadata := response.XIOModelContextProtocolRegistry
142129

143130
// Publisher extensions
144131
publisherExtensions := response.XPublisher
@@ -153,24 +140,3 @@ func convertServerResponseToRecord(response apiv1.ServerRecord) *apiv1.ServerRec
153140
}
154141
}
155142

156-
func getStringFromInterface(data interface{}, key string) string {
157-
if dataMap, ok := data.(map[string]interface{}); ok {
158-
if value, exists := dataMap[key]; exists {
159-
if strValue, ok := value.(string); ok {
160-
return strValue
161-
}
162-
}
163-
}
164-
return ""
165-
}
166-
167-
func getBoolFromInterface(data interface{}, key string) bool {
168-
if dataMap, ok := data.(map[string]interface{}); ok {
169-
if value, exists := dataMap[key]; exists {
170-
if boolValue, ok := value.(bool); ok {
171-
return boolValue
172-
}
173-
}
174-
}
175-
return false
176-
}

0 commit comments

Comments
 (0)