From 554199c32c0d9a077be2d711ff9f32258a1d5afd Mon Sep 17 00:00:00 2001 From: Alex Leigh Date: Tue, 6 Feb 2018 16:49:59 -0800 Subject: [PATCH 1/4] Change swagger generator to use protobuf canonical JSON encoding (lowerCamelCase). --- .../abe/a_bit_of_everything_service_api.go | 187 --------------- examples/clients/abe/echo_rpc_api.go | 226 ++++++++++++++++++ examples/clients/abe/echo_service_api.go | 226 ++++++++++++++++++ .../abe/examplepb_a_bit_of_everything.go | 50 ++-- .../a_bit_of_everything.swagger.json | 50 ++-- examples/main_test.go | 3 +- protoc-gen-swagger/genswagger/template.go | 2 +- 7 files changed, 505 insertions(+), 239 deletions(-) create mode 100644 examples/clients/abe/echo_rpc_api.go create mode 100644 examples/clients/abe/echo_service_api.go diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index eec4725130c..bc40897d864 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -314,193 +314,6 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes return successPayload, localVarAPIResponse, err } -/** - * Echo allows posting a StringMessage value. - * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. - * - * @param value - * @return *SubStringMessage - */ -func (a ABitOfEverythingServiceApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" - localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo allows posting a StringMessage value. - * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. - * - * @param body - * @return *SubStringMessage - */ -func (a ABitOfEverythingServiceApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Post") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - -/** - * Echo allows posting a StringMessage value. - * It also exposes multiple bindings. This makes it useful when validating that the OpenAPI v2 API description exposes documentation correctly on all paths defined as additional_bindings in the proto. - * - * @param value - * @return *SubStringMessage - */ -func (a ABitOfEverythingServiceApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { - - var localVarHttpMethod = strings.ToUpper("Get") - // create path and map variables - localVarPath := a.Configuration.BasePath + "/v2/example/echo" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := make(map[string]string) - var localVarPostBody interface{} - var localVarFileName string - var localVarFileBytes []byte - // add default headers if any - for key := range a.Configuration.DefaultHeader { - localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] - } - localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) - - // to determine the Content-Type header - localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } - - // set Content-Type header - localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - // to determine the Accept header - localVarHttpHeaderAccepts := []string{ - "application/json", - "application/x-foo-mime", - } - - // set Accept header - localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - var successPayload = new(SubStringMessage) - localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - - var localVarURL, _ = url.Parse(localVarPath) - localVarURL.RawQuery = localVarQueryParams.Encode() - var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} - if localVarHttpResponse != nil { - localVarAPIResponse.Response = localVarHttpResponse.RawResponse - localVarAPIResponse.Payload = localVarHttpResponse.Body() - } - - if err != nil { - return successPayload, localVarAPIResponse, err - } - err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) - return successPayload, localVarAPIResponse, err -} - /** * * diff --git a/examples/clients/abe/echo_rpc_api.go b/examples/clients/abe/echo_rpc_api.go new file mode 100644 index 00000000000..344909eca34 --- /dev/null +++ b/examples/clients/abe/echo_rpc_api.go @@ -0,0 +1,226 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "net/url" + "strings" + "encoding/json" + "fmt" +) + +type EchoRpcApi struct { + Configuration *Configuration +} + +func NewEchoRpcApi() *EchoRpcApi { + configuration := NewConfiguration() + return &EchoRpcApi{ + Configuration: configuration, + } +} + +func NewEchoRpcApiWithBasePath(basePath string) *EchoRpcApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &EchoRpcApi{ + Configuration: configuration, + } +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoRpcApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param body + * @return *SubStringMessage + */ +func (a EchoRpcApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoRpcApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/clients/abe/echo_service_api.go b/examples/clients/abe/echo_service_api.go new file mode 100644 index 00000000000..61b40b86107 --- /dev/null +++ b/examples/clients/abe/echo_service_api.go @@ -0,0 +1,226 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "net/url" + "strings" + "encoding/json" + "fmt" +) + +type EchoServiceApi struct { + Configuration *Configuration +} + +func NewEchoServiceApi() *EchoServiceApi { + configuration := NewConfiguration() + return &EchoServiceApi{ + Configuration: configuration, + } +} + +func NewEchoServiceApiWithBasePath(basePath string) *EchoServiceApi { + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &EchoServiceApi{ + Configuration: configuration, + } +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoServiceApi) Echo(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything/echo/{value}" + localVarPath = strings.Replace(localVarPath, "{"+"value"+"}", fmt.Sprintf("%v", value), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param body + * @return *SubStringMessage + */ +func (a EchoServiceApi) Echo2(body string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo2", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * Summary: Echo rpc + * Description Echo + * + * @param value + * @return *SubStringMessage + */ +func (a EchoServiceApi) Echo3(value string) (*SubStringMessage, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Get") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v2/example/echo" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + localVarQueryParams.Add("value", a.Configuration.APIClient.ParameterToString(value, "")) + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(SubStringMessage) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "Echo3", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index cb6fb3a487d..2f75b33f3f0 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -16,59 +16,59 @@ import ( type ExamplepbABitOfEverything struct { - SingleNested ABitOfEverythingNested `json:"single_nested,omitempty"` + SingleNested ABitOfEverythingNested `json:"singleNested,omitempty"` Uuid string `json:"uuid,omitempty"` Nested []ABitOfEverythingNested `json:"nested,omitempty"` - FloatValue float32 `json:"float_value,omitempty"` + FloatValue float32 `json:"floatValue,omitempty"` - DoubleValue float64 `json:"double_value,omitempty"` + DoubleValue float64 `json:"doubleValue,omitempty"` - Int64Value string `json:"int64_value,omitempty"` + Int64Value string `json:"int64Value,omitempty"` - Uint64Value string `json:"uint64_value,omitempty"` + Uint64Value string `json:"uint64Value,omitempty"` - Int32Value int32 `json:"int32_value,omitempty"` + Int32Value int32 `json:"int32Value,omitempty"` - Fixed64Value string `json:"fixed64_value,omitempty"` + Fixed64Value string `json:"fixed64Value,omitempty"` - Fixed32Value int64 `json:"fixed32_value,omitempty"` + Fixed32Value int64 `json:"fixed32Value,omitempty"` - BoolValue bool `json:"bool_value,omitempty"` + BoolValue bool `json:"boolValue,omitempty"` - StringValue string `json:"string_value,omitempty"` + StringValue string `json:"stringValue,omitempty"` - BytesValue string `json:"bytes_value,omitempty"` + BytesValue string `json:"bytesValue,omitempty"` - Uint32Value int64 `json:"uint32_value,omitempty"` + Uint32Value int64 `json:"uint32Value,omitempty"` - EnumValue ExamplepbNumericEnum `json:"enum_value,omitempty"` + EnumValue ExamplepbNumericEnum `json:"enumValue,omitempty"` - Sfixed32Value int32 `json:"sfixed32_value,omitempty"` + Sfixed32Value int32 `json:"sfixed32Value,omitempty"` - Sfixed64Value string `json:"sfixed64_value,omitempty"` + Sfixed64Value string `json:"sfixed64Value,omitempty"` - Sint32Value int32 `json:"sint32_value,omitempty"` + Sint32Value int32 `json:"sint32Value,omitempty"` - Sint64Value string `json:"sint64_value,omitempty"` + Sint64Value string `json:"sint64Value,omitempty"` - RepeatedStringValue []string `json:"repeated_string_value,omitempty"` + RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` - OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"` + OneofEmpty ProtobufEmpty `json:"oneofEmpty,omitempty"` - OneofString string `json:"oneof_string,omitempty"` + OneofString string `json:"oneofString,omitempty"` - MapValue map[string]ExamplepbNumericEnum `json:"map_value,omitempty"` + MapValue map[string]ExamplepbNumericEnum `json:"mapValue,omitempty"` - MappedStringValue map[string]string `json:"mapped_string_value,omitempty"` + MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` - MappedNestedValue map[string]ABitOfEverythingNested `json:"mapped_nested_value,omitempty"` + MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` - TimestampValue time.Time `json:"timestamp_value,omitempty"` + TimestampValue time.Time `json:"timestampValue,omitempty"` - RepeatedEnumValue []ExamplepbNumericEnum `json:"repeated_enum_value,omitempty"` + RepeatedEnumValue []ExamplepbNumericEnum `json:"repeatedEnumValue,omitempty"` } diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index a6c1f752214..0c038162072 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -711,7 +711,7 @@ "examplepbABitOfEverything": { "type": "object", "properties": { - "single_nested": { + "singleNested": { "$ref": "#/definitions/ABitOfEverythingNested" }, "uuid": { @@ -723,93 +723,93 @@ "$ref": "#/definitions/ABitOfEverythingNested" } }, - "float_value": { + "floatValue": { "type": "number", "format": "float" }, - "double_value": { + "doubleValue": { "type": "number", "format": "double" }, - "int64_value": { + "int64Value": { "type": "string", "format": "int64" }, - "uint64_value": { + "uint64Value": { "type": "string", "format": "uint64" }, - "int32_value": { + "int32Value": { "type": "integer", "format": "int32" }, - "fixed64_value": { + "fixed64Value": { "type": "string", "format": "uint64" }, - "fixed32_value": { + "fixed32Value": { "type": "integer", "format": "int64" }, - "bool_value": { + "boolValue": { "type": "boolean", "format": "boolean" }, - "string_value": { + "stringValue": { "type": "string" }, - "bytes_value": { + "bytesValue": { "type": "string", "format": "byte" }, - "uint32_value": { + "uint32Value": { "type": "integer", "format": "int64" }, - "enum_value": { + "enumValue": { "$ref": "#/definitions/examplepbNumericEnum" }, - "sfixed32_value": { + "sfixed32Value": { "type": "integer", "format": "int32" }, - "sfixed64_value": { + "sfixed64Value": { "type": "string", "format": "int64" }, - "sint32_value": { + "sint32Value": { "type": "integer", "format": "int32" }, - "sint64_value": { + "sint64Value": { "type": "string", "format": "int64" }, - "repeated_string_value": { + "repeatedStringValue": { "type": "array", "items": { "type": "string" } }, - "oneof_empty": { + "oneofEmpty": { "$ref": "#/definitions/protobufEmpty" }, - "oneof_string": { + "oneofString": { "type": "string" }, - "map_value": { + "mapValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/examplepbNumericEnum" } }, - "mapped_string_value": { + "mappedStringValue": { "type": "object", "additionalProperties": { "type": "string" } }, - "mapped_nested_value": { + "mappedNestedValue": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ABitOfEverythingNested" @@ -818,11 +818,11 @@ "nonConventionalNameValue": { "type": "string" }, - "timestamp_value": { + "timestampValue": { "type": "string", "format": "date-time" }, - "repeated_enum_value": { + "repeatedEnumValue": { "type": "array", "items": { "$ref": "#/definitions/examplepbNumericEnum" diff --git a/examples/main_test.go b/examples/main_test.go index 2742c385bb2..122afeb0ce1 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -8,6 +8,7 @@ import ( "time" server "github.com/grpc-ecosystem/grpc-gateway/examples/server" + "github.com/grpc-ecosystem/grpc-gateway/runtime" ) func runServers() <-chan error { @@ -18,7 +19,7 @@ func runServers() <-chan error { } }() go func() { - if err := Run(":8080"); err != nil { + if err := Run(":8080", runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: false})); err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() diff --git a/protoc-gen-swagger/genswagger/template.go b/protoc-gen-swagger/genswagger/template.go index c838a5808d7..3c3e50eb56c 100644 --- a/protoc-gen-swagger/genswagger/template.go +++ b/protoc-gen-swagger/genswagger/template.go @@ -241,7 +241,7 @@ func renderMessagesAsDefinition(messages messageMap, d swaggerDefinitionsObject, panic(err) } - schema.Properties = append(schema.Properties, keyVal{f.GetName(), fieldValue}) + schema.Properties = append(schema.Properties, keyVal{f.GetJsonName(), fieldValue}) } d[fullyQualifiedNameToSwaggerName(msg.FQMN(), reg)] = schema } From 15a3872056a06eb7ccace7b146b621d5f34df587 Mon Sep 17 00:00:00 2001 From: Alex Leigh Date: Thu, 8 Feb 2018 22:05:29 -0800 Subject: [PATCH 2/4] Change default jsonpb marshaling to camelCase field names and to emit default values. --- examples/client_test.go | 24 +- .../abe/a_bit_of_everything_service_api.go | 151 +++++ .../abe/examplepb_a_bit_of_everything.go | 6 +- ...> examplepb_a_bit_of_everything_nested.go} | 2 +- ...examplepb_a_bit_of_everything_sans_enum.go | 68 ++ ...pb_a_bit_of_everything_sans_enum_nested.go | 20 + examples/examplepb/a_bit_of_everything.pb.go | 635 ++++++++++++++---- .../examplepb/a_bit_of_everything.pb.gw.go | 270 ++++++++ examples/examplepb/a_bit_of_everything.proto | 50 ++ .../a_bit_of_everything.swagger.json | 308 ++++++++- examples/examplepb/echo_service.pb.go | 1 + examples/integration_test.go | 13 +- examples/main_test.go | 5 +- examples/server/a_bit_of_everything.go | 30 +- runtime/marshaler_registry.go | 2 +- 15 files changed, 1426 insertions(+), 159 deletions(-) rename examples/clients/abe/{a_bit_of_everything_nested.go => examplepb_a_bit_of_everything_nested.go} (90%) create mode 100644 examples/clients/abe/examplepb_a_bit_of_everything_sans_enum.go create mode 100644 examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go diff --git a/examples/client_test.go b/examples/client_test.go index 536a7a27fc2..3f4a03942bb 100644 --- a/examples/client_test.go +++ b/examples/client_test.go @@ -56,7 +56,7 @@ func TestAbitOfEverythingClient(t *testing.T) { } func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { - want := &abe.ExamplepbABitOfEverything{ + want := &abe.ExamplepbABitOfEverythingSansEnum{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: "4294967296", @@ -72,8 +72,13 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { Sint32Value: 2147483647, Sint64Value: "4611686018427387903", NonConventionalNameValue: "camelCase", + + Nested: []abe.ExamplepbABitOfEverythingSansEnumNested{}, + RepeatedStringValue: []string{}, + MappedStringValue: map[string]string{}, + MappedNestedValue: map[string]abe.ExamplepbABitOfEverythingSansEnumNested{}, } - resp, _, err := cl.Create( + resp, _, err := cl.CreateSansEnum( want.FloatValue, want.DoubleValue, want.Int64Value, @@ -103,10 +108,7 @@ func testABEClientCreate(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { } func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { - t.Log("TODO: support enum") - return - - want := abe.ExamplepbABitOfEverything{ + want := &abe.ExamplepbABitOfEverythingSansEnum{ FloatValue: 1.5, DoubleValue: 2.5, Int64Value: "4294967296", @@ -123,7 +125,7 @@ func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { Sint64Value: "4611686018427387903", NonConventionalNameValue: "camelCase", - Nested: []abe.ABitOfEverythingNested{ + Nested: []abe.ExamplepbABitOfEverythingSansEnumNested{ { Name: "bar", Amount: 10, @@ -135,20 +137,16 @@ func testABEClientCreateBody(t *testing.T, cl *abe.ABitOfEverythingServiceApi) { }, RepeatedStringValue: []string{"a", "b", "c"}, OneofString: "x", - MapValue: map[string]abe.ExamplepbNumericEnum{ - // "a": abe.ExamplepbNumericEnum_ONE, - // "b": abe.ExamplepbNumericEnum_ZERO, - }, MappedStringValue: map[string]string{ "a": "x", "b": "y", }, - MappedNestedValue: map[string]abe.ABitOfEverythingNested{ + MappedNestedValue: map[string]abe.ExamplepbABitOfEverythingSansEnumNested{ "a": {Name: "x", Amount: 1}, "b": {Name: "y", Amount: 2}, }, } - resp, _, err := cl.CreateBody(want) + resp, _, err := cl.CreateBodySansEnum(*want) if err != nil { t.Errorf("cl.CreateBody(%#v) failed with %v; want success", want, err) } diff --git a/examples/clients/abe/a_bit_of_everything_service_api.go b/examples/clients/abe/a_bit_of_everything_service_api.go index bc40897d864..ea4b78a8503 100644 --- a/examples/clients/abe/a_bit_of_everything_service_api.go +++ b/examples/clients/abe/a_bit_of_everything_service_api.go @@ -189,6 +189,157 @@ func (a ABitOfEverythingServiceApi) CreateBody(body ExamplepbABitOfEverything) ( return successPayload, localVarAPIResponse, err } +/** + * + * + * @param body + * @return *ExamplepbABitOfEverythingSansEnum + */ +func (a ABitOfEverythingServiceApi) CreateBodySansEnum(body ExamplepbABitOfEverythingSansEnum) (*ExamplepbABitOfEverythingSansEnum, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything_sans_enum" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(ExamplepbABitOfEverythingSansEnum) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CreateBodySansEnum", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * + * @param floatValue + * @param doubleValue + * @param int64Value + * @param uint64Value + * @param int32Value + * @param fixed64Value + * @param fixed32Value + * @param boolValue + * @param stringValue + * @param uint32Value + * @param sfixed32Value + * @param sfixed64Value + * @param sint32Value + * @param sint64Value + * @param nonConventionalNameValue + * @return *ExamplepbABitOfEverythingSansEnum + */ +func (a ABitOfEverythingServiceApi) CreateSansEnum(floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, uint32Value int64, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, nonConventionalNameValue string) (*ExamplepbABitOfEverythingSansEnum, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/v1/example/a_bit_of_everything_sans_enum/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" + localVarPath = strings.Replace(localVarPath, "{"+"float_value"+"}", fmt.Sprintf("%v", floatValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"double_value"+"}", fmt.Sprintf("%v", doubleValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int64_value"+"}", fmt.Sprintf("%v", int64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint64_value"+"}", fmt.Sprintf("%v", uint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"int32_value"+"}", fmt.Sprintf("%v", int32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed64_value"+"}", fmt.Sprintf("%v", fixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fixed32_value"+"}", fmt.Sprintf("%v", fixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"bool_value"+"}", fmt.Sprintf("%v", boolValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"string_value"+"}", fmt.Sprintf("%v", stringValue), -1) + localVarPath = strings.Replace(localVarPath, "{"+"uint32_value"+"}", fmt.Sprintf("%v", uint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed32_value"+"}", fmt.Sprintf("%v", sfixed32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sfixed64_value"+"}", fmt.Sprintf("%v", sfixed64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint32_value"+"}", fmt.Sprintf("%v", sint32Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"sint64_value"+"}", fmt.Sprintf("%v", sint64Value), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nonConventionalNameValue"+"}", fmt.Sprintf("%v", nonConventionalNameValue), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ "application/json", "application/x-foo-mime", } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + "application/json", + "application/x-foo-mime", + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + var successPayload = new(ExamplepbABitOfEverythingSansEnum) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "CreateSansEnum", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * * diff --git a/examples/clients/abe/examplepb_a_bit_of_everything.go b/examples/clients/abe/examplepb_a_bit_of_everything.go index 2f75b33f3f0..734233b096b 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything.go @@ -16,11 +16,11 @@ import ( type ExamplepbABitOfEverything struct { - SingleNested ABitOfEverythingNested `json:"singleNested,omitempty"` + SingleNested ExamplepbABitOfEverythingNested `json:"singleNested,omitempty"` Uuid string `json:"uuid,omitempty"` - Nested []ABitOfEverythingNested `json:"nested,omitempty"` + Nested []ExamplepbABitOfEverythingNested `json:"nested,omitempty"` FloatValue float32 `json:"floatValue,omitempty"` @@ -64,7 +64,7 @@ type ExamplepbABitOfEverything struct { MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` - MappedNestedValue map[string]ABitOfEverythingNested `json:"mappedNestedValue,omitempty"` + MappedNestedValue map[string]ExamplepbABitOfEverythingNested `json:"mappedNestedValue,omitempty"` NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` diff --git a/examples/clients/abe/a_bit_of_everything_nested.go b/examples/clients/abe/examplepb_a_bit_of_everything_nested.go similarity index 90% rename from examples/clients/abe/a_bit_of_everything_nested.go rename to examples/clients/abe/examplepb_a_bit_of_everything_nested.go index 095e8c5f118..4a59ed5b6ba 100644 --- a/examples/clients/abe/a_bit_of_everything_nested.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything_nested.go @@ -11,7 +11,7 @@ package abe // Nested is nested type. -type ABitOfEverythingNested struct { +type ExamplepbABitOfEverythingNested struct { // name is nested field. Name string `json:"name,omitempty"` diff --git a/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum.go b/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum.go new file mode 100644 index 00000000000..f1a9423e26c --- /dev/null +++ b/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum.go @@ -0,0 +1,68 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +import ( + "time" +) + +type ExamplepbABitOfEverythingSansEnum struct { + + SingleNested ExamplepbABitOfEverythingSansEnumNested `json:"singleNested,omitempty"` + + Uuid string `json:"uuid,omitempty"` + + Nested []ExamplepbABitOfEverythingSansEnumNested `json:"nested,omitempty"` + + FloatValue float32 `json:"floatValue,omitempty"` + + DoubleValue float64 `json:"doubleValue,omitempty"` + + Int64Value string `json:"int64Value,omitempty"` + + Uint64Value string `json:"uint64Value,omitempty"` + + Int32Value int32 `json:"int32Value,omitempty"` + + Fixed64Value string `json:"fixed64Value,omitempty"` + + Fixed32Value int64 `json:"fixed32Value,omitempty"` + + BoolValue bool `json:"boolValue,omitempty"` + + StringValue string `json:"stringValue,omitempty"` + + BytesValue string `json:"bytesValue,omitempty"` + + Uint32Value int64 `json:"uint32Value,omitempty"` + + Sfixed32Value int32 `json:"sfixed32Value,omitempty"` + + Sfixed64Value string `json:"sfixed64Value,omitempty"` + + Sint32Value int32 `json:"sint32Value,omitempty"` + + Sint64Value string `json:"sint64Value,omitempty"` + + RepeatedStringValue []string `json:"repeatedStringValue,omitempty"` + + OneofEmpty ProtobufEmpty `json:"oneofEmpty,omitempty"` + + OneofString string `json:"oneofString,omitempty"` + + MappedStringValue map[string]string `json:"mappedStringValue,omitempty"` + + MappedNestedValue map[string]ExamplepbABitOfEverythingSansEnumNested `json:"mappedNestedValue,omitempty"` + + NonConventionalNameValue string `json:"nonConventionalNameValue,omitempty"` + + TimestampValue time.Time `json:"timestampValue,omitempty"` +} diff --git a/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go b/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go new file mode 100644 index 00000000000..7570e52a05c --- /dev/null +++ b/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go @@ -0,0 +1,20 @@ +/* + * A Bit of Everything + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * OpenAPI spec version: 1.0 + * Contact: none@example.com + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package abe + +// Nested is nested type. +type ExamplepbABitOfEverythingSansEnumNested struct { + + // name is nested field. + Name string `json:"name,omitempty"` + + Amount int64 `json:"amount,omitempty"` +} diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index f8994b6b4a8..a35c0294f3a 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -436,6 +436,335 @@ func (m *ABitOfEverything_Nested) GetOk() ABitOfEverything_Nested_DeepEnum { return ABitOfEverything_Nested_FALSE } +type ABitOfEverythingSansEnum struct { + SingleNested *ABitOfEverythingSansEnum_Nested `protobuf:"bytes,25,opt,name=single_nested,json=singleNested" json:"single_nested,omitempty"` + Uuid string `protobuf:"bytes,1,opt,name=uuid" json:"uuid,omitempty"` + Nested []*ABitOfEverythingSansEnum_Nested `protobuf:"bytes,2,rep,name=nested" json:"nested,omitempty"` + FloatValue float32 `protobuf:"fixed32,3,opt,name=float_value,json=floatValue" json:"float_value,omitempty"` + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + Int64Value int64 `protobuf:"varint,5,opt,name=int64_value,json=int64Value" json:"int64_value,omitempty"` + Uint64Value uint64 `protobuf:"varint,6,opt,name=uint64_value,json=uint64Value" json:"uint64_value,omitempty"` + Int32Value int32 `protobuf:"varint,7,opt,name=int32_value,json=int32Value" json:"int32_value,omitempty"` + Fixed64Value uint64 `protobuf:"fixed64,8,opt,name=fixed64_value,json=fixed64Value" json:"fixed64_value,omitempty"` + Fixed32Value uint32 `protobuf:"fixed32,9,opt,name=fixed32_value,json=fixed32Value" json:"fixed32_value,omitempty"` + BoolValue bool `protobuf:"varint,10,opt,name=bool_value,json=boolValue" json:"bool_value,omitempty"` + StringValue string `protobuf:"bytes,11,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + BytesValue []byte `protobuf:"bytes,29,opt,name=bytes_value,json=bytesValue,proto3" json:"bytes_value,omitempty"` + Uint32Value uint32 `protobuf:"varint,13,opt,name=uint32_value,json=uint32Value" json:"uint32_value,omitempty"` + Sfixed32Value int32 `protobuf:"fixed32,15,opt,name=sfixed32_value,json=sfixed32Value" json:"sfixed32_value,omitempty"` + Sfixed64Value int64 `protobuf:"fixed64,16,opt,name=sfixed64_value,json=sfixed64Value" json:"sfixed64_value,omitempty"` + Sint32Value int32 `protobuf:"zigzag32,17,opt,name=sint32_value,json=sint32Value" json:"sint32_value,omitempty"` + Sint64Value int64 `protobuf:"zigzag64,18,opt,name=sint64_value,json=sint64Value" json:"sint64_value,omitempty"` + RepeatedStringValue []string `protobuf:"bytes,19,rep,name=repeated_string_value,json=repeatedStringValue" json:"repeated_string_value,omitempty"` + // Types that are valid to be assigned to OneofValue: + // *ABitOfEverythingSansEnum_OneofEmpty + // *ABitOfEverythingSansEnum_OneofString + OneofValue isABitOfEverythingSansEnum_OneofValue `protobuf_oneof:"oneof_value"` + MappedStringValue map[string]string `protobuf:"bytes,23,rep,name=mapped_string_value,json=mappedStringValue" json:"mapped_string_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + MappedNestedValue map[string]*ABitOfEverythingSansEnum_Nested `protobuf:"bytes,24,rep,name=mapped_nested_value,json=mappedNestedValue" json:"mapped_nested_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + NonConventionalNameValue string `protobuf:"bytes,26,opt,name=nonConventionalNameValue" json:"nonConventionalNameValue,omitempty"` + TimestampValue *google_protobuf3.Timestamp `protobuf:"bytes,27,opt,name=timestamp_value,json=timestampValue" json:"timestamp_value,omitempty"` +} + +func (m *ABitOfEverythingSansEnum) Reset() { *m = ABitOfEverythingSansEnum{} } +func (m *ABitOfEverythingSansEnum) String() string { return proto.CompactTextString(m) } +func (*ABitOfEverythingSansEnum) ProtoMessage() {} +func (*ABitOfEverythingSansEnum) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } + +type isABitOfEverythingSansEnum_OneofValue interface { + isABitOfEverythingSansEnum_OneofValue() +} + +type ABitOfEverythingSansEnum_OneofEmpty struct { + OneofEmpty *google_protobuf1.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,oneof"` +} +type ABitOfEverythingSansEnum_OneofString struct { + OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,oneof"` +} + +func (*ABitOfEverythingSansEnum_OneofEmpty) isABitOfEverythingSansEnum_OneofValue() {} +func (*ABitOfEverythingSansEnum_OneofString) isABitOfEverythingSansEnum_OneofValue() {} + +func (m *ABitOfEverythingSansEnum) GetOneofValue() isABitOfEverythingSansEnum_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetSingleNested() *ABitOfEverythingSansEnum_Nested { + if m != nil { + return m.SingleNested + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetUuid() string { + if m != nil { + return m.Uuid + } + return "" +} + +func (m *ABitOfEverythingSansEnum) GetNested() []*ABitOfEverythingSansEnum_Nested { + if m != nil { + return m.Nested + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetFloatValue() float32 { + if m != nil { + return m.FloatValue + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetDoubleValue() float64 { + if m != nil { + return m.DoubleValue + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetInt64Value() int64 { + if m != nil { + return m.Int64Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetUint64Value() uint64 { + if m != nil { + return m.Uint64Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetInt32Value() int32 { + if m != nil { + return m.Int32Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetFixed64Value() uint64 { + if m != nil { + return m.Fixed64Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetFixed32Value() uint32 { + if m != nil { + return m.Fixed32Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetBoolValue() bool { + if m != nil { + return m.BoolValue + } + return false +} + +func (m *ABitOfEverythingSansEnum) GetStringValue() string { + if m != nil { + return m.StringValue + } + return "" +} + +func (m *ABitOfEverythingSansEnum) GetBytesValue() []byte { + if m != nil { + return m.BytesValue + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetUint32Value() uint32 { + if m != nil { + return m.Uint32Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetSfixed32Value() int32 { + if m != nil { + return m.Sfixed32Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetSfixed64Value() int64 { + if m != nil { + return m.Sfixed64Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetSint32Value() int32 { + if m != nil { + return m.Sint32Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetSint64Value() int64 { + if m != nil { + return m.Sint64Value + } + return 0 +} + +func (m *ABitOfEverythingSansEnum) GetRepeatedStringValue() []string { + if m != nil { + return m.RepeatedStringValue + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetOneofEmpty() *google_protobuf1.Empty { + if x, ok := m.GetOneofValue().(*ABitOfEverythingSansEnum_OneofEmpty); ok { + return x.OneofEmpty + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetOneofString() string { + if x, ok := m.GetOneofValue().(*ABitOfEverythingSansEnum_OneofString); ok { + return x.OneofString + } + return "" +} + +func (m *ABitOfEverythingSansEnum) GetMappedStringValue() map[string]string { + if m != nil { + return m.MappedStringValue + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetMappedNestedValue() map[string]*ABitOfEverythingSansEnum_Nested { + if m != nil { + return m.MappedNestedValue + } + return nil +} + +func (m *ABitOfEverythingSansEnum) GetNonConventionalNameValue() string { + if m != nil { + return m.NonConventionalNameValue + } + return "" +} + +func (m *ABitOfEverythingSansEnum) GetTimestampValue() *google_protobuf3.Timestamp { + if m != nil { + return m.TimestampValue + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*ABitOfEverythingSansEnum) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _ABitOfEverythingSansEnum_OneofMarshaler, _ABitOfEverythingSansEnum_OneofUnmarshaler, _ABitOfEverythingSansEnum_OneofSizer, []interface{}{ + (*ABitOfEverythingSansEnum_OneofEmpty)(nil), + (*ABitOfEverythingSansEnum_OneofString)(nil), + } +} + +func _ABitOfEverythingSansEnum_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*ABitOfEverythingSansEnum) + // oneof_value + switch x := m.OneofValue.(type) { + case *ABitOfEverythingSansEnum_OneofEmpty: + b.EncodeVarint(20<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.OneofEmpty); err != nil { + return err + } + case *ABitOfEverythingSansEnum_OneofString: + b.EncodeVarint(21<<3 | proto.WireBytes) + b.EncodeStringBytes(x.OneofString) + case nil: + default: + return fmt.Errorf("ABitOfEverythingSansEnum.OneofValue has unexpected type %T", x) + } + return nil +} + +func _ABitOfEverythingSansEnum_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*ABitOfEverythingSansEnum) + switch tag { + case 20: // oneof_value.oneof_empty + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_protobuf1.Empty) + err := b.DecodeMessage(msg) + m.OneofValue = &ABitOfEverythingSansEnum_OneofEmpty{msg} + return true, err + case 21: // oneof_value.oneof_string + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.OneofValue = &ABitOfEverythingSansEnum_OneofString{x} + return true, err + default: + return false, nil + } +} + +func _ABitOfEverythingSansEnum_OneofSizer(msg proto.Message) (n int) { + m := msg.(*ABitOfEverythingSansEnum) + // oneof_value + switch x := m.OneofValue.(type) { + case *ABitOfEverythingSansEnum_OneofEmpty: + s := proto.Size(x.OneofEmpty) + n += proto.SizeVarint(20<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *ABitOfEverythingSansEnum_OneofString: + n += proto.SizeVarint(21<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.OneofString))) + n += len(x.OneofString) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Nested is nested type. +type ABitOfEverythingSansEnum_Nested struct { + // name is nested field. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"` +} + +func (m *ABitOfEverythingSansEnum_Nested) Reset() { *m = ABitOfEverythingSansEnum_Nested{} } +func (m *ABitOfEverythingSansEnum_Nested) String() string { return proto.CompactTextString(m) } +func (*ABitOfEverythingSansEnum_Nested) ProtoMessage() {} +func (*ABitOfEverythingSansEnum_Nested) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{1, 0} +} + +func (m *ABitOfEverythingSansEnum_Nested) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ABitOfEverythingSansEnum_Nested) GetAmount() uint32 { + if m != nil { + return m.Amount + } + return 0 +} + type Body struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } @@ -443,7 +772,7 @@ type Body struct { func (m *Body) Reset() { *m = Body{} } func (m *Body) String() string { return proto.CompactTextString(m) } func (*Body) ProtoMessage() {} -func (*Body) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +func (*Body) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } func (m *Body) GetName() string { if m != nil { @@ -460,7 +789,7 @@ type MessageWithBody struct { func (m *MessageWithBody) Reset() { *m = MessageWithBody{} } func (m *MessageWithBody) String() string { return proto.CompactTextString(m) } func (*MessageWithBody) ProtoMessage() {} -func (*MessageWithBody) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } +func (*MessageWithBody) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } func (m *MessageWithBody) GetId() string { if m != nil { @@ -479,6 +808,8 @@ func (m *MessageWithBody) GetData() *Body { func init() { proto.RegisterType((*ABitOfEverything)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything") proto.RegisterType((*ABitOfEverything_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverything.Nested") + proto.RegisterType((*ABitOfEverythingSansEnum)(nil), "grpc.gateway.examples.examplepb.ABitOfEverythingSansEnum") + proto.RegisterType((*ABitOfEverythingSansEnum_Nested)(nil), "grpc.gateway.examples.examplepb.ABitOfEverythingSansEnum.Nested") proto.RegisterType((*Body)(nil), "grpc.gateway.examples.examplepb.Body") proto.RegisterType((*MessageWithBody)(nil), "grpc.gateway.examples.examplepb.MessageWithBody") proto.RegisterEnum("grpc.gateway.examples.examplepb.NumericEnum", NumericEnum_name, NumericEnum_value) @@ -498,6 +829,8 @@ const _ = grpc.SupportPackageIsVersion4 type ABitOfEverythingServiceClient interface { Create(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) CreateBody(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*ABitOfEverything, error) + CreateSansEnum(ctx context.Context, in *ABitOfEverythingSansEnum, opts ...grpc.CallOption) (*ABitOfEverythingSansEnum, error) + CreateBodySansEnum(ctx context.Context, in *ABitOfEverythingSansEnum, opts ...grpc.CallOption) (*ABitOfEverythingSansEnum, error) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) Update(ctx context.Context, in *ABitOfEverything, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) Delete(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) @@ -544,6 +877,24 @@ func (c *aBitOfEverythingServiceClient) CreateBody(ctx context.Context, in *ABit return out, nil } +func (c *aBitOfEverythingServiceClient) CreateSansEnum(ctx context.Context, in *ABitOfEverythingSansEnum, opts ...grpc.CallOption) (*ABitOfEverythingSansEnum, error) { + out := new(ABitOfEverythingSansEnum) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateSansEnum", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *aBitOfEverythingServiceClient) CreateBodySansEnum(ctx context.Context, in *ABitOfEverythingSansEnum, opts ...grpc.CallOption) (*ABitOfEverythingSansEnum, error) { + out := new(ABitOfEverythingSansEnum) + err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBodySansEnum", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *aBitOfEverythingServiceClient) Lookup(ctx context.Context, in *sub2.IdMessage, opts ...grpc.CallOption) (*ABitOfEverything, error) { out := new(ABitOfEverything) err := grpc.Invoke(ctx, "/grpc.gateway.examples.examplepb.ABitOfEverythingService/Lookup", in, out, c.cc, opts...) @@ -648,6 +999,8 @@ func (c *aBitOfEverythingServiceClient) PostWithEmptyBody(ctx context.Context, i type ABitOfEverythingServiceServer interface { Create(context.Context, *ABitOfEverything) (*ABitOfEverything, error) CreateBody(context.Context, *ABitOfEverything) (*ABitOfEverything, error) + CreateSansEnum(context.Context, *ABitOfEverythingSansEnum) (*ABitOfEverythingSansEnum, error) + CreateBodySansEnum(context.Context, *ABitOfEverythingSansEnum) (*ABitOfEverythingSansEnum, error) Lookup(context.Context, *sub2.IdMessage) (*ABitOfEverything, error) Update(context.Context, *ABitOfEverything) (*google_protobuf1.Empty, error) Delete(context.Context, *sub2.IdMessage) (*google_protobuf1.Empty, error) @@ -708,6 +1061,42 @@ func _ABitOfEverythingService_CreateBody_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } +func _ABitOfEverythingService_CreateSansEnum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverythingSansEnum) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CreateSansEnum(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateSansEnum", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CreateSansEnum(ctx, req.(*ABitOfEverythingSansEnum)) + } + return interceptor(ctx, in, info, handler) +} + +func _ABitOfEverythingService_CreateBodySansEnum_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ABitOfEverythingSansEnum) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ABitOfEverythingServiceServer).CreateBodySansEnum(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/grpc.gateway.examples.examplepb.ABitOfEverythingService/CreateBodySansEnum", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ABitOfEverythingServiceServer).CreateBodySansEnum(ctx, req.(*ABitOfEverythingSansEnum)) + } + return interceptor(ctx, in, info, handler) +} + func _ABitOfEverythingService_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(sub2.IdMessage) if err := dec(in); err != nil { @@ -918,6 +1307,14 @@ var _ABitOfEverythingService_serviceDesc = grpc.ServiceDesc{ MethodName: "CreateBody", Handler: _ABitOfEverythingService_CreateBody_Handler, }, + { + MethodName: "CreateSansEnum", + Handler: _ABitOfEverythingService_CreateSansEnum_Handler, + }, + { + MethodName: "CreateBodySansEnum", + Handler: _ABitOfEverythingService_CreateBodySansEnum_Handler, + }, { MethodName: "Lookup", Handler: _ABitOfEverythingService_Lookup_Handler, @@ -1034,115 +1431,127 @@ var _AnotherServiceWithNoBindings_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("examples/examplepb/a_bit_of_everything.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x6f, 0x1b, 0xc7, - 0x11, 0xd7, 0x1e, 0x65, 0x5a, 0x1c, 0xea, 0x0f, 0xb5, 0xb2, 0x65, 0x9a, 0x56, 0xa2, 0x35, 0xe3, - 0xb4, 0x57, 0xd5, 0xba, 0x8b, 0xe9, 0xa0, 0x88, 0x05, 0xb4, 0x29, 0x65, 0xd1, 0x76, 0xd0, 0x58, - 0xb6, 0xcf, 0x89, 0x6b, 0xb8, 0x4e, 0x85, 0x23, 0x6f, 0x49, 0x5e, 0xcc, 0xbb, 0xbd, 0xde, 0xed, - 0xc9, 0x22, 0x58, 0xf5, 0xa1, 0x05, 0x5a, 0xe4, 0x55, 0x7d, 0xeb, 0x43, 0x5e, 0x0a, 0x14, 0x2d, - 0xd0, 0x3e, 0xf6, 0xa9, 0x40, 0xfb, 0xd2, 0x6f, 0xd0, 0x4f, 0x50, 0x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f, 0xbb, 0x9d, 0x58, 0xa0, 0x28, 0xe3, 0x5f, 0x8c, 0xf6, 0x52, - 0xb2, 0xcd, 0x3e, 0xa7, 0x41, 0x2c, 0xf1, 0x0e, 0x41, 0xea, 0xa2, 0x01, 0x72, 0x6b, 0xc8, 0xe1, - 0x94, 0xc6, 0x12, 0x41, 0xea, 0x52, 0xe4, 0x70, 0xc2, 0xe2, 0x27, 0x00, 0xd4, 0x0d, 0x9d, 0x58, - 0x60, 0x99, 0x20, 0x75, 0xb9, 0x76, 0x73, 0xea, 0x75, 0xee, 0x87, 0x0e, 0xf5, 0xed, 0x56, 0xc3, - 0x0d, 0x1d, 0xa3, 0x20, 0xf4, 0x23, 0xb0, 0xf7, 0x61, 0x39, 0x18, 0x76, 0x7c, 0x85, 0x20, 0x75, - 0xc5, 0x58, 0x0a, 0x86, 0x3c, 0x4f, 0xc5, 0xd2, 0x20, 0x96, 0x08, 0x52, 0x4b, 0x89, 0x58, 0xe6, - 0xba, 0x82, 0x2c, 0xfb, 0x55, 0x82, 0xd4, 0x55, 0xa3, 0x18, 0x64, 0xd8, 0xc7, 0x22, 0x29, 0x0e, - 0x26, 0x48, 0xc5, 0x91, 0x48, 0x82, 0x52, 0x83, 0xcb, 0x3e, 0xf5, 0xa8, 0xc9, 0xa9, 0x75, 0x30, - 0x14, 0xd0, 0x35, 0x92, 0x53, 0x0b, 0xc6, 0x5a, 0x72, 0xf8, 0x34, 0x13, 0xd8, 0x3b, 0x50, 0x64, - 0x2e, 0x15, 0x5d, 0x48, 0x34, 0x89, 0xf2, 0x25, 0x59, 0x50, 0xeb, 0x5a, 0x54, 0xcc, 0x5a, 0x52, - 0xcc, 0x5a, 0x43, 0x9c, 0x3e, 0x98, 0x33, 0x40, 0x0a, 0xcb, 0x15, 0x7e, 0x0f, 0x16, 0x23, 0xd5, - 0xc8, 0x56, 0xf9, 0xb2, 0xb8, 0xb6, 0x07, 0x73, 0x46, 0x04, 0x18, 0x19, 0xc1, 0x2f, 0x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 0x13, 0xb8, 0xf2, - 0xf0, 0x4d, 0xfc, 0xb3, 0x2e, 0xcc, 0x4a, 0xfd, 0x45, 0x21, 0xcd, 0xcd, 0x66, 0x5e, 0x46, 0xef, - 0xf6, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x74, 0xcd, 0x98, 0xea, 0x14, 0x00, 0x00, + // 1949 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xdb, 0x6f, 0xdb, 0xd6, + 0x19, 0xf7, 0x91, 0x1c, 0xc5, 0xfe, 0xe4, 0x8b, 0x7c, 0x9c, 0x38, 0x8a, 0xe2, 0xd6, 0x27, 0x6c, + 0xba, 0xb1, 0x5e, 0x4c, 0x36, 0x4a, 0x30, 0x34, 0x06, 0xb6, 0x56, 0x8e, 0xd5, 0xa4, 0x58, 0xe3, + 0x38, 0x4c, 0x9b, 0x05, 0x59, 0x3a, 0x83, 0x12, 0x8f, 0x25, 0x36, 0x22, 0x0f, 0xc7, 0x73, 0xe8, + 0x58, 0xf0, 0x3c, 0x0c, 0x2b, 0xd0, 0x6d, 0xaf, 0xde, 0xdb, 0x1e, 0xfa, 0x32, 0x60, 0xd8, 0x30, + 0x14, 0xd8, 0xcb, 0xb0, 0x87, 0x01, 0x5b, 0xdf, 0xf6, 0x07, 0xec, 0x2f, 0x18, 0xb0, 0xa7, 0xfd, + 0x15, 0x03, 0x0f, 0x2f, 0xa6, 0x64, 0x6b, 0xb2, 0xec, 0xa2, 0x45, 0x81, 0x3c, 0x99, 0x3c, 0xe7, + 0xbb, 0xfc, 0xbe, 0xfb, 0x47, 0x19, 0xae, 0xd3, 0x5d, 0xd3, 0xf1, 0x3a, 0x94, 0xeb, 0xf1, 0x83, + 0xd7, 0xd0, 0xcd, 0xad, 0x86, 0x2d, 0xb6, 0xd8, 0xf6, 0x16, 0xdd, 0xa1, 0x7e, 0x57, 0xb4, 0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x67, 0xd2, 0x15, 0xcb, 0xc1, 0x4b, 0x50, 0xdc, 0xee, 0x30, 0x53, 0x6c, + 0xed, 0x98, 0x9d, 0x80, 0x96, 0xf3, 0x04, 0xa9, 0x39, 0x03, 0xe4, 0xd1, 0xe3, 0xf0, 0x04, 0x5f, + 0x85, 0x29, 0x8b, 0x05, 0x8d, 0x0e, 0x8d, 0x29, 0xc6, 0x09, 0x52, 0x91, 0x51, 0x8c, 0xce, 0x22, + 0x92, 0x25, 0x28, 0xda, 0xae, 0xf8, 0xee, 0xad, 0x98, 0xe2, 0x1c, 0x41, 0x6a, 0xde, 0x00, 0x79, + 0x94, 0xca, 0x08, 0xb2, 0x14, 0x05, 0x82, 0xd4, 0x71, 0xa3, 0x18, 0x64, 0x48, 0x22, 0x19, 0x37, + 0xab, 0x31, 0xc5, 0x79, 0x82, 0xd4, 0x73, 0x52, 0xc6, 0xcd, 0x6a, 0x44, 0xf0, 0x1a, 0x4c, 0x6f, + 0xdb, 0xbb, 0xd4, 0x4a, 0x85, 0x4c, 0x10, 0xa4, 0x16, 0x8c, 0xa9, 0xf8, 0xb0, 0x97, 0x28, 0x95, + 0x33, 0x49, 0x90, 0x7a, 0x3e, 0x26, 0x4a, 0x24, 0xbd, 0x02, 0xd0, 0x60, 0xac, 0x13, 0x53, 0x00, + 0x41, 0xea, 0x84, 0x31, 0x19, 0x9e, 0xa4, 0x60, 0xb9, 0xf0, 0x6d, 0xb7, 0x15, 0x13, 0x14, 0xa5, + 0xff, 0x8b, 0xd1, 0x59, 0x0a, 0xb6, 0xd1, 0x15, 0x94, 0xc7, 0x14, 0xaf, 0x10, 0xa4, 0x4e, 0x19, + 0x20, 0x8f, 0x7a, 0x0c, 0x4e, 0x61, 0x4c, 0x13, 0xa4, 0x4e, 0x47, 0x06, 0x27, 0x28, 0x7e, 0x00, + 0x40, 0xdd, 0xc0, 0x89, 0x09, 0x66, 0x08, 0x52, 0x67, 0xaa, 0xd7, 0x87, 0x86, 0x73, 0x23, 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xa4, 0xc9, 0x9c, 0xf0, 0xe5, 0x6a, 0xe5, 0x21, + 0x2c, 0x1d, 0xd7, 0x0b, 0xc3, 0x32, 0x4a, 0xd6, 0xf7, 0x11, 0x2b, 0xbe, 0xfa, 0x63, 0x58, 0xac, + 0xb9, 0x4c, 0xb4, 0xa9, 0x1f, 0x4b, 0x08, 0x1d, 0x9a, 0x49, 0xf4, 0xef, 0xf7, 0xa4, 0xfd, 0xa8, + 0x59, 0x35, 0xb6, 0xf6, 0xc7, 0xdc, 0x41, 0xed, 0xb7, 0x39, 0x2c, 0x60, 0xbe, 0x46, 0xd6, 0x6c, + 0x11, 0x1a, 0x98, 0xa9, 0xca, 0x27, 0x70, 0xa1, 0x65, 0x6c, 0xde, 0x59, 0xb9, 0x1b, 0xa1, 0x21, + 0x9e, 0xcf, 0x3e, 0xa6, 0x4d, 0x31, 0xaa, 0x15, 0x95, 0x92, 0xcb, 0x5c, 0xfa, 0x4e, 0x1c, 0xb1, + 0x90, 0xba, 0x9a, 0xbf, 0xa1, 0xbd, 0xb9, 0x9c, 0x47, 0xb9, 0xf1, 0x6a, 0xc9, 0xf4, 0xbc, 0x8e, + 0xdd, 0x94, 0xae, 0xd4, 0x3f, 0xe6, 0xcc, 0xad, 0x2e, 0x64, 0x4f, 0x76, 0x57, 0xb6, 0x19, 0x5b, + 0x71, 0x6c, 0x87, 0xae, 0x1e, 0xa1, 0x5c, 0x1d, 0x40, 0xe9, 0xbf, 0x07, 0x97, 0xee, 0x1f, 0xfa, + 0x3f, 0x6b, 0xc2, 0xa8, 0xd0, 0x9f, 0x4e, 0xa6, 0xb9, 0xd9, 0x28, 0x48, 0xef, 0xdd, 0xfc, 0x5f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xd3, 0x19, 0x0c, 0xdc, 0x1d, 0x00, 0x00, } diff --git a/examples/examplepb/a_bit_of_everything.pb.gw.go b/examples/examplepb/a_bit_of_everything.pb.gw.go index b2f40a3f04e..8a37dbcd422 100644 --- a/examples/examplepb/a_bit_of_everything.pb.gw.go +++ b/examples/examplepb/a_bit_of_everything.pb.gw.go @@ -235,6 +235,210 @@ func request_ABitOfEverythingService_CreateBody_0(ctx context.Context, marshaler } +var ( + filter_ABitOfEverythingService_CreateSansEnum_0 = &utilities.DoubleArray{Encoding: map[string]int{"float_value": 0, "double_value": 1, "int64_value": 2, "uint64_value": 3, "int32_value": 4, "fixed64_value": 5, "fixed32_value": 6, "bool_value": 7, "string_value": 8, "uint32_value": 9, "sfixed32_value": 10, "sfixed64_value": 11, "sint32_value": 12, "sint64_value": 13, "nonConventionalNameValue": 14}, Base: []int{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, Check: []int{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}} +) + +func request_ABitOfEverythingService_CreateSansEnum_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverythingSansEnum + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["float_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "float_value") + } + + protoReq.FloatValue, err = runtime.Float32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "float_value", err) + } + + val, ok = pathParams["double_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "double_value") + } + + protoReq.DoubleValue, err = runtime.Float64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "double_value", err) + } + + val, ok = pathParams["int64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int64_value") + } + + protoReq.Int64Value, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int64_value", err) + } + + val, ok = pathParams["uint64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint64_value") + } + + protoReq.Uint64Value, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint64_value", err) + } + + val, ok = pathParams["int32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "int32_value") + } + + protoReq.Int32Value, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "int32_value", err) + } + + val, ok = pathParams["fixed64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed64_value") + } + + protoReq.Fixed64Value, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed64_value", err) + } + + val, ok = pathParams["fixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value") + } + + protoReq.Fixed32Value, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "fixed32_value", err) + } + + val, ok = pathParams["bool_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value") + } + + protoReq.BoolValue, err = runtime.Bool(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "bool_value", err) + } + + val, ok = pathParams["string_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value") + } + + protoReq.StringValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "string_value", err) + } + + val, ok = pathParams["uint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value") + } + + protoReq.Uint32Value, err = runtime.Uint32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uint32_value", err) + } + + val, ok = pathParams["sfixed32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value") + } + + protoReq.Sfixed32Value, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed32_value", err) + } + + val, ok = pathParams["sfixed64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value") + } + + protoReq.Sfixed64Value, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sfixed64_value", err) + } + + val, ok = pathParams["sint32_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint32_value") + } + + protoReq.Sint32Value, err = runtime.Int32(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint32_value", err) + } + + val, ok = pathParams["sint64_value"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sint64_value") + } + + protoReq.Sint64Value, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sint64_value", err) + } + + val, ok = pathParams["nonConventionalNameValue"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nonConventionalNameValue") + } + + protoReq.NonConventionalNameValue, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nonConventionalNameValue", err) + } + + if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_ABitOfEverythingService_CreateSansEnum_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateSansEnum(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func request_ABitOfEverythingService_CreateBodySansEnum_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ABitOfEverythingSansEnum + var metadata runtime.ServerMetadata + + if req.ContentLength > 0 { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + } + + msg, err := client.CreateBodySansEnum(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + func request_ABitOfEverythingService_Lookup_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq sub2.IdMessage var metadata runtime.ServerMetadata @@ -629,6 +833,64 @@ func RegisterABitOfEverythingServiceHandlerClient(ctx context.Context, mux *runt }) + mux.Handle("POST", pattern_ABitOfEverythingService_CreateSansEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_CreateSansEnum_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CreateSansEnum_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_ABitOfEverythingService_CreateBodySansEnum_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ABitOfEverythingService_CreateBodySansEnum_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ABitOfEverythingService_CreateBodySansEnum_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_ABitOfEverythingService_Lookup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -985,6 +1247,10 @@ var ( pattern_ABitOfEverythingService_CreateBody_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything"}, "")) + pattern_ABitOfEverythingService_CreateSansEnum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 1, 0, 4, 1, 5, 8, 1, 0, 4, 1, 5, 9, 1, 0, 4, 1, 5, 10, 1, 0, 4, 1, 5, 11, 2, 12, 1, 0, 4, 2, 5, 13, 1, 0, 4, 1, 5, 14, 1, 0, 4, 1, 5, 15, 1, 0, 4, 1, 5, 16, 1, 0, 4, 1, 5, 17, 1, 0, 4, 1, 5, 18, 1, 0, 4, 1, 5, 19}, []string{"v1", "example", "a_bit_of_everything_sans_enum", "float_value", "double_value", "int64_value", "separator", "uint64_value", "int32_value", "fixed64_value", "fixed32_value", "bool_value", "strprefix", "string_value", "uint32_value", "sfixed32_value", "sfixed64_value", "sint32_value", "sint64_value", "nonConventionalNameValue"}, "")) + + pattern_ABitOfEverythingService_CreateBodySansEnum_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "example", "a_bit_of_everything_sans_enum"}, "")) + pattern_ABitOfEverythingService_Lookup_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) pattern_ABitOfEverythingService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "example", "a_bit_of_everything", "uuid"}, "")) @@ -1015,6 +1281,10 @@ var ( forward_ABitOfEverythingService_CreateBody_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_CreateSansEnum_0 = runtime.ForwardResponseMessage + + forward_ABitOfEverythingService_CreateBodySansEnum_0 = runtime.ForwardResponseMessage + forward_ABitOfEverythingService_Lookup_0 = runtime.ForwardResponseMessage forward_ABitOfEverythingService_Update_0 = runtime.ForwardResponseMessage diff --git a/examples/examplepb/a_bit_of_everything.proto b/examples/examplepb/a_bit_of_everything.proto index 40280c7e124..30d96a9529c 100644 --- a/examples/examplepb/a_bit_of_everything.proto +++ b/examples/examplepb/a_bit_of_everything.proto @@ -97,6 +97,45 @@ message ABitOfEverything { repeated NumericEnum repeated_enum_value = 28; } +message ABitOfEverythingSansEnum { + + message Nested { + string name = 1; + uint32 amount = 2; + } + Nested single_nested = 25; + + string uuid = 1; + repeated Nested nested = 2; + float float_value = 3; + double double_value = 4; + int64 int64_value = 5; + uint64 uint64_value = 6; + int32 int32_value = 7; + fixed64 fixed64_value = 8; + fixed32 fixed32_value = 9; + bool bool_value = 10; + string string_value = 11; + bytes bytes_value = 29; + uint32 uint32_value = 13; + sfixed32 sfixed32_value = 15; + sfixed64 sfixed64_value = 16; + sint32 sint32_value = 17; + sint64 sint64_value = 18; + repeated string repeated_string_value = 19; + oneof oneof_value { + google.protobuf.Empty oneof_empty = 20; + string oneof_string = 21; + } + + map mapped_string_value = 23; + map mapped_nested_value = 24; + + string nonConventionalNameValue = 26; + + google.protobuf.Timestamp timestamp_value = 27; +} + message Body { string name = 1; } @@ -139,6 +178,17 @@ service ABitOfEverythingService { body: "*" }; } + rpc CreateSansEnum(ABitOfEverythingSansEnum) returns (ABitOfEverythingSansEnum) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything_sans_enum/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}" + }; + } + rpc CreateBodySansEnum(ABitOfEverythingSansEnum) returns (ABitOfEverythingSansEnum) { + option (google.api.http) = { + post: "/v1/example/a_bit_of_everything_sans_enum" + body: "*" + }; + } rpc Lookup(sub2.IdMessage) returns (ABitOfEverything) { option (google.api.http) = { get: "/v1/example/a_bit_of_everything/{uuid}" diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 0c038162072..992f61c4a7c 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -522,6 +522,153 @@ ] } }, + "/v1/example/a_bit_of_everything_sans_enum": { + "post": { + "operationId": "CreateBodySansEnum", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverythingSansEnum" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/examplepbABitOfEverythingSansEnum" + } + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, + "/v1/example/a_bit_of_everything_sans_enum/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}": { + "post": { + "operationId": "CreateSansEnum", + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/examplepbABitOfEverythingSansEnum" + } + } + }, + "parameters": [ + { + "name": "float_value", + "in": "path", + "required": true, + "type": "number", + "format": "float" + }, + { + "name": "double_value", + "in": "path", + "required": true, + "type": "number", + "format": "double" + }, + { + "name": "int64_value", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + }, + { + "name": "uint64_value", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "int32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int32" + }, + { + "name": "fixed64_value", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "fixed32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "bool_value", + "in": "path", + "required": true, + "type": "boolean", + "format": "boolean" + }, + { + "name": "string_value", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "uint32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "sfixed32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int32" + }, + { + "name": "sfixed64_value", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + }, + { + "name": "sint32_value", + "in": "path", + "required": true, + "type": "integer", + "format": "int32" + }, + { + "name": "sint64_value", + "in": "path", + "required": true, + "type": "string", + "format": "int64" + }, + { + "name": "nonConventionalNameValue", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ABitOfEverythingService" + ] + } + }, "/v2/example/echo": { "get": { "summary": "Summary: Echo rpc", @@ -682,23 +829,6 @@ } }, "definitions": { - "ABitOfEverythingNested": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "name is nested field." - }, - "amount": { - "type": "integer", - "format": "int64" - }, - "ok": { - "$ref": "#/definitions/NestedDeepEnum" - } - }, - "description": "Nested is nested type." - }, "NestedDeepEnum": { "type": "string", "enum": [ @@ -712,7 +842,7 @@ "type": "object", "properties": { "singleNested": { - "$ref": "#/definitions/ABitOfEverythingNested" + "$ref": "#/definitions/examplepbABitOfEverythingNested" }, "uuid": { "type": "string" @@ -720,7 +850,7 @@ "nested": { "type": "array", "items": { - "$ref": "#/definitions/ABitOfEverythingNested" + "$ref": "#/definitions/examplepbABitOfEverythingNested" } }, "floatValue": { @@ -812,7 +942,7 @@ "mappedNestedValue": { "type": "object", "additionalProperties": { - "$ref": "#/definitions/ABitOfEverythingNested" + "$ref": "#/definitions/examplepbABitOfEverythingNested" } }, "nonConventionalNameValue": { @@ -836,6 +966,144 @@ "url": "https://github.com/grpc-ecosystem/grpc-gateway" } }, + "examplepbABitOfEverythingNested": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name is nested field." + }, + "amount": { + "type": "integer", + "format": "int64" + }, + "ok": { + "$ref": "#/definitions/NestedDeepEnum" + } + }, + "description": "Nested is nested type." + }, + "examplepbABitOfEverythingSansEnum": { + "type": "object", + "properties": { + "singleNested": { + "$ref": "#/definitions/examplepbABitOfEverythingSansEnumNested" + }, + "uuid": { + "type": "string" + }, + "nested": { + "type": "array", + "items": { + "$ref": "#/definitions/examplepbABitOfEverythingSansEnumNested" + } + }, + "floatValue": { + "type": "number", + "format": "float" + }, + "doubleValue": { + "type": "number", + "format": "double" + }, + "int64Value": { + "type": "string", + "format": "int64" + }, + "uint64Value": { + "type": "string", + "format": "uint64" + }, + "int32Value": { + "type": "integer", + "format": "int32" + }, + "fixed64Value": { + "type": "string", + "format": "uint64" + }, + "fixed32Value": { + "type": "integer", + "format": "int64" + }, + "boolValue": { + "type": "boolean", + "format": "boolean" + }, + "stringValue": { + "type": "string" + }, + "bytesValue": { + "type": "string", + "format": "byte" + }, + "uint32Value": { + "type": "integer", + "format": "int64" + }, + "sfixed32Value": { + "type": "integer", + "format": "int32" + }, + "sfixed64Value": { + "type": "string", + "format": "int64" + }, + "sint32Value": { + "type": "integer", + "format": "int32" + }, + "sint64Value": { + "type": "string", + "format": "int64" + }, + "repeatedStringValue": { + "type": "array", + "items": { + "type": "string" + } + }, + "oneofEmpty": { + "$ref": "#/definitions/protobufEmpty" + }, + "oneofString": { + "type": "string" + }, + "mappedStringValue": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "mappedNestedValue": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/examplepbABitOfEverythingSansEnumNested" + } + }, + "nonConventionalNameValue": { + "type": "string" + }, + "timestampValue": { + "type": "string", + "format": "date-time" + } + } + }, + "examplepbABitOfEverythingSansEnumNested": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "name is nested field." + }, + "amount": { + "type": "integer", + "format": "int64" + } + }, + "description": "Nested is nested type." + }, "examplepbBody": { "type": "object", "properties": { diff --git a/examples/examplepb/echo_service.pb.go b/examples/examplepb/echo_service.pb.go index 0cca760395b..b169d13b0ee 100644 --- a/examples/examplepb/echo_service.pb.go +++ b/examples/examplepb/echo_service.pb.go @@ -18,6 +18,7 @@ It is generated from these files: It has these top-level messages: SimpleMessage ABitOfEverything + ABitOfEverythingSansEnum Body MessageWithBody EmptyProto diff --git a/examples/integration_test.go b/examples/integration_test.go index 2d658d12623..c8e1710bc96 100644 --- a/examples/integration_test.go +++ b/examples/integration_test.go @@ -177,6 +177,13 @@ func testABECreate(t *testing.T, port int) { Sint32Value: 2147483647, Sint64Value: 4611686018427387903, NonConventionalNameValue: "camelCase", + + Nested: []*gw.ABitOfEverything_Nested{}, + RepeatedStringValue: []string{}, + MapValue: map[string]gw.NumericEnum{}, + MappedStringValue: map[string]string{}, + MappedNestedValue: map[string]*gw.ABitOfEverything_Nested{}, + RepeatedEnumValue: []gw.NumericEnum{}, } url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything/%f/%f/%d/separator/%d/%d/%d/%d/%v/%s/%d/%d/%d/%d/%d/%s", port, want.FloatValue, want.DoubleValue, want.Int64Value, want.Uint64Value, want.Int32Value, want.Fixed64Value, want.Fixed32Value, want.BoolValue, want.StringValue, want.Uint32Value, want.Sfixed32Value, want.Sfixed64Value, want.Sint32Value, want.Sint64Value, want.NonConventionalNameValue) @@ -207,7 +214,7 @@ func testABECreate(t *testing.T, port int) { } msg.Uuid = "" if got := msg; !reflect.DeepEqual(got, want) { - t.Errorf("msg= %v; want %v", &got, &want) + t.Errorf("msg= %#v; want %#v", &got, &want) } } @@ -255,6 +262,8 @@ func testABECreateBody(t *testing.T, port int) { "a": {Name: "x", Amount: 1}, "b": {Name: "y", Amount: 2}, }, + + RepeatedEnumValue: []gw.NumericEnum{}, } url := fmt.Sprintf("http://localhost:%d/v1/example/a_bit_of_everything", port) var m jsonpb.Marshaler @@ -290,7 +299,7 @@ func testABECreateBody(t *testing.T, port int) { } msg.Uuid = "" if got := msg; !reflect.DeepEqual(got, want) { - t.Errorf("msg= %v; want %v", &got, &want) + t.Errorf("msg= %#v; want %#v", &got, &want) } } diff --git a/examples/main_test.go b/examples/main_test.go index 122afeb0ce1..fa9ef7b65cc 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -7,8 +7,7 @@ import ( "testing" "time" - server "github.com/grpc-ecosystem/grpc-gateway/examples/server" - "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/examples/server" ) func runServers() <-chan error { @@ -19,7 +18,7 @@ func runServers() <-chan error { } }() go func() { - if err := Run(":8080", runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: false})); err != nil { + if err := Run(":8080"); err != nil { ch <- fmt.Errorf("cannot run gateway service: %v", err) } }() diff --git a/examples/server/a_bit_of_everything.go b/examples/server/a_bit_of_everything.go index e29e0fa1757..ee45964e047 100644 --- a/examples/server/a_bit_of_everything.go +++ b/examples/server/a_bit_of_everything.go @@ -26,8 +26,9 @@ import ( var uuidgen = fastuuid.MustNewGenerator() type _ABitOfEverythingServer struct { - v map[string]*examples.ABitOfEverything - m sync.Mutex + v map[string]*examples.ABitOfEverything + v2 map[string]*examples.ABitOfEverythingSansEnum + m sync.Mutex } type ABitOfEverythingServer interface { @@ -37,7 +38,8 @@ type ABitOfEverythingServer interface { func newABitOfEverythingServer() ABitOfEverythingServer { return &_ABitOfEverythingServer{ - v: make(map[string]*examples.ABitOfEverything), + v: make(map[string]*examples.ABitOfEverything), + v2: make(map[string]*examples.ABitOfEverythingSansEnum), } } @@ -63,6 +65,28 @@ func (s *_ABitOfEverythingServer) CreateBody(ctx context.Context, msg *examples. return s.Create(ctx, msg) } +func (s *_ABitOfEverythingServer) CreateSansEnum(ctx context.Context, msg *examples.ABitOfEverythingSansEnum) (*examples.ABitOfEverythingSansEnum, error) { + s.m.Lock() + defer s.m.Unlock() + + glog.Info(msg) + var uuid string + for { + uuid = fmt.Sprintf("%x", uuidgen.Next()) + if _, ok := s.v[uuid]; !ok { + break + } + } + s.v2[uuid] = msg + s.v2[uuid].Uuid = uuid + glog.Infof("%v", s.v2[uuid]) + return s.v2[uuid], nil +} + +func (s *_ABitOfEverythingServer) CreateBodySansEnum(ctx context.Context, msg *examples.ABitOfEverythingSansEnum) (*examples.ABitOfEverythingSansEnum, error) { + return s.CreateSansEnum(ctx, msg) +} + func (s *_ABitOfEverythingServer) BulkCreate(stream examples.StreamService_BulkCreateServer) error { count := 0 ctx := stream.Context() diff --git a/runtime/marshaler_registry.go b/runtime/marshaler_registry.go index 928f0733214..ca10e22f83e 100644 --- a/runtime/marshaler_registry.go +++ b/runtime/marshaler_registry.go @@ -13,7 +13,7 @@ var ( acceptHeader = http.CanonicalHeaderKey("Accept") contentTypeHeader = http.CanonicalHeaderKey("Content-Type") - defaultMarshaler = &JSONPb{OrigName: true} + defaultMarshaler = &JSONPb{OrigName: false, EmitDefaults: true} ) // MarshalerForRequest returns the inbound/outbound marshalers for this request. From 900eae94be4ab51f723b8926f97b1e71f373f775 Mon Sep 17 00:00:00 2001 From: Alex Leigh Date: Thu, 8 Feb 2018 22:32:32 -0800 Subject: [PATCH 3/4] Fix browser specs. --- .../a_bit_of_everything_service.spec.js | 84 +++++++++++++------ examples/browser/echo_service.spec.js | 4 +- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/examples/browser/a_bit_of_everything_service.spec.js b/examples/browser/a_bit_of_everything_service.spec.js index edcbebe11d6..ec0e9da775b 100644 --- a/examples/browser/a_bit_of_everything_service.spec.js +++ b/examples/browser/a_bit_of_everything_service.spec.js @@ -18,7 +18,7 @@ describe('ABitOfEverythingService', function() { describe('Create', function() { var created; - var expected = { + var params = { float_value: 1.5, double_value: 2.5, int64_value: "4294967296", @@ -35,9 +35,37 @@ describe('ABitOfEverythingService', function() { sint64_value: "4611686018427387903", nonConventionalNameValue: "camelCase", }; + var expected = { + floatValue: 1.5, + doubleValue: 2.5, + int64Value: "4294967296", + uint64Value: "9223372036854775807", + int32Value: -2147483648, + fixed64Value: "9223372036854775807", + fixed32Value: 4294967295, + boolValue: true, + stringValue: "strprefix/foo", + uint32Value: 4294967295, + sfixed32Value: 2147483647, + sfixed64Value: "-4611686018427387904", + sint32Value: 2147483647, + sint64Value: "4611686018427387903", + nonConventionalNameValue: "camelCase", + + bytesValue: null, + singleNested: null, + nested: [], + enumValue: "ZERO", + repeatedStringValue: [], + mapValue: Object({}), + mappedStringValue: Object({}), + mappedNestedValue: Object({}), + timestampValue: null, + repeatedEnumValue: [], + }; beforeEach(function(done) { - client.ABitOfEverythingService.Create(expected).then(function(resp) { + client.ABitOfEverythingService.Create(params).then(function(resp) { created = resp.obj; }).catch(function(err) { done.fail(err); @@ -57,35 +85,41 @@ describe('ABitOfEverythingService', function() { describe('CreateBody', function() { var created; var expected = { - float_value: 1.5, - double_value: 2.5, - int64_value: "4294967296", - uint64_value: "9223372036854775807", - int32_value: -2147483648, - fixed64_value: "9223372036854775807", - fixed32_value: 4294967295, - bool_value: true, - string_value: "strprefix/foo", - uint32_value: 4294967295, - sfixed32_value: 2147483647, - sfixed64_value: "-4611686018427387904", - sint32_value: 2147483647, - sint64_value: "4611686018427387903", + floatValue: 1.5, + doubleValue: 2.5, + int64Value: "4294967296", + uint64Value: "9223372036854775807", + int32Value: -2147483648, + fixed64Value: "9223372036854775807", + fixed32Value: 4294967295, + boolValue: true, + stringValue: "strprefix/foo", + uint32Value: 4294967295, + sfixed32Value: 2147483647, + sfixed64Value: "-4611686018427387904", + sint32Value: 2147483647, + sint64Value: "4611686018427387903", nonConventionalNameValue: "camelCase", nested: [ - { name: "bar", amount: 10 }, - { name: "baz", amount: 20 }, + { name: "bar", amount: 10, ok: 'FALSE' }, + { name: "baz", amount: 20, ok: 'FALSE' }, ], - repeated_string_value: ["a", "b", "c"], - oneof_string: "x", + repeatedStringValue: ["a", "b", "c"], + oneofString: "x", // TODO(yugui) Support enum by name - map_value: { a: 1, b: 2 }, - mapped_string_value: { a: "x", b: "y" }, - mapped_nested_value: { - a: { name: "x", amount: 1 }, - b: { name: "y", amount: 2 }, + mapValue: { a: 1, b: 2 }, + mappedStringValue: { a: "x", b: "y" }, + mappedNestedValue: { + a: { name: "x", amount: 1, ok: 'FALSE' }, + b: { name: "y", amount: 2, ok: 'FALSE' }, }, + + bytesValue: null, + singleNested: null, + enumValue: "ZERO", + timestampValue: null, + repeatedEnumValue: [], }; beforeEach(function(done) { diff --git a/examples/browser/echo_service.spec.js b/examples/browser/echo_service.spec.js index 97888c3e6c7..eca49f9c552 100644 --- a/examples/browser/echo_service.spec.js +++ b/examples/browser/echo_service.spec.js @@ -21,7 +21,7 @@ describe('EchoService', function() { {id: "foo"}, {responseContentType: "application/json"} ).then(function(resp) { - expect(resp.obj).toEqual({id: "foo"}); + expect(resp.obj).toEqual({id: "foo", num: '0'}); }).catch(function(err) { done.fail(err); }).then(done); @@ -34,7 +34,7 @@ describe('EchoService', function() { {body: {id: "foo"}}, {responseContentType: "application/json"} ).then(function(resp) { - expect(resp.obj).toEqual({id: "foo"}); + expect(resp.obj).toEqual({id: "foo", num: '0'}); }).catch(function(err) { done.fail(err); }).then(done); From 04e17d8331426a842c1298e36d82d6f2a015af8e Mon Sep 17 00:00:00 2001 From: Alex Leigh Date: Thu, 8 Feb 2018 22:45:54 -0800 Subject: [PATCH 4/4] Update generated files. --- .../abe/examplepb_a_bit_of_everything_sans_enum_nested.go | 2 -- examples/examplepb/a_bit_of_everything.pb.go | 2 -- examples/examplepb/a_bit_of_everything.swagger.json | 6 ++---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go b/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go index 7570e52a05c..572ebf8eb20 100644 --- a/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go +++ b/examples/clients/abe/examplepb_a_bit_of_everything_sans_enum_nested.go @@ -10,10 +10,8 @@ package abe -// Nested is nested type. type ExamplepbABitOfEverythingSansEnumNested struct { - // name is nested field. Name string `json:"name,omitempty"` Amount int64 `json:"amount,omitempty"` diff --git a/examples/examplepb/a_bit_of_everything.pb.go b/examples/examplepb/a_bit_of_everything.pb.go index a35c0294f3a..cbcf9282eee 100644 --- a/examples/examplepb/a_bit_of_everything.pb.go +++ b/examples/examplepb/a_bit_of_everything.pb.go @@ -737,9 +737,7 @@ func _ABitOfEverythingSansEnum_OneofSizer(msg proto.Message) (n int) { return n } -// Nested is nested type. type ABitOfEverythingSansEnum_Nested struct { - // name is nested field. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Amount uint32 `protobuf:"varint,2,opt,name=amount" json:"amount,omitempty"` } diff --git a/examples/examplepb/a_bit_of_everything.swagger.json b/examples/examplepb/a_bit_of_everything.swagger.json index 992f61c4a7c..65cfee91cb7 100644 --- a/examples/examplepb/a_bit_of_everything.swagger.json +++ b/examples/examplepb/a_bit_of_everything.swagger.json @@ -1094,15 +1094,13 @@ "type": "object", "properties": { "name": { - "type": "string", - "description": "name is nested field." + "type": "string" }, "amount": { "type": "integer", "format": "int64" } - }, - "description": "Nested is nested type." + } }, "examplepbBody": { "type": "object",