From 9224cd3ef7e44e8684c47891b93b64688d4e223e Mon Sep 17 00:00:00 2001 From: tnextday Date: Sat, 20 Aug 2016 11:22:03 +0800 Subject: [PATCH 1/2] add ParameterItems in Parameter --- swagger/swagger.go | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/swagger/swagger.go b/swagger/swagger.go index 1060477a..6f9f7b93 100644 --- a/swagger/swagger.go +++ b/swagger/swagger.go @@ -89,13 +89,24 @@ type Operation struct { // Parameter Describes a single operation parameter. type Parameter struct { - In string `json:"in,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` - Required bool `json:"required,omitempty"` - Schema *Schema `json:"schema,omitempty"` - Type string `json:"type,omitempty"` - Format string `json:"format,omitempty"` + In string `json:"in,omitempty"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + Required bool `json:"required,omitempty"` + Schema *Schema `json:"schema,omitempty"` + Type string `json:"type,omitempty"` + Format string `json:"format,omitempty"` + Items *ParameterItems `json:"items,omitempty"` +} + +// A limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located in "body". +// http://swagger.io/specification/#itemsObject +type ParameterItems struct { + Type string `json:"type,omitempty"` + Format string `json:"format,omitempty"` + Items []*ParameterItems `json:"items,omitempty"` //Required if type is "array". Describes the type of items in the array. + CollectionFormat string `json:"collectionFormat,omitempty"` + Default string `json:"default,omitempty"` } // Schema Object allows the definition of input and output data types. From 7253ff2f8ca66dfbd74bb5a45cb0959ee98f68f7 Mon Sep 17 00:00:00 2001 From: tnextday Date: Sat, 20 Aug 2016 15:03:41 +0800 Subject: [PATCH 2/2] update schema define --- swagger/swagger.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swagger/swagger.go b/swagger/swagger.go index 0043a8e1..a16b26b4 100644 --- a/swagger/swagger.go +++ b/swagger/swagger.go @@ -117,7 +117,7 @@ type Schema struct { Description string `json:"description,omitempty"` Required []string `json:"required,omitempty"` Type string `json:"type,omitempty"` - Items *Propertie `json:"items,omitempty"` + Items *Schema `json:"items,omitempty"` Properties map[string]Propertie `json:"properties,omitempty"` }