Skip to content

Commit

Permalink
Confusing name of field in IsDependency GraphQL (#1305)
Browse files Browse the repository at this point in the history
Signed-off-by: desmax74 <mdessi@redhat.com>
  • Loading branch information
desmax74 committed Sep 21, 2023
1 parent 3b1e4e0 commit c46528b
Show file tree
Hide file tree
Showing 23 changed files with 594 additions and 594 deletions.
16 changes: 8 additions & 8 deletions cmd/guacone/cmd/vulnerability.go
Expand Up @@ -262,14 +262,14 @@ func searchDependencyPackages(ctx context.Context, gqlclient graphql.Client, top
}
for _, neighbor := range isDependencyNeighborResponses.Neighbors {
if isDependency, ok := neighbor.(*model.NeighborsNeighborsIsDependency); ok {
if isDependency.DependentPackage.Type == guacType {
if isDependency.DependencyPackage.Type == guacType {
continue
}

depPkgFilter := &model.PkgSpec{
Type: &isDependency.DependentPackage.Type,
Namespace: &isDependency.DependentPackage.Namespaces[0].Namespace,
Name: &isDependency.DependentPackage.Namespaces[0].Names[0].Name,
Type: &isDependency.DependencyPackage.Type,
Namespace: &isDependency.DependencyPackage.Namespaces[0].Namespace,
Name: &isDependency.DependencyPackage.Namespaces[0].Names[0].Name,
}

depPkgResponse, err := model.Packages(ctx, gqlclient, *depPkgFilter)
Expand Down Expand Up @@ -458,8 +458,8 @@ func searchDependencyPackagesReverse(ctx context.Context, gqlclient graphql.Clie
if topPkgID != "" {
now = topPkgID
for now != searchPkgID {
path = append(path, nodeMap[now].isDependency.Id, nodeMap[now].isDependency.DependentPackage.Namespaces[0].Names[0].Id,
nodeMap[now].isDependency.DependentPackage.Namespaces[0].Id, nodeMap[now].isDependency.DependentPackage.Id,
path = append(path, nodeMap[now].isDependency.Id, nodeMap[now].isDependency.DependencyPackage.Namespaces[0].Names[0].Id,
nodeMap[now].isDependency.DependencyPackage.Namespaces[0].Id, nodeMap[now].isDependency.DependencyPackage.Id,
nodeMap[now].isDependency.Package.Namespaces[0].Names[0].Versions[0].Id,
nodeMap[now].isDependency.Package.Namespaces[0].Names[0].Id, nodeMap[now].isDependency.Package.Namespaces[0].Id,
nodeMap[now].isDependency.Package.Id)
Expand All @@ -469,8 +469,8 @@ func searchDependencyPackagesReverse(ctx context.Context, gqlclient graphql.Clie
} else {
for i := len(collectedIDs) - 1; i >= 0; i-- {
if nodeMap[collectedIDs[i]].isDependency != nil {
path = append(path, nodeMap[collectedIDs[i]].isDependency.Id, nodeMap[collectedIDs[i]].isDependency.DependentPackage.Namespaces[0].Names[0].Id,
nodeMap[collectedIDs[i]].isDependency.DependentPackage.Namespaces[0].Id, nodeMap[collectedIDs[i]].isDependency.DependentPackage.Id,
path = append(path, nodeMap[collectedIDs[i]].isDependency.Id, nodeMap[collectedIDs[i]].isDependency.DependencyPackage.Namespaces[0].Names[0].Id,
nodeMap[collectedIDs[i]].isDependency.DependencyPackage.Namespaces[0].Id, nodeMap[collectedIDs[i]].isDependency.DependencyPackage.Id,
nodeMap[collectedIDs[i]].isDependency.Package.Namespaces[0].Names[0].Versions[0].Id,
nodeMap[collectedIDs[i]].isDependency.Package.Namespaces[0].Names[0].Id, nodeMap[collectedIDs[i]].isDependency.Package.Namespaces[0].Id,
nodeMap[collectedIDs[i]].isDependency.Package.Id)
Expand Down
6 changes: 3 additions & 3 deletions demo/graphql/queries.gql
Expand Up @@ -54,7 +54,7 @@ fragment allIsDependencyTree on IsDependency {
package {
...allPkgTree
}
dependentPackage {
dependencyPackage {
...allPkgTree
}
origin
Expand All @@ -63,7 +63,7 @@ fragment allIsDependencyTree on IsDependency {

query IsDependencyQ1 {
IsDependency(isDependencySpec: { package: { type: "guac", namespace: "cdx/docker.io/library", name: "consul" }}) {
dependentPackage {
dependencyPackage {
type
namespaces {
namespace
Expand All @@ -78,7 +78,7 @@ query IsDependencyQ1 {
query IsDependencyQ2 {
IsDependency(isDependencySpec: {
package: { type: "guac", namespace: "cdx/docker.io/library", name: "consul" }
dependentPackage: { type: "golang", namespace: "github.com/sirupsen", name: "logrus" }
dependencyPackage: { type: "golang", namespace: "github.com/sirupsen", name: "logrus" }
}) {
...allIsDependencyTree
}
Expand Down
4 changes: 2 additions & 2 deletions demo/workflow/queries.gql
@@ -1,6 +1,6 @@
query isDependency {
IsDependency(
isDependencySpec: {dependentPackage: {namespace: "github.com/prometheus", name: "client_golang"}}
isDependencySpec: {dependencyPackage: {namespace: "github.com/prometheus", name: "client_golang"}}
) {
id
justification
Expand All @@ -25,7 +25,7 @@ query isDependency {
}
}
}
dependentPackage {
dependencyPackage {
id
type
namespaces {
Expand Down

0 comments on commit c46528b

Please sign in to comment.