update openapi

This commit is contained in:
Pascal Fischer 2023-06-02 01:09:18 +02:00
parent 1939973c2e
commit 75fbaf811b
3 changed files with 17 additions and 13 deletions

View File

@ -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)

View File

@ -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

View File

@ -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