aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/emicklei/go-restful/parameter.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/emicklei/go-restful/parameter.go')
-rw-r--r--vendor/github.com/emicklei/go-restful/parameter.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/github.com/emicklei/go-restful/parameter.go b/vendor/github.com/emicklei/go-restful/parameter.go
index e11c8162a..e8793304b 100644
--- a/vendor/github.com/emicklei/go-restful/parameter.go
+++ b/vendor/github.com/emicklei/go-restful/parameter.go
@@ -19,8 +19,30 @@ const (
// FormParameterKind = indicator of Request parameter type "form"
FormParameterKind
+
+ // CollectionFormatCSV comma separated values `foo,bar`
+ CollectionFormatCSV = CollectionFormat("csv")
+
+ // CollectionFormatSSV space separated values `foo bar`
+ CollectionFormatSSV = CollectionFormat("ssv")
+
+ // CollectionFormatTSV tab separated values `foo\tbar`
+ CollectionFormatTSV = CollectionFormat("tsv")
+
+ // CollectionFormatPipes pipe separated values `foo|bar`
+ CollectionFormatPipes = CollectionFormat("pipes")
+
+ // CollectionFormatMulti corresponds to multiple parameter instances instead of multiple values for a single
+ // instance `foo=bar&foo=baz`. This is valid only for QueryParameters and FormParameters
+ CollectionFormatMulti = CollectionFormat("multi")
)
+type CollectionFormat string
+
+func (cf CollectionFormat) String() string {
+ return string(cf)
+}
+
// Parameter is for documententing the parameter used in a Http Request
// ParameterData kinds are Path,Query and Body
type Parameter struct {
@@ -36,6 +58,7 @@ type ParameterData struct {
AllowableValues map[string]string
AllowMultiple bool
DefaultValue string
+ CollectionFormat string
}
// Data returns the state of the Parameter
@@ -112,3 +135,9 @@ func (p *Parameter) Description(doc string) *Parameter {
p.data.Description = doc
return p
}
+
+// CollectionFormat sets the collection format for an array type
+func (p *Parameter) CollectionFormat(format CollectionFormat) *Parameter {
+ p.data.CollectionFormat = format.String()
+ return p
+}