@@ -249,6 +249,16 @@ func TestValidate(t *testing.T) {
249249 },
250250 expectedError : validators .ErrMultipleSlashesInServerName .Error (),
251251 },
252+ {
253+ name : "server without repository" ,
254+ serverDetail : apiv0.ServerJSON {
255+ Schema : model .CurrentSchemaURL ,
256+ Name : "com.example/test-server" ,
257+ Description : "A test server" ,
258+ Version : "1.0.0" ,
259+ },
260+ expectedError : "" ,
261+ },
252262 {
253263 name : "valid server detail with all fields" ,
254264 serverDetail : apiv0.ServerJSON {
@@ -281,6 +291,43 @@ func TestValidate(t *testing.T) {
281291 },
282292 expectedError : "" ,
283293 },
294+ {
295+ name : "server with empty repository" ,
296+ serverDetail : apiv0.ServerJSON {
297+ Schema : model .CurrentSchemaURL ,
298+ Name : "com.example/test-server" ,
299+ Description : "A test server" ,
300+ Repository : & model.Repository {},
301+ Version : "1.0.0" ,
302+ },
303+ expectedError : "repository url is required when repository is provided" ,
304+ },
305+ {
306+ name : "server with repository missing URL" ,
307+ serverDetail : apiv0.ServerJSON {
308+ Schema : model .CurrentSchemaURL ,
309+ Name : "com.example/test-server" ,
310+ Description : "A test server" ,
311+ Repository : & model.Repository {
312+ Source : "github" ,
313+ },
314+ Version : "1.0.0" ,
315+ },
316+ expectedError : "repository url is required when repository is provided" ,
317+ },
318+ {
319+ name : "server with repository missing source" ,
320+ serverDetail : apiv0.ServerJSON {
321+ Schema : model .CurrentSchemaURL ,
322+ Name : "com.example/test-server" ,
323+ Description : "A test server" ,
324+ Repository : & model.Repository {
325+ URL : "https://github.com/owner/repo" ,
326+ },
327+ Version : "1.0.0" ,
328+ },
329+ expectedError : "repository source is required when repository is provided" ,
330+ },
284331 {
285332 name : "server with invalid repository source" ,
286333 serverDetail : apiv0.ServerJSON {
0 commit comments