Removing unused parameters (#1465)

This commit is contained in:
Cesar Celis Hernandez
2022-01-28 21:24:53 -06:00
committed by GitHub
parent d8b387434b
commit 4a1ccf19a0
15 changed files with 63 additions and 210 deletions

View File

@@ -621,25 +621,6 @@ func init() {
],
"summary": "List Buckets",
"operationId": "ListBuckets",
"parameters": [
{
"type": "string",
"name": "sort_by",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"name": "offset",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "A successful response.",
@@ -6697,25 +6678,6 @@ func init() {
],
"summary": "List Buckets",
"operationId": "ListBuckets",
"parameters": [
{
"type": "string",
"name": "sort_by",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"name": "offset",
"in": "query"
},
{
"type": "integer",
"format": "int32",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "A successful response.",

View File

@@ -26,10 +26,7 @@ import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// NewListBucketsParams creates a new ListBucketsParams object
@@ -48,19 +45,6 @@ type ListBucketsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
In: query
*/
Limit *int32
/*
In: query
*/
Offset *int32
/*
In: query
*/
SortBy *string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
@@ -72,88 +56,8 @@ func (o *ListBucketsParams) BindRequest(r *http.Request, route *middleware.Match
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
qLimit, qhkLimit, _ := qs.GetOK("limit")
if err := o.bindLimit(qLimit, qhkLimit, route.Formats); err != nil {
res = append(res, err)
}
qOffset, qhkOffset, _ := qs.GetOK("offset")
if err := o.bindOffset(qOffset, qhkOffset, route.Formats); err != nil {
res = append(res, err)
}
qSortBy, qhkSortBy, _ := qs.GetOK("sort_by")
if err := o.bindSortBy(qSortBy, qhkSortBy, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindLimit binds and validates parameter Limit from query.
func (o *ListBucketsParams) bindLimit(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
value, err := swag.ConvertInt32(raw)
if err != nil {
return errors.InvalidType("limit", "query", "int32", raw)
}
o.Limit = &value
return nil
}
// bindOffset binds and validates parameter Offset from query.
func (o *ListBucketsParams) bindOffset(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
value, err := swag.ConvertInt32(raw)
if err != nil {
return errors.InvalidType("offset", "query", "int32", raw)
}
o.Offset = &value
return nil
}
// bindSortBy binds and validates parameter SortBy from query.
func (o *ListBucketsParams) bindSortBy(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: false
// AllowEmptyValue: false
if raw == "" { // empty values pass all other validations
return nil
}
o.SortBy = &raw
return nil
}

View File

@@ -26,19 +26,11 @@ import (
"errors"
"net/url"
golangswaggerpaths "path"
"github.com/go-openapi/swag"
)
// ListBucketsURL generates an URL for the list buckets operation
type ListBucketsURL struct {
Limit *int32
Offset *int32
SortBy *string
_basePath string
// avoid unkeyed usage
_ struct{}
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
@@ -68,34 +60,6 @@ func (o *ListBucketsURL) Build() (*url.URL, error) {
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
qs := make(url.Values)
var limitQ string
if o.Limit != nil {
limitQ = swag.FormatInt32(*o.Limit)
}
if limitQ != "" {
qs.Set("limit", limitQ)
}
var offsetQ string
if o.Offset != nil {
offsetQ = swag.FormatInt32(*o.Offset)
}
if offsetQ != "" {
qs.Set("offset", offsetQ)
}
var sortByQ string
if o.SortBy != nil {
sortByQ = *o.SortBy
}
if sortByQ != "" {
qs.Set("sort_by", sortByQ)
}
_result.RawQuery = qs.Encode()
return &_result, nil
}