diff --git a/management/server/http/accounts_handler.go b/management/server/http/accounts_handler.go index c1c0352bb..13d5909ce 100644 --- a/management/server/http/accounts_handler.go +++ b/management/server/http/accounts_handler.go @@ -65,7 +65,7 @@ func (h *AccountsHandler) UpdateAccount(w http.ResponseWriter, r *http.Request) return } - var req api.PutApiAccountsAccountIdJSONBody + var req api.PutApiAccountsAccountIdJSONRequestBody err = json.NewDecoder(r.Body).Decode(&req) if err != nil { util.WriteErrorResponse("couldn't parse JSON request", http.StatusBadRequest, w) diff --git a/management/server/http/api/openapi.yml b/management/server/http/api/openapi.yml index 67a2f8f53..d495710e0 100644 --- a/management/server/http/api/openapi.yml +++ b/management/server/http/api/openapi.yml @@ -32,6 +32,7 @@ tags: components: schemas: Account: + type: object properties: id: description: Account ID @@ -43,6 +44,7 @@ components: - id - settings AccountSettings: + type: object properties: peer_login_expiration_enabled: description: Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login). @@ -55,6 +57,13 @@ components: required: - peer_login_expiration_enabled - peer_login_expiration + AccountRequest: + type: object + properties: + settings: + $ref: '#/components/schemas/AccountSettings' + required: + - settings User: type: object properties: @@ -975,12 +984,7 @@ paths: content: 'application/json': schema: - type: object - properties: - settings: - $ref: '#/components/schemas/AccountSettings' - required: - - settings + $ref: '#/components/schemas/AccountRequest' responses: '200': description: An Account object diff --git a/management/server/http/api/types.gen.go b/management/server/http/api/types.gen.go index 9c67425c4..8ef1bc935 100644 --- a/management/server/http/api/types.gen.go +++ b/management/server/http/api/types.gen.go @@ -122,6 +122,11 @@ type Account struct { Settings AccountSettings `json:"settings"` } +// AccountRequest defines model for AccountRequest. +type AccountRequest struct { + Settings AccountSettings `json:"settings"` +} + // AccountSettings defines model for AccountSettings. type AccountSettings struct { // PeerLoginExpiration Period of time after which peer login expires (seconds). @@ -788,11 +793,6 @@ type UserRequest struct { Role string `json:"role"` } -// PutApiAccountsAccountIdJSONBody defines parameters for PutApiAccountsAccountId. -type PutApiAccountsAccountIdJSONBody struct { - Settings AccountSettings `json:"settings"` -} - // GetApiUsersParams defines parameters for GetApiUsers. type GetApiUsersParams struct { // ServiceUser Filters users and returns either regular users or service users @@ -800,7 +800,7 @@ type GetApiUsersParams struct { } // PutApiAccountsAccountIdJSONRequestBody defines body for PutApiAccountsAccountId for application/json ContentType. -type PutApiAccountsAccountIdJSONRequestBody PutApiAccountsAccountIdJSONBody +type PutApiAccountsAccountIdJSONRequestBody = AccountRequest // PostApiDnsNameserversJSONRequestBody defines body for PostApiDnsNameservers for application/json ContentType. type PostApiDnsNameserversJSONRequestBody = NameserverGroupRequest