Improve stdio transport validation and function naming (#365)
## Summary - Add validation that URL must be empty for stdio transport types - Rename `validateTransport` to `validateRemoteTransport` for better clarity - Update corresponding test case to expect error when stdio transport has URL ## Context This addresses two specific feedback comments from @domdomegg on PR #345: 1. "do we want to validate the the url _is_ empty?" - Now validates URL is empty for stdio 2. "maybe rename validateRemoteTransport or something?" - Renamed function for clarity The changes enforce stricter validation while improving code readability through better naming.
This commit is contained in:
parent
fb64e7da3c
commit
e9884c1d7b
1 changed files with 13 additions and 10 deletions
|
|
@ -832,7 +832,7 @@ func TestValidate_TransportValidation(t *testing.T) {
|
|||
}{
|
||||
// Package transport tests - stdio (no URL required)
|
||||
{
|
||||
name: "package transport stdio without URL",
|
||||
name: "package transport stdio without URL should pass",
|
||||
serverDetail: apiv0.ServerJSON{
|
||||
Name: "com.example/test-server",
|
||||
Description: "A test server",
|
||||
|
|
@ -852,7 +852,7 @@ func TestValidate_TransportValidation(t *testing.T) {
|
|||
expectedError: "",
|
||||
},
|
||||
{
|
||||
name: "package transport stdio with URL (should still work)",
|
||||
name: "package transport stdio with URL (should fail)",
|
||||
serverDetail: apiv0.ServerJSON{
|
||||
Name: "com.example/test-server",
|
||||
Description: "A test server",
|
||||
|
|
@ -870,7 +870,7 @@ func TestValidate_TransportValidation(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
expectedError: "",
|
||||
expectedError: "url must be empty for stdio transport type",
|
||||
},
|
||||
// Package transport tests - streamable-http (URL required)
|
||||
{
|
||||
|
|
@ -1270,9 +1270,9 @@ func createValidServerWithArgument(arg model.Argument) apiv0.ServerJSON {
|
|||
},
|
||||
Packages: []model.Package{
|
||||
{
|
||||
Identifier: "test-package",
|
||||
RegistryType: "npm",
|
||||
RegistryBaseURL: "https://registry.npmjs.org",
|
||||
Identifier: "test-package",
|
||||
RegistryType: "npm",
|
||||
RegistryBaseURL: "https://registry.npmjs.org",
|
||||
Transport: model.Transport{
|
||||
Type: "stdio",
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue