Fix Swagger @router

This commit is contained in:
Yang Luo
2024-01-15 23:27:42 +08:00
parent dc6fe13f75
commit b469928780
7 changed files with 941 additions and 483 deletions

View File

@ -453,7 +453,7 @@ func (c *ApiController) GetUserinfo2() {
// GetCaptcha ...
// @Tag Login API
// @Title GetCaptcha
// @router /api/get-captcha [get]
// @router /get-captcha [get]
// @Success 200 {object} object.Userinfo The Response object
func (c *ApiController) GetCaptcha() {
applicationId := c.Input().Get("applicationId")

View File

@ -918,7 +918,7 @@ func (c *ApiController) HandleSamlLogin() {
// HandleOfficialAccountEvent ...
// @Tag HandleOfficialAccountEvent API
// @Title HandleOfficialAccountEvent
// @router /api/webhook [POST]
// @router /webhook [POST]
// @Success 200 {object} object.Userinfo The Response object
func (c *ApiController) HandleOfficialAccountEvent() {
respBytes, err := ioutil.ReadAll(c.Ctx.Request.Body)
@ -949,7 +949,7 @@ func (c *ApiController) HandleOfficialAccountEvent() {
// GetWebhookEventType ...
// @Tag GetWebhookEventType API
// @Title GetWebhookEventType
// @router /api/get-webhook-event [GET]
// @router /get-webhook-event [GET]
// @Success 200 {object} object.Userinfo The Response object
func (c *ApiController) GetWebhookEventType() {
lock.Lock()
@ -970,7 +970,7 @@ func (c *ApiController) GetWebhookEventType() {
// @Description Get Login Error Counts
// @Param id query string true "The id ( owner/name ) of user"
// @Success 200 {object} controllers.Response The Response object
// @router /api/get-captcha-status [get]
// @router /get-captcha-status [get]
func (c *ApiController) GetCaptchaStatus() {
organization := c.Input().Get("organization")
userId := c.Input().Get("userId")
@ -1001,7 +1001,7 @@ func (c *ApiController) GetCaptchaStatus() {
// @Title Callback
// @Tag Callback API
// @Description Get Login Error Counts
// @router /api/Callback [post]
// @router /Callback [post]
// @Success 200 {object} object.Userinfo The Response object
func (c *ApiController) Callback() {
code := c.GetString("code")

View File

@ -52,7 +52,7 @@ type NotificationForm struct {
// @Param clientSecret query string true "The clientSecret of the application"
// @Param from body controllers.EmailForm true "Details of the email request"
// @Success 200 {object} controllers.Response The Response object
// @router /api/send-email [post]
// @router /send-email [post]
func (c *ApiController) SendEmail() {
userId, ok := c.RequireSignedIn()
if !ok {
@ -148,7 +148,7 @@ func (c *ApiController) SendEmail() {
// @Param clientSecret query string true "The clientSecret of the application"
// @Param from body controllers.SmsForm true "Details of the sms request"
// @Success 200 {object} controllers.Response The Response object
// @router /api/send-sms [post]
// @router /send-sms [post]
func (c *ApiController) SendSms() {
provider, err := c.GetProviderFromContext("SMS")
if err != nil {
@ -186,7 +186,7 @@ func (c *ApiController) SendSms() {
// @Description This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
// @Param from body controllers.NotificationForm true "Details of the notification request"
// @Success 200 {object} controllers.Response The Response object
// @router /api/send-notification [post]
// @router /send-notification [post]
func (c *ApiController) SendNotification() {
provider, err := c.GetProviderFromContext("Notification")
if err != nil {

View File

@ -156,7 +156,7 @@ func (c *ApiController) DeleteToken() {
// @Success 200 {object} object.TokenWrapper The Response object
// @Success 400 {object} object.TokenError The Response object
// @Success 401 {object} object.TokenError The Response object
// @router api/login/oauth/access_token [post]
// @router /login/oauth/access_token [post]
func (c *ApiController) GetOAuthToken() {
clientId := c.Input().Get("client_id")
clientSecret := c.Input().Get("client_secret")

View File

@ -272,7 +272,7 @@ func (c *ApiController) VerifyCaptcha() {
// ResetEmailOrPhone ...
// @Tag Account API
// @Title ResetEmailOrPhone
// @router /api/reset-email-or-phone [post]
// @router /reset-email-or-phone [post]
// @Success 200 {object} object.Userinfo The Response object
func (c *ApiController) ResetEmailOrPhone() {
user, ok := c.RequireSignedInUser()
@ -367,7 +367,7 @@ func (c *ApiController) ResetEmailOrPhone() {
// VerifyCode
// @Tag Verification API
// @Title VerifyCode
// @router /api/verify-code [post]
// @router /verify-code [post]
// @Success 200 {object} object.Userinfo The Response object
func (c *ApiController) VerifyCode() {
var authForm form.AuthForm

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,17 @@ paths:
description: ""
schema:
$ref: '#/definitions/object.OidcDiscovery'
/api/Callback:
post:
tags:
- Callback API
description: Get Login Error Counts
operationId: ApiController.Callback
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/add-adapter:
post:
tags:
@ -121,6 +132,24 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/add-invitation:
post:
tags:
- Invitation API
description: add invitation
operationId: ApiController.AddInvitation
parameters:
- in: body
name: body
description: The details of the invitation
required: true
schema:
$ref: '#/definitions/object.Invitation'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/add-ldap:
post:
tags:
@ -442,158 +471,6 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/api/Callback:
post:
tags:
- Callback API
description: Get Login Error Counts
operationId: ApiController.Callback
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/api/get-captcha:
get:
tags:
- Login API
operationId: ApiController.GetCaptcha
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/api/get-captcha-status:
get:
tags:
- Token API
description: Get Login Error Counts
operationId: ApiController.GetCaptchaStatus
parameters:
- in: query
name: id
description: The id ( owner/name ) of user
required: true
type: string
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/api/get-webhook-event:
get:
tags:
- GetWebhookEventType API
operationId: ApiController.GetWebhookEventType
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/api/reset-email-or-phone:
post:
tags:
- Account API
operationId: ApiController.ResetEmailOrPhone
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/api/send-email:
post:
tags:
- Service API
description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
operationId: ApiController.SendEmail
parameters:
- in: query
name: clientId
description: The clientId of the application
required: true
type: string
- in: query
name: clientSecret
description: The clientSecret of the application
required: true
type: string
- in: body
name: from
description: Details of the email request
required: true
schema:
$ref: '#/definitions/controllers.EmailForm'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/api/send-notification:
post:
tags:
- Service API
description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
operationId: ApiController.SendNotification
parameters:
- in: body
name: from
description: Details of the notification request
required: true
schema:
$ref: '#/definitions/controllers.NotificationForm'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/api/send-sms:
post:
tags:
- Service API
description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
operationId: ApiController.SendSms
parameters:
- in: query
name: clientId
description: The clientId of the application
required: true
type: string
- in: query
name: clientSecret
description: The clientSecret of the application
required: true
type: string
- in: body
name: from
description: Details of the sms request
required: true
schema:
$ref: '#/definitions/controllers.SmsForm'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/api/verify-code:
post:
tags:
- Verification API
operationId: ApiController.VerifyCode
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/api/webhook:
post:
tags:
- HandleOfficialAccountEvent API
operationId: ApiController.HandleOfficialAccountEvent
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/batch-enforce:
post:
tags:
@ -617,6 +494,10 @@ paths:
name: modelId
description: model id
type: string
- in: query
name: owner
description: owner
type: string
responses:
"200":
description: The Response object
@ -744,6 +625,24 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/delete-invitation:
post:
tags:
- Invitation API
description: delete invitation
operationId: ApiController.DeleteInvitation
parameters:
- in: body
name: body
description: The details of the invitation
required: true
schema:
$ref: '#/definitions/object.Invitation'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/delete-ldap:
post:
tags:
@ -1088,6 +987,10 @@ paths:
name: resourceId
description: resource id
type: string
- in: query
name: owner
description: owner
type: string
responses:
"200":
description: The Response object
@ -1213,6 +1116,33 @@ paths:
type: array
items:
$ref: '#/definitions/object.Application'
/api/get-captcha:
get:
tags:
- Login API
operationId: ApiController.GetCaptcha
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/get-captcha-status:
get:
tags:
- Token API
description: Get Login Error Counts
operationId: ApiController.GetCaptchaStatus
parameters:
- in: query
name: id
description: The id ( owner/name ) of user
required: true
type: string
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/get-cert:
get:
tags:
@ -1410,6 +1340,42 @@ paths:
type: array
items:
$ref: '#/definitions/object.Group'
/api/get-invitation:
get:
tags:
- Invitation API
description: get invitation
operationId: ApiController.GetInvitation
parameters:
- in: query
name: id
description: The id ( owner/name ) of the invitation
required: true
type: string
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Invitation'
/api/get-invitations:
get:
tags:
- Invitation API
description: get invitations
operationId: ApiController.GetInvitations
parameters:
- in: query
name: owner
description: The owner of invitations
required: true
type: string
responses:
"200":
description: The Response object
schema:
type: array
items:
$ref: '#/definitions/object.Invitation'
/api/get-ldap:
get:
tags:
@ -2269,6 +2235,16 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/object.Webhook'
/api/get-webhook-event:
get:
tags:
- GetWebhookEventType API
operationId: ApiController.GetWebhookEventType
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/get-webhooks:
get:
tags:
@ -2396,6 +2372,46 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/login/oauth/access_token:
post:
tags:
- Token API
description: get OAuth access token
operationId: ApiController.GetOAuthToken
parameters:
- in: query
name: grant_type
description: OAuth grant type
required: true
type: string
- in: query
name: client_id
description: OAuth client id
required: true
type: string
- in: query
name: client_secret
description: OAuth client secret
required: true
type: string
- in: query
name: code
description: OAuth code
required: true
type: string
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.TokenWrapper'
"400":
description: The Response object
schema:
$ref: '#/definitions/object.TokenError'
"401":
description: The Response object
schema:
$ref: '#/definitions/object.TokenError'
/api/login/oauth/introspect:
post:
description: The introspection endpoint is an OAuth 2.0 endpoint that takes a
@ -2543,6 +2559,16 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/reset-email-or-phone:
post:
tags:
- Account API
operationId: ApiController.ResetEmailOrPhone
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/run-syncer:
get:
tags:
@ -2561,6 +2587,80 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/send-email:
post:
tags:
- Service API
description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
operationId: ApiController.SendEmail
parameters:
- in: query
name: clientId
description: The clientId of the application
required: true
type: string
- in: query
name: clientSecret
description: The clientSecret of the application
required: true
type: string
- in: body
name: from
description: Details of the email request
required: true
schema:
$ref: '#/definitions/controllers.EmailForm'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/send-notification:
post:
tags:
- Service API
description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
operationId: ApiController.SendNotification
parameters:
- in: body
name: from
description: Details of the notification request
required: true
schema:
$ref: '#/definitions/controllers.NotificationForm'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/send-sms:
post:
tags:
- Service API
description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs.
operationId: ApiController.SendSms
parameters:
- in: query
name: clientId
description: The clientId of the application
required: true
type: string
- in: query
name: clientSecret
description: The clientSecret of the application
required: true
type: string
- in: body
name: from
description: Details of the sms request
required: true
schema:
$ref: '#/definitions/controllers.SmsForm'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/send-verification-code:
post:
tags:
@ -2778,6 +2878,29 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/update-invitation:
post:
tags:
- Invitation API
description: update invitation
operationId: ApiController.UpdateInvitation
parameters:
- in: query
name: id
description: The id ( owner/name ) of the invitation
required: true
type: string
- in: body
name: body
description: The details of the invitation
required: true
schema:
$ref: '#/definitions/object.Invitation'
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/update-ldap:
post:
tags:
@ -3245,6 +3368,33 @@ paths:
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/verify-code:
post:
tags:
- Verification API
operationId: ApiController.VerifyCode
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.Userinfo'
/api/verify-invitation:
get:
tags:
- Invitation API
description: verify invitation
operationId: ApiController.VerifyInvitation
parameters:
- in: query
name: id
description: The id ( owner/name ) of the invitation
required: true
type: string
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/controllers.Response'
/api/webauthn/signin/begin:
get:
tags:
@ -3314,46 +3464,16 @@ paths:
description: '"The Response object"'
schema:
$ref: '#/definitions/controllers.Response'
/apiapi/login/oauth/access_token:
/api/webhook:
post:
tags:
- Token API
description: get OAuth access token
operationId: ApiController.GetOAuthToken
parameters:
- in: query
name: grant_type
description: OAuth grant type
required: true
type: string
- in: query
name: client_id
description: OAuth client id
required: true
type: string
- in: query
name: client_secret
description: OAuth client secret
required: true
type: string
- in: query
name: code
description: OAuth code
required: true
type: string
- HandleOfficialAccountEvent API
operationId: ApiController.HandleOfficialAccountEvent
responses:
"200":
description: The Response object
schema:
$ref: '#/definitions/object.TokenWrapper'
"400":
description: The Response object
schema:
$ref: '#/definitions/object.TokenError'
"401":
description: The Response object
schema:
$ref: '#/definitions/object.TokenError'
$ref: '#/definitions/object.Userinfo'
definitions:
casbin.Enforcer:
title: Enforcer
@ -3546,10 +3666,10 @@ definitions:
expireInHours:
type: integer
format: int64
failedSigninLimit:
failedSigninFrozenTime:
type: integer
format: int64
failedSigninFrozenTime:
failedSigninLimit:
type: integer
format: int64
forgetUrl:
@ -3606,6 +3726,10 @@ definitions:
type: string
signinHtml:
type: string
signinMethods:
type: array
items:
$ref: '#/definitions/object.SigninMethod'
signinUrl:
type: string
signupHtml:
@ -3624,6 +3748,10 @@ definitions:
type: string
themeData:
$ref: '#/definitions/object.ThemeData'
tokenFields:
type: array
items:
type: string
tokenFormat:
type: string
object.Cert:
@ -3780,6 +3908,40 @@ definitions:
type: string
username:
type: string
object.Invitation:
title: Invitation
type: object
properties:
application:
type: string
code:
type: string
createdTime:
type: string
displayName:
type: string
email:
type: string
name:
type: string
owner:
type: string
phone:
type: string
quota:
type: integer
format: int64
signupGroup:
type: string
state:
type: string
updatedTime:
type: string
usedCount:
type: integer
format: int64
username:
type: string
object.Ldap:
title: Ldap
type: object
@ -4455,6 +4617,16 @@ definitions:
type: string
value:
type: string
object.SigninMethod:
title: SigninMethod
type: object
properties:
displayName:
type: string
name:
type: string
rule:
type: string
object.SignupItem:
title: SignupItem
type: object
@ -4467,6 +4639,8 @@ definitions:
type: string
prompted:
type: boolean
regex:
type: string
required:
type: boolean
rule: