Swagger grpc throws stack overflow exception when having recursive trees as query parameters
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
Consider the following minimal rpc:
```protobuf
rpc List(ListRequest) returns (ListResponse) {
option (google.api.http) = {
get: "/api/notes/list",
};
}
message ListRequest {
ListRequestRecursive tree = 1;
}
message ListRequestRecursive {
ListRequestRecursiveChildren children = 1;
}
message ListRequestRecursiveChildren {
repeated ListRequestRecursive children = 1;
}
message ListResponse { }
```
This causes the server to throw stack overflow exception as it goes into infinite loop starting from here:
https://github.com/dotnet/aspnetcore/blob/de68d4212113859604d9e57cf7d674b167a8a317/src/Grpc/JsonTranscoding/src/Shared/ServiceDescriptorHelpers.cs#L505
workaround:
use POST instead of get:
```protobuf
rpc List(ListRequest) returns (ListResponse) {
option (google.api.http) = {
post: "/api/notes/list",
body: "*"
};
}
```
Contributor guide
Assessment
This issue has not been assessed yet.