From da84e2afe77c5bee8a19260e90adea78ab150b15 Mon Sep 17 00:00:00 2001 From: Wesley Hershberger Date: Mon, 12 Aug 2024 15:41:51 -0500 Subject: [PATCH] internal/rest/resources: Require 1 or more Endpoints for each resource Signed-off-by: Wesley Hershberger (cherry picked from commit b47019abb34ab9ee7d063ce81d4da68b14772c3c) --- internal/rest/resources/resources.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/rest/resources/resources.go b/internal/rest/resources/resources.go index e7e29561..8ddde534 100644 --- a/internal/rest/resources/resources.go +++ b/internal/rest/resources/resources.go @@ -110,6 +110,10 @@ func ValidateEndpoints(extensionServers map[string]rest.Server, coreAddress stri // Ensure no endpoint path conflicts with another endpoint on the same server. // If a server is an extension to the core API, it will be compared against all core API paths. for _, resource := range server.Resources { + if len(resource.Endpoints) == 0 { + return fmt.Errorf("Server %q resource must have defined endpoints", serverName) + } + for _, e := range resource.Endpoints { url := filepath.Join(string(resource.PathPrefix), e.Path)