Skip to content
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

Response codes and descriptions in Swagger docs #304

Closed
arun0009 opened this issue Jan 19, 2017 · 11 comments
Closed

Response codes and descriptions in Swagger docs #304

arun0009 opened this issue Jan 19, 2017 · 11 comments

Comments

@arun0009
Copy link

It would be nice if we can specify rest response codes/descriptions via some grpc gateway annotations or some other means.

@achew22
Copy link
Collaborator

achew22 commented Jan 20, 2017

@arun0009, can you be a little bit more specific about what output changes you would like to see in the swagger docs? Maybe you could put together a PR that has a first pass on some of the ideas?

@arun0009
Copy link
Author

arun0009 commented Jan 20, 2017

Right now, all the responses show up as 200, but it would be nice to have other response messages like 404, 500, 201 & other http response codes with user specified descriptions. I will try and submit a PR over the weekend.

@tmc
Copy link
Collaborator

tmc commented Jan 20, 2017

This likely implies options outside of google.api.http annotations.

@tmc
Copy link
Collaborator

tmc commented Jan 23, 2017

@arun0009 you might look/comment on #305

@morriswinkler-simple
Copy link

morriswinkler-simple commented Feb 16, 2017

Here is a more literate example of the idea:

"paths": {
    "/health-check": {
      "get": {
        "summary": "Returns health status",
        "operationId": "HealthCheck",
        "responses": {
          "200": {
            "description": "", ⬅︎ // no description possible here
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
            }
          }
        },
        "tags": [
          "GardenOpenService"
        ]
      }
    },

would be nice if within the proto file we could add

   // Returns health status
    rpc HealthCheck (google.protobuf.Empty) returns (google.protobuf.Empty) {
        option (google.api.http) = {
       // Really healthy to get some description  ⬅︎
       get: "/health-check"
    };
    }

which could translate to

"paths": {
    "/health-check": {
      "get": {
        "summary": "Returns health status",
        "operationId": "HealthCheck",
        "responses": {
          "200": {
            "description": "Really healthy to get some description  ⬅︎",
            "schema": {
              "$ref": "#/definitions/protobufEmpty"
            }
          }
        },
        "tags": [
          "GardenOpenService"
        ]
      }
    },

What do you think, is this information passed along the proto services slice?

@tmc
Copy link
Collaborator

tmc commented Feb 17, 2017

@arun0009 / @morriswinkler-simplesurance -- that suggestion may work for the 200 path but custom proto would be required pretty rapidly IMO

@tmc
Copy link
Collaborator

tmc commented Apr 19, 2017

This effort should continue in #145

@johanbrandhorst
Copy link
Collaborator

#145 added a lot of the stuff for OpenAPI, but unfortunately it did not add support for custom response codes, so I'm going to bump this. Implementing it at this point should be significantly easier though because of the work done in #145.

@achew22
Copy link
Collaborator

achew22 commented Feb 5, 2018

Agreed, @johanbrandhorst. How can I help you get that PR in?

johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue May 31, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
@johanbrandhorst
Copy link
Collaborator

I've opened #663 to help with this.

johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue May 31, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 4, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 5, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 5, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 5, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 6, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 7, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 7, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 7, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 7, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 7, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit to johanbrandhorst/grpc-gateway that referenced this issue Jun 15, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
johanbrandhorst added a commit that referenced this issue Jun 20, 2018
Extends the openapiv2 protofile to allow control over response objects.

Fixes #304
adasari pushed a commit to adasari/grpc-gateway that referenced this issue Apr 9, 2020
Extends the openapiv2 protofile to allow control over response objects.

Fixes grpc-ecosystem#304
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants