Skip to content

Commit

Permalink
Adding support for default and required swagger annotation fields. (g…
Browse files Browse the repository at this point in the history
…rpc-ecosystem#852)

* Adding support for default and required swagger annotation fields:Solves issue grpc-ecosystem#851

* Fixing test for swagger generation

* updating swagger definition

* removing breaking changes over enums

* Adding example for required field as an array
  • Loading branch information
Fabian Hernandez authored and johanbrandhorst committed Jan 22, 2019
1 parent 078fa17 commit 9221822
Show file tree
Hide file tree
Showing 6 changed files with 251 additions and 216 deletions.
6 changes: 3 additions & 3 deletions examples/clients/abe/a_bit_of_everything_service_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewABitOfEverythingServiceApiWithBasePath(basePath string) *ABitOfEverythin
* Create a new ABitOfEverything
* This API creates a new ABitOfEverything
*
* @param floatValue
* @param floatValue Float value field
* @param doubleValue
* @param int64Value
* @param uint64Value
Expand Down Expand Up @@ -521,10 +521,10 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb
*
*
* @param uuid
* @param floatValue Float value field
* @param singleNestedName name is nested field.
* @param singleNestedAmount
* @param singleNestedOk - FALSE: FALSE is false. - TRUE: TRUE is true.
* @param floatValue
* @param doubleValue
* @param int64Value
* @param uint64Value
Expand All @@ -549,7 +549,7 @@ func (a ABitOfEverythingServiceApi) GetMessageWithBody(id string, body Examplepb
* @param repeatedEnumValue repeated enum value. it is comma-separated in query. - ZERO: ZERO means 0 - ONE: ONE means 1
* @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) (*interface{}, *APIResponse, error) {
func (a ABitOfEverythingServiceApi) GetQuery(uuid string, floatValue float32, singleNestedName string, singleNestedAmount int64, singleNestedOk string, 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
5 changes: 3 additions & 2 deletions examples/clients/abe/examplepb_a_bit_of_everything.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ type ExamplepbABitOfEverything struct {

Nested []ABitOfEverythingNested `json:"nested,omitempty"`

// Float value field
FloatValue float32 `json:"float_value,omitempty"`

DoubleValue float64 `json:"double_value,omitempty"`
DoubleValue float64 `json:"double_value"`

Int64Value string `json:"int64_value,omitempty"`
Int64Value string `json:"int64_value"`

Uint64Value string `json:"uint64_value,omitempty"`

Expand Down
Loading

0 comments on commit 9221822

Please sign in to comment.