dotnet / dotnet/aspnetcore

Swagger document generated for JSON Transcoding enabled grpc server stream response, returns only single object

Open
#53,431 1 comment 0 reactions 0 assignees View on GitHub
area-grpc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

Json Transcoding correctly supports the streaming of objects when calling a gRPC server streaming method. When testing an URL directly, multiple json objects are returned.

The generated swagger document however, describes the operation as only returning a single object instead of an array of objects. When generating client code from the swagger.json file, the code also will only return a single object.

Below snippet is from the swagger.json generated by the gRPC Transcoder sample application

```
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HelloReply"
}
}
}
}
```

### Expected Behavior

Below response would generate correct client code:

```
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HelloReply"
}
}
}
}
}
```

### Steps To Reproduce

Can be reproduced using the Transcoder sample: https://github.com/grpc/grpc-dotnet/tree/master/examples/Transcoder

### Exceptions (if any)

_No response_

### .NET Version

7.0

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.