From 622c3a067a69b3e276ed061ee7f2ba4d6db44f28 Mon Sep 17 00:00:00 2001 From: Javier Adriel Date: Thu, 19 Oct 2023 14:38:31 -0600 Subject: [PATCH] Add global params for limit and offset (#3096) --- .github/workflows/jobs.yaml | 2 +- portal-ui/src/api/consoleApi.ts | 102 +++++++--- restapi/embedded_spec.go | 184 +++++++++--------- ...ist_access_rules_with_bucket_parameters.go | 20 +- .../bucket/list_bucket_events_parameters.go | 20 +- .../list_policies_with_bucket_parameters.go | 20 +- ..._users_with_access_to_bucket_parameters.go | 20 +- .../configuration/list_config_parameters.go | 20 +- .../group/list_groups_parameters.go | 20 +- .../object/list_objects_parameters.go | 15 +- .../policy/list_policies_parameters.go | 20 +- .../list_user_service_accounts_parameters.go | 20 +- .../operations/user/list_users_parameters.go | 20 +- swagger.yml | 127 +++--------- 14 files changed, 366 insertions(+), 244 deletions(-) diff --git a/.github/workflows/jobs.yaml b/.github/workflows/jobs.yaml index e6730039a..d05a6bc29 100644 --- a/.github/workflows/jobs.yaml +++ b/.github/workflows/jobs.yaml @@ -1169,7 +1169,7 @@ jobs: go tool cover -func=all.out | grep total > tmp2 result=`cat tmp2 | awk 'END {print $3}'` result=${result%\%} - threshold=71.4 + threshold=71.3 echo "Result:" echo "$result%" if (( $(echo "$result >= $threshold" |bc -l) )); then diff --git a/portal-ui/src/api/consoleApi.ts b/portal-ui/src/api/consoleApi.ts index 2e453fe25..a566cbea5 100644 --- a/portal-ui/src/api/consoleApi.ts +++ b/portal-ui/src/api/consoleApi.ts @@ -1707,10 +1707,9 @@ export class HttpClient { ? { "Content-Type": type } : {}), }, - signal: - (cancelToken - ? this.createAbortSignal(cancelToken) - : requestParams.signal) || null, + signal: cancelToken + ? this.createAbortSignal(cancelToken) + : requestParams.signal, body: typeof body === "undefined" || body === null ? null @@ -2027,7 +2026,10 @@ export class Api< recursive?: boolean; with_versions?: boolean; with_metadata?: boolean; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -2463,9 +2465,15 @@ export class Api< listBucketEvents: ( bucketName: string, query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -2969,9 +2977,15 @@ export class Api< */ listUserServiceAccounts: ( query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -3121,9 +3135,15 @@ export class Api< */ listUsers: ( query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -3395,9 +3415,15 @@ export class Api< */ listGroups: ( query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -3502,9 +3528,15 @@ export class Api< */ listPolicies: ( query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -3587,9 +3619,15 @@ export class Api< listPoliciesWithBucket: ( bucket: string, query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -3640,9 +3678,15 @@ export class Api< listAccessRulesWithBucket: ( bucket: string, query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -3693,9 +3737,15 @@ export class Api< listUsersWithAccessToBucket: ( bucket: string, query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, @@ -3757,9 +3807,15 @@ export class Api< */ listConfig: ( query?: { - /** @format int32 */ + /** + * @format int32 + * @default 0 + */ offset?: number; - /** @format int32 */ + /** + * @format int32 + * @default 20 + */ limit?: number; }, params: RequestParams = {}, diff --git a/restapi/embedded_spec.go b/restapi/embedded_spec.go index fb4f0c901..224090802 100644 --- a/restapi/embedded_spec.go +++ b/restapi/embedded_spec.go @@ -651,16 +651,10 @@ func init() { "required": true }, { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -694,16 +688,10 @@ func init() { "required": true }, { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -740,16 +728,10 @@ func init() { "required": true }, { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -1185,16 +1167,10 @@ func init() { "required": true }, { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -1502,10 +1478,7 @@ func init() { "in": "query" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -2570,16 +2543,10 @@ func init() { "operationId": "ListConfig", "parameters": [ { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -2856,16 +2823,10 @@ func init() { "operationId": "ListGroups", "parameters": [ { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -3936,16 +3897,10 @@ func init() { "operationId": "ListPolicies", "parameters": [ { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -4387,16 +4342,10 @@ func init() { "operationId": "ListUserServiceAccounts", "parameters": [ { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -5202,16 +5151,10 @@ func init() { "operationId": "ListUsers", "parameters": [ { - "type": "integer", - "format": "int32", - "name": "offset", - "in": "query" + "$ref": "#/parameters/offset" }, { - "type": "integer", - "format": "int32", - "name": "limit", - "in": "query" + "$ref": "#/parameters/limit" } ], "responses": { @@ -9062,6 +9005,22 @@ func init() { } } }, + "parameters": { + "limit": { + "type": "number", + "format": "int32", + "default": 20, + "name": "limit", + "in": "query" + }, + "offset": { + "type": "number", + "format": "int32", + "default": 0, + "name": "offset", + "in": "query" + } + }, "securityDefinitions": { "anonymous": { "type": "apiKey", @@ -9698,14 +9657,16 @@ func init() { "required": true }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -9741,14 +9702,16 @@ func init() { "required": true }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -9787,14 +9750,16 @@ func init() { "required": true }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -10232,14 +10197,16 @@ func init() { "required": true }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -10549,8 +10516,9 @@ func init() { "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -11617,14 +11585,16 @@ func init() { "operationId": "ListConfig", "parameters": [ { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -11903,14 +11873,16 @@ func init() { "operationId": "ListGroups", "parameters": [ { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -12983,14 +12955,16 @@ func init() { "operationId": "ListPolicies", "parameters": [ { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -13434,14 +13408,16 @@ func init() { "operationId": "ListUserServiceAccounts", "parameters": [ { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -14249,14 +14225,16 @@ func init() { "operationId": "ListUsers", "parameters": [ { - "type": "integer", + "type": "number", "format": "int32", + "default": 0, "name": "offset", "in": "query" }, { - "type": "integer", + "type": "number", "format": "int32", + "default": 20, "name": "limit", "in": "query" } @@ -18241,6 +18219,22 @@ func init() { } } }, + "parameters": { + "limit": { + "type": "number", + "format": "int32", + "default": 20, + "name": "limit", + "in": "query" + }, + "offset": { + "type": "number", + "format": "int32", + "default": 0, + "name": "offset", + "in": "query" + } + }, "securityDefinitions": { "anonymous": { "type": "apiKey", diff --git a/restapi/operations/bucket/list_access_rules_with_bucket_parameters.go b/restapi/operations/bucket/list_access_rules_with_bucket_parameters.go index b54132fea..2b5987dd9 100644 --- a/restapi/operations/bucket/list_access_rules_with_bucket_parameters.go +++ b/restapi/operations/bucket/list_access_rules_with_bucket_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListAccessRulesWithBucketParams creates a new ListAccessRulesWithBucketParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListAccessRulesWithBucketParams() ListAccessRulesWithBucketParams { - return ListAccessRulesWithBucketParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListAccessRulesWithBucketParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListAccessRulesWithBucketParams contains all the bound params for the list access rules with bucket operation @@ -56,10 +66,12 @@ type ListAccessRulesWithBucketParams struct { Bucket string /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -120,6 +132,7 @@ func (o *ListAccessRulesWithBucketParams) bindLimit(rawData []string, hasKey boo // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListAccessRulesWithBucketParams() return nil } @@ -143,6 +156,7 @@ func (o *ListAccessRulesWithBucketParams) bindOffset(rawData []string, hasKey bo // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListAccessRulesWithBucketParams() return nil } diff --git a/restapi/operations/bucket/list_bucket_events_parameters.go b/restapi/operations/bucket/list_bucket_events_parameters.go index 8a7c35392..26c1d0723 100644 --- a/restapi/operations/bucket/list_bucket_events_parameters.go +++ b/restapi/operations/bucket/list_bucket_events_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListBucketEventsParams creates a new ListBucketEventsParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListBucketEventsParams() ListBucketEventsParams { - return ListBucketEventsParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListBucketEventsParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListBucketEventsParams contains all the bound params for the list bucket events operation @@ -56,10 +66,12 @@ type ListBucketEventsParams struct { BucketName string /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -120,6 +132,7 @@ func (o *ListBucketEventsParams) bindLimit(rawData []string, hasKey bool, format // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListBucketEventsParams() return nil } @@ -143,6 +156,7 @@ func (o *ListBucketEventsParams) bindOffset(rawData []string, hasKey bool, forma // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListBucketEventsParams() return nil } diff --git a/restapi/operations/bucket/list_policies_with_bucket_parameters.go b/restapi/operations/bucket/list_policies_with_bucket_parameters.go index e5b77fe2d..b966665c2 100644 --- a/restapi/operations/bucket/list_policies_with_bucket_parameters.go +++ b/restapi/operations/bucket/list_policies_with_bucket_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListPoliciesWithBucketParams creates a new ListPoliciesWithBucketParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListPoliciesWithBucketParams() ListPoliciesWithBucketParams { - return ListPoliciesWithBucketParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListPoliciesWithBucketParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListPoliciesWithBucketParams contains all the bound params for the list policies with bucket operation @@ -56,10 +66,12 @@ type ListPoliciesWithBucketParams struct { Bucket string /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -120,6 +132,7 @@ func (o *ListPoliciesWithBucketParams) bindLimit(rawData []string, hasKey bool, // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListPoliciesWithBucketParams() return nil } @@ -143,6 +156,7 @@ func (o *ListPoliciesWithBucketParams) bindOffset(rawData []string, hasKey bool, // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListPoliciesWithBucketParams() return nil } diff --git a/restapi/operations/bucket/list_users_with_access_to_bucket_parameters.go b/restapi/operations/bucket/list_users_with_access_to_bucket_parameters.go index e26182dec..2a6e8f218 100644 --- a/restapi/operations/bucket/list_users_with_access_to_bucket_parameters.go +++ b/restapi/operations/bucket/list_users_with_access_to_bucket_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListUsersWithAccessToBucketParams creates a new ListUsersWithAccessToBucketParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListUsersWithAccessToBucketParams() ListUsersWithAccessToBucketParams { - return ListUsersWithAccessToBucketParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListUsersWithAccessToBucketParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListUsersWithAccessToBucketParams contains all the bound params for the list users with access to bucket operation @@ -56,10 +66,12 @@ type ListUsersWithAccessToBucketParams struct { Bucket string /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -120,6 +132,7 @@ func (o *ListUsersWithAccessToBucketParams) bindLimit(rawData []string, hasKey b // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListUsersWithAccessToBucketParams() return nil } @@ -143,6 +156,7 @@ func (o *ListUsersWithAccessToBucketParams) bindOffset(rawData []string, hasKey // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListUsersWithAccessToBucketParams() return nil } diff --git a/restapi/operations/configuration/list_config_parameters.go b/restapi/operations/configuration/list_config_parameters.go index 78dc3a835..0ab9ee940 100644 --- a/restapi/operations/configuration/list_config_parameters.go +++ b/restapi/operations/configuration/list_config_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListConfigParams creates a new ListConfigParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListConfigParams() ListConfigParams { - return ListConfigParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListConfigParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListConfigParams contains all the bound params for the list config operation @@ -51,10 +61,12 @@ type ListConfigParams struct { /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -96,6 +108,7 @@ func (o *ListConfigParams) bindLimit(rawData []string, hasKey bool, formats strf // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListConfigParams() return nil } @@ -119,6 +132,7 @@ func (o *ListConfigParams) bindOffset(rawData []string, hasKey bool, formats str // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListConfigParams() return nil } diff --git a/restapi/operations/group/list_groups_parameters.go b/restapi/operations/group/list_groups_parameters.go index 3f87f8c83..0a4cb0e52 100644 --- a/restapi/operations/group/list_groups_parameters.go +++ b/restapi/operations/group/list_groups_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListGroupsParams creates a new ListGroupsParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListGroupsParams() ListGroupsParams { - return ListGroupsParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListGroupsParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListGroupsParams contains all the bound params for the list groups operation @@ -51,10 +61,12 @@ type ListGroupsParams struct { /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -96,6 +108,7 @@ func (o *ListGroupsParams) bindLimit(rawData []string, hasKey bool, formats strf // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListGroupsParams() return nil } @@ -119,6 +132,7 @@ func (o *ListGroupsParams) bindOffset(rawData []string, hasKey bool, formats str // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListGroupsParams() return nil } diff --git a/restapi/operations/object/list_objects_parameters.go b/restapi/operations/object/list_objects_parameters.go index 2c41a14bf..7c06ad03c 100644 --- a/restapi/operations/object/list_objects_parameters.go +++ b/restapi/operations/object/list_objects_parameters.go @@ -33,11 +33,18 @@ import ( ) // NewListObjectsParams creates a new ListObjectsParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListObjectsParams() ListObjectsParams { - return ListObjectsParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + ) + + return ListObjectsParams{ + Limit: &limitDefault, + } } // ListObjectsParams contains all the bound params for the list objects operation @@ -56,6 +63,7 @@ type ListObjectsParams struct { BucketName string /* In: query + Default: 20 */ Limit *int32 /* @@ -147,6 +155,7 @@ func (o *ListObjectsParams) bindLimit(rawData []string, hasKey bool, formats str // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListObjectsParams() return nil } diff --git a/restapi/operations/policy/list_policies_parameters.go b/restapi/operations/policy/list_policies_parameters.go index b1ea4fc30..5ba782bca 100644 --- a/restapi/operations/policy/list_policies_parameters.go +++ b/restapi/operations/policy/list_policies_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListPoliciesParams creates a new ListPoliciesParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListPoliciesParams() ListPoliciesParams { - return ListPoliciesParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListPoliciesParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListPoliciesParams contains all the bound params for the list policies operation @@ -51,10 +61,12 @@ type ListPoliciesParams struct { /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -96,6 +108,7 @@ func (o *ListPoliciesParams) bindLimit(rawData []string, hasKey bool, formats st // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListPoliciesParams() return nil } @@ -119,6 +132,7 @@ func (o *ListPoliciesParams) bindOffset(rawData []string, hasKey bool, formats s // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListPoliciesParams() return nil } diff --git a/restapi/operations/service_account/list_user_service_accounts_parameters.go b/restapi/operations/service_account/list_user_service_accounts_parameters.go index dc87b130c..75fbf5a4a 100644 --- a/restapi/operations/service_account/list_user_service_accounts_parameters.go +++ b/restapi/operations/service_account/list_user_service_accounts_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListUserServiceAccountsParams creates a new ListUserServiceAccountsParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListUserServiceAccountsParams() ListUserServiceAccountsParams { - return ListUserServiceAccountsParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListUserServiceAccountsParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListUserServiceAccountsParams contains all the bound params for the list user service accounts operation @@ -51,10 +61,12 @@ type ListUserServiceAccountsParams struct { /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -96,6 +108,7 @@ func (o *ListUserServiceAccountsParams) bindLimit(rawData []string, hasKey bool, // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListUserServiceAccountsParams() return nil } @@ -119,6 +132,7 @@ func (o *ListUserServiceAccountsParams) bindOffset(rawData []string, hasKey bool // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListUserServiceAccountsParams() return nil } diff --git a/restapi/operations/user/list_users_parameters.go b/restapi/operations/user/list_users_parameters.go index d0678a35f..2da360d4e 100644 --- a/restapi/operations/user/list_users_parameters.go +++ b/restapi/operations/user/list_users_parameters.go @@ -33,11 +33,21 @@ import ( ) // NewListUsersParams creates a new ListUsersParams object -// -// There are no default values defined in the spec. +// with the default values initialized. func NewListUsersParams() ListUsersParams { - return ListUsersParams{} + var ( + // initialize parameters with default values + + limitDefault = int32(20) + offsetDefault = int32(0) + ) + + return ListUsersParams{ + Limit: &limitDefault, + + Offset: &offsetDefault, + } } // ListUsersParams contains all the bound params for the list users operation @@ -51,10 +61,12 @@ type ListUsersParams struct { /* In: query + Default: 20 */ Limit *int32 /* In: query + Default: 0 */ Offset *int32 } @@ -96,6 +108,7 @@ func (o *ListUsersParams) bindLimit(rawData []string, hasKey bool, formats strfm // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListUsersParams() return nil } @@ -119,6 +132,7 @@ func (o *ListUsersParams) bindOffset(rawData []string, hasKey bool, formats strf // AllowEmptyValue: false if raw == "" { // empty values pass all other validations + // Default values have been previously initialized by NewListUsersParams() return nil } diff --git a/swagger.yml b/swagger.yml index 719bdb072..9fc45d5cb 100644 --- a/swagger.yml +++ b/swagger.yml @@ -26,6 +26,19 @@ securityDefinitions: # Apply the key security definition to all APIs security: - key: [] +parameters: + limit: + name: limit + in: query + type: number + format: int32 + default: 20 + offset: + name: offset + in: query + type: number + format: int32 + default: 0 paths: /login: get: @@ -306,11 +319,7 @@ paths: in: query required: false type: boolean - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -811,16 +820,8 @@ paths: in: path required: true type: string - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -1343,16 +1344,8 @@ paths: summary: List User's Service Accounts operationId: ListUserServiceAccounts parameters: - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -1496,16 +1489,8 @@ paths: summary: List Users operationId: ListUsers parameters: - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -1780,16 +1765,8 @@ paths: summary: List Groups operationId: ListGroups parameters: - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -1887,16 +1864,8 @@ paths: summary: List Policies operationId: ListPolicies parameters: - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -1984,16 +1953,8 @@ paths: in: path required: true type: string - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -2039,16 +2000,8 @@ paths: in: path required: true type: string - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -2094,16 +2047,8 @@ paths: in: path required: true type: string - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response. @@ -2161,16 +2106,8 @@ paths: summary: List Configurations operationId: ListConfig parameters: - - name: offset - in: query - required: false - type: integer - format: int32 - - name: limit - in: query - required: false - type: integer - format: int32 + - $ref: "#/parameters/offset" + - $ref: "#/parameters/limit" responses: 200: description: A successful response.