Skip to content

Commit

Permalink
internal/rest/resources: Require 1 or more Endpoints for each resource
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Hershberger <[email protected]>
(cherry picked from commit b47019a)
  • Loading branch information
MggMuggins committed Aug 16, 2024
1 parent 0195e2e commit da84e2a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/rest/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit da84e2a

Please sign in to comment.