Skip to content

feat: SP-2140 define new methods for transitive dependencies #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
14 changes: 14 additions & 0 deletions protobuf/scanoss/api/common/v2/scanoss-common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ message EchoResponse {
* Purl request data (JSON payload)
*/
message PurlRequest {

/*
TODO: Refactor this API
- Remove nested Purls message and replace with top-level Purl message type.
- Update field definition below to: repeated Purl purls = 1;
*/

message Purls {
// @description: purl to be requested
string purl = 1;
Expand All @@ -78,3 +85,10 @@ message PurlRequest {
repeated Purls purls = 1;
}

/*
* Purl to be requested
*/
message Purl {
string purl = 1;
string requirement = 2;
}
50 changes: 49 additions & 1 deletion protobuf/scanoss/api/dependencies/v2/scanoss-dependencies.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ service Dependencies {
body: "*"
};
};

rpc GetTransitiveDependencies(TransitiveDependencyRequest) returns(TransitiveDependencyResponse) {
option (google.api.http) = {
post: "/api/v2/dependencies/transitive"
body: "*"
};
};

}

/*
Expand Down Expand Up @@ -134,4 +142,44 @@ message DependencyResponse {
repeated Files files = 1;
// Response status (required?)
scanoss.api.common.v2.StatusResponse status = 2;
}
}

/*
* Transitive dependency request data (JSON payload)
*/

message TransitiveDependencyRequest {
string ecosystem = 1;
// Depth to go when searching dependencies
int32 depth = 2;
// Limit used on response
int32 limit = 3;

/* TODO: Add scope filters:
repeated string scopes = 4;
Using a list of strings allows filtering by multiple scopes simultaneously
(e.g., include both "dev" and "test" dependencies in a single request)
*/

// List of Purls from the same ecosystem
repeated scanoss.api.common.v2.Purl purls = 5;
}

/*
* Transitive dependency response data (JSON payload)
*/
message TransitiveDependencyResponse {
message Dependencies {
string purl = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

field numbers are wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

string version = 3;

// TODO: Add scope field
// optional string scope = 4;
}
// Dependency response details
repeated Dependencies dependencies = 1;
// Response status
scanoss.api.common.v2.StatusResponse status = 2;
}