Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly omit wrappers and google.protobuf.empty from swagger definitions #801

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ ABE_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/abe/a_bit_of_everything_nested.go \
$(EXAMPLE_CLIENT_DIR)/abe/examplepb_body.go \
$(EXAMPLE_CLIENT_DIR)/abe/examplepb_numeric_enum.go \
$(EXAMPLE_CLIENT_DIR)/abe/nested_deep_enum.go \
$(EXAMPLE_CLIENT_DIR)/abe/protobuf_empty.go \
$(EXAMPLE_CLIENT_DIR)/abe/sub_string_message.go
UNANNOTATED_ECHO_EXAMPLE_SPEC=examples/proto/examplepb/unannotated_echo_service.swagger.json
UNANNOTATED_ECHO_EXAMPLE_SRCS=$(EXAMPLE_CLIENT_DIR)/unannotatedecho/api_client.go \
Expand Down
1 change: 0 additions & 1 deletion examples/clients/abe/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ go_library(
"message_path_enum_nested_path_enum.go",
"nested_deep_enum.go",
"pathenum_path_enum.go",
"protobuf_empty.go",
"protobuf_field_mask.go",
"sub_string_message.go",
],
Expand Down
60 changes: 30 additions & 30 deletions examples/clients/abe/a_bit_of_everything_service_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ func (a ABitOfEverythingServiceApi) DeepPathEcho(singleNestedName string, body E
*
*
* @param uuid
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) Delete(uuid string) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Delete")
// create path and map variables
Expand Down Expand Up @@ -350,7 +350,7 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand All @@ -371,9 +371,9 @@ func (a ABitOfEverythingServiceApi) Delete(uuid string) (*ProtobufEmpty, *APIRes
/**
*
*
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
Expand Down Expand Up @@ -422,7 +422,7 @@ func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResp
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand All @@ -445,9 +445,9 @@ func (a ABitOfEverythingServiceApi) ErrorWithDetails() (*ProtobufEmpty, *APIResp
*
* @param id
* @param body
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body ExamplepbBody) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
Expand Down Expand Up @@ -499,7 +499,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb
}
// body params
localVarPostBody = &body
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand Down Expand Up @@ -547,9 +547,9 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb
* @param nonConventionalNameValue
* @param timestampValue
* @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName string, singleNestedAmount int64, singleNestedOk string, floatValue float32, doubleValue float64, int64Value string, uint64Value string, int32Value int32, fixed64Value string, fixed32Value int64, boolValue bool, stringValue string, bytesValue string, uint32Value int64, enumValue string, pathEnumValue string, nestedPathEnumValue string, sfixed32Value int32, sfixed64Value string, sint32Value int32, sint64Value string, repeatedStringValue []string, oneofString string, nonConventionalNameValue string, timestampValue time.Time, repeatedEnumValue []string) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
Expand Down Expand Up @@ -616,7 +616,7 @@ func (a ABitOfEverythingServiceApi) GetQuery(uuid string, singleNestedName strin
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand Down Expand Up @@ -817,9 +817,9 @@ func (a ABitOfEverythingServiceApi) Lookup(uuid string) (*ExamplepbABitOfEveryth
*
* @param abeUuid
* @param body
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, body ExamplepbUpdateV2Request) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Patch")
// create path and map variables
Expand Down Expand Up @@ -871,7 +871,7 @@ func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, bod
}
// body params
localVarPostBody = &body
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand All @@ -894,9 +894,9 @@ func (a ABitOfEverythingServiceApi) PatchWithFieldMaskInBody(abeUuid string, bod
*
* @param name
* @param body
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body ExamplepbBody) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Post")
// create path and map variables
Expand Down Expand Up @@ -948,7 +948,7 @@ func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body Examplep
}
// body params
localVarPostBody = &body
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand All @@ -969,9 +969,9 @@ func (a ABitOfEverythingServiceApi) PostWithEmptyBody(name string, body Examplep
/**
*
*
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) Timeout() (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
Expand Down Expand Up @@ -1020,7 +1020,7 @@ func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, err
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand All @@ -1043,9 +1043,9 @@ func (a ABitOfEverythingServiceApi) Timeout() (*ProtobufEmpty, *APIResponse, err
*
* @param uuid
* @param body
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Put")
// create path and map variables
Expand Down Expand Up @@ -1097,7 +1097,7 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver
}
// body params
localVarPostBody = &body
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand All @@ -1120,9 +1120,9 @@ func (a ABitOfEverythingServiceApi) Update(uuid string, body ExamplepbABitOfEver
*
* @param abeUuid
* @param body
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Put")
// create path and map variables
Expand Down Expand Up @@ -1174,7 +1174,7 @@ func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitO
}
// body params
localVarPostBody = &body
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand All @@ -1197,9 +1197,9 @@ func (a ABitOfEverythingServiceApi) UpdateV2(abeUuid string, body ExamplepbABitO
*
* @param abeUuid
* @param body
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*ProtobufEmpty, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABitOfEverything) (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Patch")
// create path and map variables
Expand Down Expand Up @@ -1251,7 +1251,7 @@ func (a ABitOfEverythingServiceApi) UpdateV22(abeUuid string, body ExamplepbABit
}
// body params
localVarPostBody = &body
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand Down
6 changes: 3 additions & 3 deletions examples/clients/abe/camel_case_service_name_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ func NewCamelCaseServiceNameApiWithBasePath(basePath string) *CamelCaseServiceNa
* Create a new ABitOfEverything
* This API creates a new ABitOfEverything
*
* @return *ProtobufEmpty
* @return *interface{}
*/
func (a CamelCaseServiceNameApi) Empty() (*ProtobufEmpty, *APIResponse, error) {
func (a CamelCaseServiceNameApi) Empty() (*interface{}, *APIResponse, error) {

var localVarHttpMethod = strings.ToUpper("Get")
// create path and map variables
Expand Down Expand Up @@ -91,7 +91,7 @@ func (a CamelCaseServiceNameApi) Empty() (*ProtobufEmpty, *APIResponse, error) {
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
var successPayload = new(ProtobufEmpty)
var successPayload = new(interface{})
localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)

var localVarURL, _ = url.Parse(localVarPath)
Expand Down
2 changes: 1 addition & 1 deletion examples/clients/abe/examplepb_a_bit_of_everything.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type ExamplepbABitOfEverything struct {

RepeatedStringValue []string `json:"repeated_string_value,omitempty"`

OneofEmpty ProtobufEmpty `json:"oneof_empty,omitempty"`
OneofEmpty interface{} `json:"oneof_empty,omitempty"`

OneofString string `json:"oneof_string,omitempty"`

Expand Down
15 changes: 0 additions & 15 deletions examples/clients/abe/protobuf_empty.go

This file was deleted.

29 changes: 12 additions & 17 deletions examples/proto/examplepb/a_bit_of_everything.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -636,7 +636,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -683,7 +683,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -960,7 +960,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1006,7 +1006,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1160,7 +1160,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1192,7 +1192,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1224,7 +1224,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1272,7 +1272,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1304,7 +1304,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1352,7 +1352,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
}
},
"403": {
Expand Down Expand Up @@ -1521,7 +1521,7 @@
}
},
"oneof_empty": {
"$ref": "#/definitions/protobufEmpty"
"properties": {}
},
"oneof_string": {
"type": "string"
Expand Down Expand Up @@ -1723,11 +1723,6 @@
],
"default": "ABC"
},
"protobufEmpty": {
"type": "object",
"description": "service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.",
"title": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:"
},
"protobufFieldMask": {
"type": "object",
"properties": {
Expand Down
Loading