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

bug in protoc-gen-swagger with put method and field_mask #1271

Closed
vtolstov opened this issue May 7, 2020 · 3 comments
Closed

bug in protoc-gen-swagger with put method and field_mask #1271

vtolstov opened this issue May 7, 2020 · 3 comments

Comments

@vtolstov
Copy link

vtolstov commented May 7, 2020

protoc-gen-swagger from current grpc-gateway master

  rpc Update(AccountUpdateReq) returns (Account) {                                                              
    option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = { operation_id: "AccountUpdate";     
   responses: {                                                                                                 
     key: "default";                                                                                            
     value: {                                                                                                   
       description: "Error response";                                                                           
       schema: {                                                                                                
         json_schema: {                                                                                         
           ref: ".Error";                                                                              
         }                                                                                                      
       }                                                                                                        
     }                                                                                                          
   }                                                                                                            
                                                                                                                
};                                                                                                              
    option (google.api.http) = { put: "/api/v0/accounts/{account.uuid}" body: "account"; };            
  };                                                                                                            

message AccountUpdateReq {                           
  Account account = 1;                               
  google.protobuf.FieldMask fields = 2;              
};                                                   

generates:

   "/api/v0/accounts/{account.uuid}": {
     "put": {
       "operationId": "AccountUpdate",
       "responses": {
         "200": {
           "description": "A successful response.",
           "schema": {
             "$ref": "#/definitions/Account"
           }
         },
         "default": {
           "description": "Error response",
           "schema": {
             "$ref": "#/definitions/Error"
           }
         }
       },
       "parameters": [
          {
            "name": "account.uuid",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/Account"
            }
          }
        ],
        "tags": [
          "AccountService"
        ]
      }
    },
@vtolstov
Copy link
Author

vtolstov commented May 7, 2020

as i understand all stuff that not in body and in path must be in params

@vtolstov
Copy link
Author

vtolstov commented May 7, 2020

i think that my issue is the same as #1015

@johanbrandhorst
Copy link
Collaborator

Closing as duplicate

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

2 participants