Skip to content

Commit

Permalink
fix: Fixed swagger params
Browse files Browse the repository at this point in the history
  • Loading branch information
bahattincinic committed May 20, 2024
1 parent 3090f15 commit 2c9cb22
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func (a *API) getDashboardComponents(c echo.Context) error {
// @Accept json
// @Produce json
// @Success 201 {object} models.Component
// @Param id path string true "Dashboard ID"
// @Param input body api.createComponent.componentInput true "Component Input"
// @Router /dashboards/{id}/components [post]
func (a *API) createComponent(c echo.Context) error {
Expand Down Expand Up @@ -226,6 +227,8 @@ func (a *API) createComponent(c echo.Context) error {
// @Accept json
// @Produce json
// @Success 200 {object} models.Component
// @Param id path string true "Dashboard ID"
// @Param cpid path string true "Component ID"
// @Param input body api.updateComponent.componentInput true "Component Input"
// @Router /dashboards/{id}/components/{cpid} [put]
func (a *API) updateComponent(c echo.Context) error {
Expand Down Expand Up @@ -271,6 +274,8 @@ func (a *API) updateComponent(c echo.Context) error {
// @Accept json
// @Produce json
// @Success 204
// @Param id path string true "Dashboard ID"
// @Param cpid path string true "Component ID"
// @Router /dashboards/{id}/components/{cpid} [delete]
func (a *API) deleteComponent(c echo.Context) error {
component := c.Get(componentContextKey).(*models.Component)
Expand All @@ -288,7 +293,9 @@ func (a *API) deleteComponent(c echo.Context) error {
// @Tags dashboard
// @Accept json
// @Produce json
// @Success 200 {object} queue.TaskResult
// @Success 200 {object} queue.TaskResult
// @Param id path string true "Dashboard ID"
// @Param cpid path string true "Component ID"
// @Router /dashboards/{id}/components/{cpid}/run [post]
func (a *API) runComponent(c echo.Context) error {
component := c.Get(componentContextKey).(*models.Component)
Expand Down
53 changes: 53 additions & 0 deletions api/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,13 @@ const docTemplate = `{
],
"summary": "Create Dashboard Components",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Component Input",
"name": "input",
Expand Down Expand Up @@ -532,6 +539,20 @@ const docTemplate = `{
],
"summary": "Update Dashboard Component",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Component ID",
"name": "cpid",
"in": "path",
"required": true
},
{
"description": "Component Input",
"name": "input",
Expand Down Expand Up @@ -562,6 +583,22 @@ const docTemplate = `{
"dashboard"
],
"summary": "Delete Dashboard Component",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Component ID",
"name": "cpid",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
Expand All @@ -581,6 +618,22 @@ const docTemplate = `{
"dashboard"
],
"summary": "Run Dashboard Component",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Component ID",
"name": "cpid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
Expand Down
53 changes: 53 additions & 0 deletions api/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,13 @@
],
"summary": "Create Dashboard Components",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Component Input",
"name": "input",
Expand Down Expand Up @@ -521,6 +528,20 @@
],
"summary": "Update Dashboard Component",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Component ID",
"name": "cpid",
"in": "path",
"required": true
},
{
"description": "Component Input",
"name": "input",
Expand Down Expand Up @@ -551,6 +572,22 @@
"dashboard"
],
"summary": "Delete Dashboard Component",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Component ID",
"name": "cpid",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
Expand All @@ -570,6 +607,22 @@
"dashboard"
],
"summary": "Run Dashboard Component",
"parameters": [
{
"type": "string",
"description": "Dashboard ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Component ID",
"name": "cpid",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
Expand Down
37 changes: 37 additions & 0 deletions api/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,11 @@ paths:
consumes:
- application/json
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: string
- description: Component Input
in: body
name: input
Expand All @@ -716,6 +721,17 @@ paths:
delete:
consumes:
- application/json
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: string
- description: Component ID
in: path
name: cpid
required: true
type: string
produces:
- application/json
responses:
Expand All @@ -728,6 +744,16 @@ paths:
consumes:
- application/json
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: string
- description: Component ID
in: path
name: cpid
required: true
type: string
- description: Component Input
in: body
name: input
Expand All @@ -748,6 +774,17 @@ paths:
post:
consumes:
- application/json
parameters:
- description: Dashboard ID
in: path
name: id
required: true
type: string
- description: Component ID
in: path
name: cpid
required: true
type: string
produces:
- application/json
responses:
Expand Down

0 comments on commit 2c9cb22

Please sign in to comment.