Add a recursive parameter to the dotnet-grpc add-files CLI command#2204
Open
Kronicaler wants to merge 3 commits intogrpc:masterfrom
Open
Add a recursive parameter to the dotnet-grpc add-files CLI command#2204Kronicaler wants to merge 3 commits intogrpc:masterfrom
Kronicaler wants to merge 3 commits intogrpc:masterfrom
Conversation
Add a recursive parameter to the dotnet-grpc add-files CLI command. The new parameter will add files in the requested folder recursively. A unit test which verifies the functionality has been added.
Jecha1917
reviewed
Jan 22, 2024
| var searchPattern = reference.Substring(directoryToSearch.Length); | ||
|
|
||
| var resolvedFiles = Directory.GetFiles(directoryToSearch, searchPattern); | ||
| var resolvedFiles = Directory.GetFiles(directoryToSearch, searchPattern, searchOption); |
There was a problem hiding this comment.
It's not a good idea to import all proto files, it's better to go through the proto imports recursively and import the specified files if they exist. It will look like this: we add only the securities.proto file, the definition of the service, the rest used will be pulled up recursively.
example: securities.proto
syntax = "proto3";
import "proto/fftapi/v1/security.proto";
package grpc.fftapi.v1;
message GetSecuritiesRequest {
}
message GetSecuritiesResult {
repeated proto.fftapi.v1.Security securities = 1;
}
service Securities {
rpc GetSecurities(grpc.fftapi.v1.GetSecuritiesRequest) returns (grpc.fftapi.v1.GetSecuritiesResult);
}
This example is from a real service. The approach that implements recursive directory search not only fails to complete successfully but also generates unnecessary services and types.
|
When will this PR be merged? Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a recursive parameter to the dotnet-grpc add-files CLI command.
The new parameter will search the files in the requested folder recursively which enables adding proto references to projects inside multiple sub-folders.
A unit test which verifies the functionality has been added and previous non recursive unit tests were changed.