Skip to content

Commit

Permalink
Trim the "@-" suffix from resource names before calling the List*Revi…
Browse files Browse the repository at this point in the history
…sions APIs. (#1218)
  • Loading branch information
timburks authored Aug 14, 2023
1 parent bce4232 commit 82fd89e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/visitor/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package visitor
import (
"context"
"fmt"
"strings"

"github.com/apigee/registry/cmd/registry/compress"
"github.com/apigee/registry/gapic"
Expand Down Expand Up @@ -132,7 +133,8 @@ func ListDeploymentRevisions(ctx context.Context,
filter string,
handler DeploymentHandler) error {
it := client.ListApiDeploymentRevisions(ctx, &rpc.ListApiDeploymentRevisionsRequest{
Name: name.String(),
// "@-" indicates a collection of revisions, but we only want to send the resource name to the List RPC.
Name: strings.TrimSuffix(name.String(), "@-"),
PageSize: pageSize,
Filter: filter,
})
Expand Down Expand Up @@ -234,7 +236,8 @@ func ListSpecRevisions(ctx context.Context,
getContents bool,
handler SpecHandler) error {
it := client.ListApiSpecRevisions(ctx, &rpc.ListApiSpecRevisionsRequest{
Name: name.String(),
// "@-" indicates a collection of revisions, but we only want to send the resource name to the List RPC.
Name: strings.TrimSuffix(name.String(), "@-"),
PageSize: pageSize,
Filter: filter,
})
Expand Down

0 comments on commit 82fd89e

Please sign in to comment.