Skip to content

Swagger method with empty body for grpc get request #42407

Closed
@careless6666

Description

@careless6666

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

We use gRPC HTTP API from project (https://github.com/aspnet/AspLabs/tree/main/src/GrpcHttpApi)

when generating a grpc getway, there is a problem that the contract that maps to the get request describes the parameters that should go into the query string, but instead a swagger is generated without any parameters at all

example

`
syntax = "proto3";

import "google/api/annotations.proto";

package greet;

service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {
option (google.api.http) = {
get: "/v1/greeter"
};
}
}

message HelloRequest {
string name = 1 ;
string test = 2;
}

`
it is generate curl in swagger with empty form for get method like this

curl -X GET "http://localhost:5180/v1/greeter" -H "accept: application/json"

expected

curl -X GET "http://localhost:5180/v1/greete?name=test1&test=test2" -H "accept: application/json"

My code example
https://github.com/careless6666/grpc-swagger-issue/tree/feature/empty-params

Expected Behavior

Expected swagger with form for input query string parameters and same curl

curl -X GET "http://localhost:5180/v1/greete?name=test1&test=test2" -H "accept: application/json"

Steps To Reproduce

My code example with full reproduce problem

https://github.com/careless6666/grpc-swagger-issue/tree/feature/empty-params

Exceptions (if any)

No response

.NET Version

dotnet 6.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

DocsThis issue tracks updating documentationarea-grpcIncludes: GRPC wire-up, templatesinvestigate

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions